]> xenbits.xensource.com Git - xen.git/commitdiff
x86/vtd: relax EPT page table sharing check
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 27 Apr 2020 13:53:26 +0000 (15:53 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 27 Apr 2020 13:53:26 +0000 (15:53 +0200)
The EPT page tables can be shared with the IOMMU as long as the page
sizes supported by EPT are also supported by the IOMMU.

Current code checks that both the IOMMU and EPT support the same page
sizes, but this is not strictly required, the IOMMU supporting more
page sizes than EPT is fine and shouldn't block page table sharing.

This is likely not a common case (IOMMU supporting more page sizes
than EPT), but should still be fixed for correctness.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
master commit: 3957e12c02670b97855ef0933b373f99993fa598
master date: 2020-04-21 10:54:56 +0200

xen/drivers/passthrough/vtd/iommu.c

index 77ba8e14a6b4198efcbd21bd74505fd8d16dd890..ed50d34c911147a25e521597cac982743046b4fc 100644 (file)
@@ -1957,8 +1957,8 @@ static int __init vtd_ept_page_compatible(struct iommu *iommu)
     if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) 
         return 0;
 
-    return (ept_has_2mb(ept_cap) && opt_hap_2mb) == cap_sps_2mb(vtd_cap) &&
-           (ept_has_1gb(ept_cap) && opt_hap_1gb) == cap_sps_1gb(vtd_cap);
+    return (ept_has_2mb(ept_cap) && opt_hap_2mb) <= cap_sps_2mb(vtd_cap) &&
+           (ept_has_1gb(ept_cap) && opt_hap_1gb) <= cap_sps_1gb(vtd_cap);
 }
 
 /*