From 3957e12c02670b97855ef0933b373f99993fa598 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roger=20Pau=20Monn=C3=A9?= Date: Tue, 21 Apr 2020 10:54:56 +0200 Subject: [PATCH] x86/vtd: relax EPT page table sharing check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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é Reviewed-by: Jan Beulich Reviewed-by: Kevin Tian --- xen/drivers/passthrough/vtd/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 07d40b37fe..208b33c0e4 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1914,8 +1914,8 @@ static int __init vtd_ept_page_compatible(struct vtd_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); } /* -- 2.30.2