VMX: fix PAT value seen by guest
PATCH 1/1 VMX: fix PAT value seen by guest
The XSA-60 fixes introduced a window during which the guest PAT gets forced to all zeros. This shouldn't be visible to the guest. Therefore we need to intercept PAT MSR accesses during that time period.
xen/arch/x86/hvm/vmx/vmx.c +5 -0
@@ -1033,6 +1033,8 @@ static void vmx_handle_cd(struct vcpu *vvmx_get_guest_pat (v, pat);vmx_set_guest_pat (v, uc_pat); +vmx_enable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );wbinvd ();/* flush possibly polluted cache */ hvm_asid_flush_vcpu (v);/* invalidate memory type cached in TLB */
@@ -1042,6 +1044,9 @@ static void vmx_handle_cd(struct vcpu *v { v->arch.hvm_vcpu.cache_mode =NORMAL_CACHE_MODE ;vmx_set_guest_pat (v, *pat); +if ( !iommu_enabled || iommu_snoop ) +vmx_disable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );hvm_asid_flush_vcpu (v);/* no need to flush cache */ } }
VMX: fix PAT value seen by guest
The XSA-60 fixes introduced a window during which the guest PAT gets forced to all zeros. This shouldn't be visible to the guest. Therefore we need to intercept PAT MSR accesses during that time period.
xen/arch/x86/hvm/vmx/vmx.c +5 -0
@@ -1033,6 +1033,8 @@ static void vmx_handle_cd(struct vcpu *vvmx_get_guest_pat (v, pat);vmx_set_guest_pat (v, uc_pat); +vmx_enable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );wbinvd ();/* flush possibly polluted cache */ hvm_asid_flush_vcpu (v);/* invalidate memory type cached in TLB */
@@ -1042,6 +1044,9 @@ static void vmx_handle_cd(struct vcpu *v { v->arch.hvm_vcpu.cache_mode =NORMAL_CACHE_MODE ;vmx_set_guest_pat (v, *pat); +if ( !iommu_enabled || iommu_snoop ) +vmx_disable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );hvm_asid_flush_vcpu (v);/* no need to flush cache */ } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
BTW, today is my last wroking day at Intel, so this is my last email from Intel's email box.
I will still in Xen community, but for this thread please cc my personal email '[email protected]' -- until I use new email box from Ali Cloud of Alibaba.
Thanks,
Jinsong
Quoted 27 lines · Jan Beulich
The XSA-60 fixes introduced a window during which the guest PAT gets forced to all zeros. This shouldn't be visible to the guest. Therefore we need to intercept PAT MSR accesses during that time period.
Signed-off-by Jan Beulich <[email protected]>xen/arch/x86/hvm/vmx/vmx.c +2
-0@@ -1033,6 +1033,8 @@ static void vmx_handle_cd(struct vcpu *vvmx_get_guest_pat (v, pat);vmx_set_guest_pat (v, uc_pat); +vmx_enable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );wbinvd ();/* flush possibly polluted cache */ hvm_asid_flush_vcpu (v);/* invalidate memory type cached in TLB */ @@ -1042,6 +1044,9 @@ static void
vmx_handle_cd(struct vcpu *v { v->arch.hvm_vcpu.cache_mode = NORMAL_CACHE_MODE; vmx_set_guest_pat(v, *pat);xen/arch/x86/hvm/vmx/vmx.c +3
-0+if ( !iommu_enabled || iommu_snoop ) +vmx_disable_intercept_for_msr (v,MSR_IA32_CR_PAT , +MSR_TYPE_R |MSR_TYPE_W );hvm_asid_flush_vcpu (v);/* no need to flush cache */ } }
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 28.03.14 at 14:26, <[email protected]> wrote:
BTW, today is my last wroking day at Intel, so this is my last email from Intel's email box.
I will still in Xen community, but for this thread please cc my personal email '[email protected]' -- until I use new email box from Ali Cloud of Alibaba.
Please don't forget to submit an update to ./MAINTAINERS.
All the best for your new job!
Jan