From: Tim Deegan Date: Tue, 23 Aug 2011 09:43:20 +0000 (+0100) Subject: VT-d: Explicitly test EPT capabilities during IOMMU init X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~9945 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6abdf3c829a15d8e051e2bf3fd231c45b70643f6;p=xen.git VT-d: Explicitly test EPT capabilities during IOMMU init because the cached version isn't set up until the EPT init happens. Signed-off-by: Tim Deegan --- diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 91e8c3b3b4..3bcfe59602 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1739,15 +1739,15 @@ void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, static int vtd_ept_page_compatible(struct iommu *iommu) { - u64 cap = iommu->cap; + u64 ept_cap, vtd_cap = iommu->cap; - if ( ept_has_2mb(cpu_has_vmx_ept_2mb) != cap_sps_2mb(cap) ) + /* EPT is not initialised yet, so we must check the capability in + * the MSR explicitly rather than use cpu_has_vmx_ept_*() */ + if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) return 0; - if ( ept_has_1gb(cpu_has_vmx_ept_1gb) != cap_sps_1gb(cap) ) - return 0; - - return 1; + return ( ept_has_2mb(ept_cap) == cap_sps_2mb(vtd_cap) + && ept_has_1gb(ept_cap) == cap_sps_1gb(vtd_cap) ); } /*