|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/P2M: p2m_get_page_from_gfn() is HVM-only
commit c9e802e916423111652424a93d98f67ae7135afc
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Apr 8 14:45:37 2022 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Apr 8 14:45:37 2022 +0200
x86/P2M: p2m_get_page_from_gfn() is HVM-only
This function is the wrong layer to go through for PV guests. It happens
to work, but produces results which aren't fully consistent with
get_page_from_gfn(). The latter function, however, cannot be used in
map_domain_gfn() as it may not be the host P2M we mean to act on.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
xen/arch/x86/mm/guest_walk.c | 4 +++-
xen/arch/x86/mm/p2m.c | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 35d543ca5f..70dacc477f 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -551,7 +551,9 @@ void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn,
mfn_t *mfn,
}
/* Translate the gfn, unsharing if shared. */
- page = p2m_get_page_from_gfn(p2m, gfn, &p2mt, NULL, q);
+ page = paging_mode_translate(p2m->domain)
+ ? p2m_get_page_from_gfn(p2m, gfn, &p2mt, NULL, q)
+ : get_page_from_gfn(p2m->domain, gfn_x(gfn), &p2mt, q);
if ( p2m_is_paging(p2mt) )
{
ASSERT(p2m_is_hostp2m(p2m));
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 6498cd460b..c3653b013d 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -357,6 +357,8 @@ void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
gfn_unlock(p2m, gfn, 0);
}
+#ifdef CONFIG_HVM
+
/* Atomically look up a GFN and take a reference count on the backing page. */
struct page_info *p2m_get_page_from_gfn(
struct p2m_domain *p2m, gfn_t gfn,
@@ -422,8 +424,6 @@ struct page_info *p2m_get_page_from_gfn(
return page;
}
-#ifdef CONFIG_HVM
-
/* Returns: 0 for success, -errno for failure */
int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |