Commit 26304e0e authored by Sean Christopherson's avatar Sean Christopherson
Browse files

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: default avatarXiaoyao Li <xiaoyao.li@intel.com>
Link: https://patch.msgid.link/20260115173427.716021-2-seanjc@google.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 6c8512a5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7407,6 +7407,8 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *))
{
	int i;

	nested_vmx_setup_ctls_msrs(&vmcs_config, vmx_capability.ept);

	if (!cpu_has_vmx_shadow_vmcs())
		enable_shadow_vmcs = 0;
	if (enable_shadow_vmcs) {
+0 −2
Original line number Diff line number Diff line
@@ -8700,8 +8700,6 @@ __init int vmx_hardware_setup(void)
	 * can hide/show features based on kvm_cpu_cap_has().
	 */
	if (nested) {
		nested_vmx_setup_ctls_msrs(&vmcs_config, vmx_capability.ept);

		r = nested_vmx_hardware_setup(kvm_vmx_exit_handlers);
		if (r)
			return r;