[xen staging] x86/vtd: fix iommu_share_p2m_table

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen staging] x86/vtd: fix iommu_share_p2m_table

patchbot
commit e9be34be5f9a1a6ecbf05ba9502cd705ae441476
Author:     Roger Pau Monné <[hidden email]>
AuthorDate: Tue Oct 9 16:27:13 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Tue Oct 9 16:27:13 2018 +0200

    x86/vtd: fix iommu_share_p2m_table
   
    Commit 2916951c1 "mm / iommu: include need_iommu() test in
    iommu_use_hap_pt()" changed the check in iommu_share_p2m_table to use
    need_iommu(d) (as part of iommu_use_hap_pt) instead of iommu_enabled,
    which broke the check because at the point in domain construction
    where iommu_share_p2m_table is called need_iommu(d) will always return
    false.
   
    Fix this by reverting to the previous logic.
   
    While there turn the hap_enabled check into an ASSERT, since the only
    caller of iommu_share_p2m_table already performs the hap_enabled check
    before calling the function.
   
    Signed-off-by: Roger Pau Monné <[hidden email]>
    Reviewed-by: Paul Durrant <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
---
 xen/drivers/passthrough/iommu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index debb5e6fe1..e03de6e3ab 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -505,7 +505,12 @@ int iommu_do_domctl(
 
 void iommu_share_p2m_table(struct domain* d)
 {
-    if ( iommu_use_hap_pt(d) )
+    ASSERT(hap_enabled(d));
+    /*
+     * iommu_use_hap_pt(d) cannot be used here because during domain
+     * construction need_iommu(d) will always return false here.
+     */
+    if ( iommu_enabled && iommu_hap_pt_share )
         iommu_get_ops()->share_p2m(d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog