xen: Fix {set,clear}_foreign_p2m_mapping on autotranslating guests

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/781198f1f373c3e350dbeb3af04a7d4c81c1b8d7
Commit:     781198f1f373c3e350dbeb3af04a7d4c81c1b8d7
Parent:     761191258839b7d922b83064c4251b8bd4e2e7c2
Refname:    refs/heads/master
Author:     Simon Gaiser <[email protected]>
AuthorDate: Wed Feb 7 21:47:40 2018 +0100
Committer:  Juergen Gross <[email protected]>
CommitDate: Thu Feb 8 10:40:49 2018 +0100

    xen: Fix {set,clear}_foreign_p2m_mapping on autotranslating guests
    
    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: <[email protected]> # 4.14
    Fixes: 82616f9599a7 ("xen: remove tests for pvh mode in pure pv paths")
    Signed-off-by: Simon Gaiser <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Signed-off-by: Juergen Gross <[email protected]>
---
 arch/x86/xen/p2m.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 13b4f19b9131..159a897151d6 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -694,6 +694,9 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
 	int i, ret = 0;
 	pte_t *pte;
 
+	if (xen_feature(XENFEAT_auto_translated_physmap))
+		return 0;
+
 	if (kmap_ops) {
 		ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
 						kmap_ops, count);
@@ -736,6 +739,9 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
 {
 	int i, ret = 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]));
 		unsigned long pfn = page_to_pfn(pages[i]);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.