]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
iommu: fix check for autotranslated hardware domain
authorRoger Pau Monné <roger.pau@citrix.com>
Thu, 5 Mar 2020 09:43:46 +0000 (10:43 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 5 Mar 2020 09:43:46 +0000 (10:43 +0100)
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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/iommu.c

index cab7a068aa10766c0ae0619885427f9cfdee6f73..dac1b58fa5a9949ec9a17c9617f20fb637f8cbd4 100644 (file)
@@ -172,6 +172,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;
 
@@ -188,9 +191,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