aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/mtrr.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-02-20 11:11:40 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-02-20 11:11:40 +0000
commit3a3034d1015f9360068d8719e22afbe06a2bedbb (patch)
tree6d1bb015512d44a7af9df8145cba41c2f9410989 /xen/arch/x86/hvm/mtrr.c
parentd3d0b89247f091dd6961c739c91a8a613cdffe65 (diff)
downloadxen-3a3034d1015f9360068d8719e22afbe06a2bedbb.tar.gz
xen-3a3034d1015f9360068d8719e22afbe06a2bedbb.tar.bz2
xen-3a3034d1015f9360068d8719e22afbe06a2bedbb.zip
[VTD] Utilise the snoop control capability in shadow with VT-d code
We compute the shadow PAT index in leaf page entries now as: 1) No VT-d assigned: let shadow PAT index as WB, handled already in shadow code before. 2) direct assigned MMIO area: let shadow code compute the shadow PAT with gMTRR=UC and gPAT value. 3) Snoop control enable: let shadow PAT index as WB. 4) Snoop control disable: let shadow code compute the shadow PAT with gMTRR and gPAT, handled already in shadow code before Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
Diffstat (limited to 'xen/arch/x86/hvm/mtrr.c')
-rw-r--r--xen/arch/x86/hvm/mtrr.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 6f64062cf9..e1448d99ee 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -351,11 +351,18 @@ static uint8_t page_pat_type(uint64_t pat_cr, uint32_t pte_flags)
static uint8_t effective_mm_type(struct mtrr_state *m,
uint64_t pat,
paddr_t gpa,
- uint32_t pte_flags)
+ uint32_t pte_flags,
+ uint8_t gmtrr_mtype)
{
uint8_t mtrr_mtype, pat_value, effective;
-
- mtrr_mtype = get_mtrr_type(m, gpa);
+
+ /* if get_pat_flags() gives a dedicated MTRR type,
+ * just use it
+ */
+ if ( gmtrr_mtype == NO_HARDCODE_MEM_TYPE )
+ mtrr_mtype = get_mtrr_type(m, gpa);
+ else
+ mtrr_mtype = gmtrr_mtype;
pat_value = page_pat_type(pat, pte_flags);
@@ -367,7 +374,8 @@ static uint8_t effective_mm_type(struct mtrr_state *m,
uint32_t get_pat_flags(struct vcpu *v,
uint32_t gl1e_flags,
paddr_t gpaddr,
- paddr_t spaddr)
+ paddr_t spaddr,
+ uint8_t gmtrr_mtype)
{
uint8_t guest_eff_mm_type;
uint8_t shadow_mtrr_type;
@@ -378,7 +386,8 @@ uint32_t get_pat_flags(struct vcpu *v,
/* 1. Get the effective memory type of guest physical address,
* with the pair of guest MTRR and PAT
*/
- guest_eff_mm_type = effective_mm_type(g, pat, gpaddr, gl1e_flags);
+ guest_eff_mm_type = effective_mm_type(g, pat, gpaddr,
+ gl1e_flags, gmtrr_mtype);
/* 2. Get the memory type of host physical address, with MTRR */
shadow_mtrr_type = get_mtrr_type(&mtrr_state, spaddr);