Skip to content

Commit bfc6ad6

Browse files
ouptonbonzini
authored andcommitted
KVM: nVMX: Check GUEST_IA32_PERF_GLOBAL_CTRL on VM-Entry
Add condition to nested_vmx_check_guest_state() to check the validity of GUEST_IA32_PERF_GLOBAL_CTRL. Per Intel's SDM Vol 3 26.3.1.1: If the "load IA32_PERF_GLOBAL_CTRL" VM-entry control is 1, bits reserved in the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the field for that register. 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 9477f44 commit bfc6ad6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "hyperv.h"
1111
#include "mmu.h"
1212
#include "nested.h"
13+
#include "pmu.h"
1314
#include "trace.h"
1415
#include "x86.h"
1516

@@ -2790,6 +2791,11 @@ static int nested_vmx_check_guest_state(struct kvm_vcpu *vcpu,
27902791
return -EINVAL;
27912792
}
27922793

2794+
if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) &&
2795+
CC(!kvm_valid_perf_global_ctrl(vcpu_to_pmu(vcpu),
2796+
vmcs12->guest_ia32_perf_global_ctrl)))
2797+
return -EINVAL;
2798+
27932799
/*
27942800
* If the load IA32_EFER VM-entry control is 1, the following checks
27952801
* are performed on the field for the IA32_EFER MSR:

0 commit comments

Comments
 (0)