[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.13] iommu: fix check for autotranslated hardware domain



commit ac75ea8b670a5b4029909b38987da996b8a94dae
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Thu Apr 9 09:08:17 2020 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 9 09:08:17 2020 +0200

    iommu: fix check for autotranslated hardware domain
    
    The current position of the check_hwdom_reqs is wrong, as there's a
    is_iommu_enabled at the top of the function that will prevent getting
    to the check on systems without an IOMMU, because the hardware domain
    won't have the XEN_DOMCTL_CDF_iommu flag set.
    
    Move the position of the check so it's done before the
    is_iommu_enabled one, and thus attempts to create a translated
    hardware domain without an IOMMU can be detected.
    
    Fixes: f89f555827a ('remove late (on-demand) construction of IOMMU page 
tables')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: faf0d606a6eb911449075b83ea0ad085960c9acb
    master date: 2020-03-05 10:43:46 +0100
---
 xen/drivers/passthrough/iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 05e740757a..bab7a3d099 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -171,6 +171,9 @@ int iommu_domain_init(struct domain *d, unsigned int opts)
     struct domain_iommu *hd = dom_iommu(d);
     int ret = 0;
 
+    if ( is_hardware_domain(d) )
+        check_hwdom_reqs(d); /* may modify iommu_hwdom_strict */
+
     if ( !is_iommu_enabled(d) )
         return 0;
 
@@ -187,9 +190,6 @@ int iommu_domain_init(struct domain *d, unsigned int opts)
     if ( ret || is_system_domain(d) )
         return ret;
 
-    if ( is_hardware_domain(d) )
-        check_hwdom_reqs(d); /* may modify iommu_hwdom_strict */
-
     /*
      * Use shared page tables for HAP and IOMMU if the global option
      * is enabled (from which we can infer the h/w is capable) and
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.