From: Roger Pau Monne Date: Tue, 23 Jul 2019 12:43:43 +0000 (+0200) Subject: x86/p2m: fix non-translated handling of iommu mappings X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=77a994f3f8eb0d3cb0f2bf314b0ebf6a1d37f623;p=people%2Fiwj%2Fxen.git x86/p2m: fix non-translated handling of iommu mappings 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. Signed-off-by: Roger Pau Monné Reviewed-by: Paul Durrant Reviewed-by: Jan Beulich Acked-by: George Dunlap Tested-by: Roman Shaposhnik --- diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 4b1e38b131..8a5229ee21 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -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); }