diff options
author | Tim Deegan <tim@xen.org> | 2011-08-23 10:43:20 +0100 |
---|---|---|
committer | Tim Deegan <tim@xen.org> | 2011-08-23 10:43:20 +0100 |
commit | 1b7cb0158a160365c1af526e3db31796b94b522c (patch) | |
tree | c0c0e4fda8e0a7b62ae3fb765538194545380ba3 | |
parent | d85567061901e8d191f3283b8d92a9c2a3bba3de (diff) | |
download | xen-1b7cb0158a160365c1af526e3db31796b94b522c.tar.gz xen-1b7cb0158a160365c1af526e3db31796b94b522c.tar.bz2 xen-1b7cb0158a160365c1af526e3db31796b94b522c.zip |
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 <tim@xen.org>
xen-unstable changeset: 23787:41f00cf6b822
xen-unstable date: Tue Aug 23 10:43:20 2011 +0100
-rw-r--r-- | xen/drivers/passthrough/vtd/iommu.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index b299495e54..ae45a0de40 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1748,15 +1748,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) ); } /* |