Skip to content

Commit 26304e0

Browse files
committed
KVM: nVMX: Setup VMX MSRs on loading CPU during nested_vmx_hardware_setup()
Move the call to nested_vmx_setup_ctls_msrs() from vmx_hardware_setup() to nested_vmx_hardware_setup() so that the nested code can deal with ordering dependencies without having to straddle vmx_hardware_setup() and nested_vmx_hardware_setup(). Specifically, an upcoming change will sanitize the vmcs12 fields based on hardware support, and that code needs to run _before_ the MSRs are configured, because the lovely vmcs_enum MSR depends on the max support vmcs12 field. No functional change intended. Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Link: https://patch.msgid.link/20260115173427.716021-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 6c8512a commit 26304e0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

arch/x86/kvm/vmx/nested.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7407,6 +7407,8 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *))
74077407
{
74087408
int i;
74097409

7410+
nested_vmx_setup_ctls_msrs(&vmcs_config, vmx_capability.ept);
7411+
74107412
if (!cpu_has_vmx_shadow_vmcs())
74117413
enable_shadow_vmcs = 0;
74127414
if (enable_shadow_vmcs) {

arch/x86/kvm/vmx/vmx.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8700,8 +8700,6 @@ __init int vmx_hardware_setup(void)
87008700
* can hide/show features based on kvm_cpu_cap_has().
87018701
*/
87028702
if (nested) {
8703-
nested_vmx_setup_ctls_msrs(&vmcs_config, vmx_capability.ept);
8704-
87058703
r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers);
87068704
if (r)
87078705
return r;

0 commit comments

Comments
 (0)