aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/mtrr.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-01-23 14:42:29 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-01-23 14:42:29 +0000
commit7b97780b624ac22d393b9064bbaba31b50e01ad0 (patch)
treef28ac46c31c24bc852843489b8cd567fe4c7c6f5 /xen/arch/x86/hvm/mtrr.c
parent83833d973b14318d04e0740c8557ffb683679fa1 (diff)
downloadxen-7b97780b624ac22d393b9064bbaba31b50e01ad0.tar.gz
xen-7b97780b624ac22d393b9064bbaba31b50e01ad0.tar.bz2
xen-7b97780b624ac22d393b9064bbaba31b50e01ad0.zip
EPT/VT-d: Enhance MTRR/PAT virtualization when EPT/VT-d both enabled
Set effective memory type for EPT according to the VT-d snoop control capability, and also includes some cleanups for EPT & VT-d both enabled. Signed-off-by: Edwin Zhai <Edwin.Zhai@intel.com> Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Diffstat (limited to 'xen/arch/x86/hvm/mtrr.c')
-rw-r--r--xen/arch/x86/hvm/mtrr.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index d6692d2b3d..6f64062cf9 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -702,12 +702,15 @@ HVM_REGISTER_SAVE_RESTORE(MTRR, hvm_save_mtrr_msr, hvm_load_mtrr_msr,
1, HVMSR_PER_VCPU);
uint8_t epte_get_entry_emt(
- struct domain *d, unsigned long gfn, unsigned long mfn)
+ struct domain *d, unsigned long gfn,
+ unsigned long mfn, uint8_t *igmt, int direct_mmio)
{
uint8_t gmtrr_mtype, hmtrr_mtype;
uint32_t type;
struct vcpu *v = current;
+ *igmt = 0;
+
if ( (current->domain != d) && ((v = d->vcpu[0]) == NULL) )
return MTRR_TYPE_WRBACK;
@@ -723,6 +726,21 @@ uint8_t epte_get_entry_emt(
if ( hvm_get_mem_pinned_cacheattr(d, gfn, &type) )
return type;
+ if ( !iommu_enabled )
+ {
+ *igmt = 1;
+ return MTRR_TYPE_WRBACK;
+ }
+
+ if ( direct_mmio )
+ return MTRR_TYPE_UNCACHABLE;
+
+ if ( iommu_snoop )
+ {
+ *igmt = 1;
+ return MTRR_TYPE_WRBACK;
+ }
+
gmtrr_mtype = get_mtrr_type(&v->arch.hvm_vcpu.mtrr, (gfn << PAGE_SHIFT));
hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn << PAGE_SHIFT));
return ((gmtrr_mtype <= hmtrr_mtype) ? gmtrr_mtype : hmtrr_mtype);