The current usage of need_iommu_pt_sync in p2m for non-translated guests is wrong because it doesn't correctly handle a relaxed PV hardware domain, that has need_sync set to false, but still need entries to be added from calls to {set/clear}_identity_p2m_entry.
Adjust the code in guest_physmap_add_page to also check whether the domain has an iommu instead of whether it needs syncing or not in order to take a reference to a page to be mapped. Signed-off-by: Roger Pau Monné <roger....@citrix.com> --- Cc: George Dunlap <george.dun...@eu.citrix.com> Cc: Jan Beulich <jbeul...@suse.com> Cc: Andrew Cooper <andrew.coop...@citrix.com> Cc: Wei Liu <w...@xen.org> Cc: Paul Durrant <paul.durr...@citrix.com> --- xen/arch/x86/mm/p2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index fef97c82f6..88a2430c8c 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -836,7 +836,7 @@ guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn, */ for ( i = 0; i < (1UL << page_order); ++i, ++page ) { - if ( !need_iommu_pt_sync(d) ) + if ( !has_iommu_pt(d) ) /* nothing */; else if ( get_page_and_type(page, d, PGT_writable_page) ) put_page_and_type(page); @@ -1341,7 +1341,7 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn_l, if ( !paging_mode_translate(p2m->domain) ) { - if ( !need_iommu_pt_sync(d) ) + if ( !has_iommu_pt(d) ) return 0; return iommu_legacy_map(d, _dfn(gfn_l), _mfn(gfn_l), PAGE_ORDER_4K, IOMMUF_readable | IOMMUF_writable); @@ -1432,7 +1432,7 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l) if ( !paging_mode_translate(d) ) { - if ( !need_iommu_pt_sync(d) ) + if ( !has_iommu_pt(d) ) return 0; return iommu_legacy_unmap(d, _dfn(gfn_l), PAGE_ORDER_4K); } -- 2.20.1 (Apple Git-117) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel