Skip to contentSkip to conversation

x86/p2m: fix non-translated handling of iommu mappings

PATCH In review Roger Pau Monne 3 participants 3 messages Jul 23, 2019 – Aug 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Paul Durrant <[email protected]>
---
Changes since v1:
- Drop the guest_physmap_add_page modification.

---
 xen/arch/x86/mm/p2m.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/mm/p2m.c +2 -2
index fef97c82f6..3605614aaf 100644
@@ -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);
     }
Signature · 7 lines
2.20.1 (Apple Git-117)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Roger Pau Monne

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by on v2 1/1
#2 lore raw
In reply to Roger Pau Monne
Quoted 7 lines · Roger Pau Monne

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel