From: Simon Gaiser <simon@invisiblethingslab.com>
Date: Wed, 7 Feb 2018 21:47:40 +0100
Subject: xen: Fix {set,clear}_foreign_p2m_mapping on autotranslating guests
Git-commit: 781198f1f373c3e350dbeb3af04a7d4c81c1b8d7
Patch-mainline: v4.16-rc1
References: bsc#1110006
Commit 82616f9599a7 ("xen: remove tests for pvh mode in pure pv paths")
removed the check for autotranslation from {set,clear}_foreign_p2m_mapping
but those are called by grant-table.c also on PVH/HVM guests.
Cc: <stable@vger.kernel.org> # 4.14
Fixes: 82616f9599a7 ("xen: remove tests for pvh mode in pure pv paths")
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
---
arch/x86/xen/p2m.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -714,6 +714,9 @@ int set_foreign_p2m_mapping(struct gntta
if (xen_feature(XENFEAT_auto_translated_physmap))
return 0;
+ if (xen_feature(XENFEAT_auto_translated_physmap))
+ return 0;
+
if (kmap_ops) {
ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
kmap_ops, count);
@@ -758,6 +761,9 @@ int clear_foreign_p2m_mapping(struct gnt
if (xen_feature(XENFEAT_auto_translated_physmap))
return 0;
+
+ if (xen_feature(XENFEAT_auto_translated_physmap))
+ return 0;
for (i = 0; i < count; i++) {
unsigned long mfn = __pfn_to_mfn(page_to_pfn(pages[i]));