Skip to content

Commit ee85dec

Browse files
Luwei Kangbonzini
authored andcommitted
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: Luwei Kang <luwei.kang@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent b08c289 commit ee85dec

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,6 +4167,12 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu)
41674167

41684168
vmx->nested.vmcs02_initialized = false;
41694169
vmx->nested.vmxon = true;
4170+
4171+
if (pt_mode == PT_MODE_HOST_GUEST) {
4172+
vmx->pt_desc.guest.ctl = 0;
4173+
pt_update_intercept_for_msr(vmx);
4174+
}
4175+
41704176
return 0;
41714177

41724178
out_shadow_vmcs:

arch/x86/kvm/vmx/vmx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
19261926
break;
19271927
case MSR_IA32_RTIT_CTL:
19281928
if ((pt_mode != PT_MODE_HOST_GUEST) ||
1929-
vmx_rtit_ctl_check(vcpu, data))
1929+
vmx_rtit_ctl_check(vcpu, data) ||
1930+
vmx->nested.vmxon)
19301931
return 1;
19311932
vmcs_write64(GUEST_IA32_RTIT_CTL, data);
19321933
vmx->pt_desc.guest.ctl = data;

0 commit comments

Comments
 (0)