Skip to content

Commit 71f7347

Browse files
ouptonbonzini
authored andcommitted
KVM: nVMX: Load GUEST_IA32_PERF_GLOBAL_CTRL MSR on VM-Entry
Add condition to prepare_vmcs02 which loads IA32_PERF_GLOBAL_CTRL on VM-entry if the "load IA32_PERF_GLOBAL_CTRL" bit on the VM-entry control is set. Use SET_MSR_OR_WARN() rather than directly writing to the field to avoid overwrite by atomic_switch_perf_msrs(). Suggested-by: Jim Mattson <[email protected]> Co-developed-by: Krish Sadhukhan <[email protected]> Signed-off-by: Krish Sadhukhan <[email protected]> Signed-off-by: Oliver Upton <[email protected]> Reviewed-by: Jim Mattson <[email protected]> Reviewed-by: Peter Shier <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 458151f commit 71f7347

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2452,6 +2452,11 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
24522452
if (!enable_ept)
24532453
vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested;
24542454

2455+
if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) &&
2456+
SET_MSR_OR_WARN(vcpu, MSR_CORE_PERF_GLOBAL_CTRL,
2457+
vmcs12->guest_ia32_perf_global_ctrl))
2458+
return -EINVAL;
2459+
24552460
kvm_rsp_write(vcpu, vmcs12->guest_rsp);
24562461
kvm_rip_write(vcpu, vmcs12->guest_rip);
24572462
return 0;

0 commit comments

Comments
 (0)