]> xenbits.xensource.com Git - xen.git/commitdiff
x86/vmx: Simplify PAT handling during vcpu construction
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 24 May 2018 13:15:32 +0000 (14:15 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 28 Jun 2018 10:31:00 +0000 (11:31 +0100)
The host PAT value is a compile time constant, and doesn't need to be read out
of hardware.  Merge this if block into the previous block, which has an
identical condition.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/hvm/vmx/vmcs.c

index 258fc08f728f8f377c474c0c5f6938db8d1b90d6..13b9cc5dbe224fc693d49809a1d5e5960ad772de 100644 (file)
@@ -1248,17 +1248,9 @@ static int construct_vmcs(struct vcpu *v)
 
         ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m));
         __vmwrite(EPT_POINTER, ept->eptp);
-    }
-
-    if ( paging_mode_hap(d) )
-    {
-        u64 host_pat, guest_pat;
-
-        rdmsrl(MSR_IA32_CR_PAT, host_pat);
-        guest_pat = MSR_IA32_CR_PAT_RESET;
 
-        __vmwrite(HOST_PAT, host_pat);
-        __vmwrite(GUEST_PAT, guest_pat);
+        __vmwrite(HOST_PAT, XEN_MSR_PAT);
+        __vmwrite(GUEST_PAT, MSR_IA32_CR_PAT_RESET);
     }
     if ( cpu_has_vmx_mpx )
         __vmwrite(GUEST_BNDCFGS, 0);