]> xenbits.xensource.com Git - xen.git/commitdiff
x86/pvh: change epte_get_entry_emt() for pvh mem types
authorMukesh Rathor <mukesh.rathor@oracle.com>
Mon, 25 Nov 2013 10:20:06 +0000 (11:20 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Nov 2013 10:20:06 +0000 (11:20 +0100)
For pvh guests, epte_get_entry_emt() is incorrectly returning WB for
all mem types because of the following check:
    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
Skip the check for pvh guests.

Also note, MTRR ranges are not maintained for pvh, and a solution is
being contrived using PAT.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Reviewed-off-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/mtrr.c

index 4ff1e55fd36d7e85b681300f59f7cf8c7236ebf3..9937f5ab93cb7a772213ce0adb9d51caf1e12985 100644 (file)
@@ -693,7 +693,8 @@ uint8_t epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
          ((d->vcpu == NULL) || ((v = d->vcpu[0]) == NULL)) )
         return MTRR_TYPE_WRBACK;
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
+    if ( !is_pvh_vcpu(v) &&
+         !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
         return MTRR_TYPE_WRBACK;
 
     if ( !mfn_valid(mfn_x(mfn)) )
@@ -717,7 +718,10 @@ uint8_t epte_get_entry_emt(struct domain *d, unsigned long gfn, mfn_t mfn,
         return MTRR_TYPE_WRBACK;
     }
 
-    gmtrr_mtype = get_mtrr_type(&v->arch.hvm_vcpu.mtrr, (gfn << PAGE_SHIFT));
+    gmtrr_mtype = is_hvm_vcpu(v) ?
+                  get_mtrr_type(&v->arch.hvm_vcpu.mtrr, (gfn << PAGE_SHIFT)) :
+                  MTRR_TYPE_WRBACK;
+
     hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn_x(mfn) << PAGE_SHIFT));
     return ((gmtrr_mtype <= hmtrr_mtype) ? gmtrr_mtype : hmtrr_mtype);
 }