Commit ee85dec2 authored by Luwei Kang's avatar Luwei Kang Committed by Paolo Bonzini

KVM: x86: Disable Intel PT when VMXON in L1 guest

Currently, Intel Processor Trace do not support tracing in L1 guest
VMX operation(IA32_VMX_MISC[bit 14] is 0). As mentioned in SDM,
on these type of processors, execution of the VMXON instruction will
clears IA32_RTIT_CTL.TraceEn and any attempt to write IA32_RTIT_CTL
causes a general-protection exception (#GP).
Signed-off-by: default avatarLuwei Kang <luwei.kang@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b08c2896
...@@ -4167,6 +4167,12 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu) ...@@ -4167,6 +4167,12 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu)
vmx->nested.vmcs02_initialized = false; vmx->nested.vmcs02_initialized = false;
vmx->nested.vmxon = true; vmx->nested.vmxon = true;
if (pt_mode == PT_MODE_HOST_GUEST) {
vmx->pt_desc.guest.ctl = 0;
pt_update_intercept_for_msr(vmx);
}
return 0; return 0;
out_shadow_vmcs: out_shadow_vmcs:
......
...@@ -1926,7 +1926,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -1926,7 +1926,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
break; break;
case MSR_IA32_RTIT_CTL: case MSR_IA32_RTIT_CTL:
if ((pt_mode != PT_MODE_HOST_GUEST) || if ((pt_mode != PT_MODE_HOST_GUEST) ||
vmx_rtit_ctl_check(vcpu, data)) vmx_rtit_ctl_check(vcpu, data) ||
vmx->nested.vmxon)
return 1; return 1;
vmcs_write64(GUEST_IA32_RTIT_CTL, data); vmcs_write64(GUEST_IA32_RTIT_CTL, data);
vmx->pt_desc.guest.ctl = data; vmx->pt_desc.guest.ctl = data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment