All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chao Gao <chao.gao@intel.com>, Xin Li <xin@zytor.com>,
	Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: Re: [PATCH v3 1/4] KVM: nVMX: Setup VMX MSRs on loading CPU during nested_vmx_hardware_setup()
Date: Fri, 9 Jan 2026 19:24:33 +0800	[thread overview]
Message-ID: <dd83c23b-80f9-42e6-a1f8-fb2f45384dbf@intel.com> (raw)
In-Reply-To: <20260109041523.1027323-2-seanjc@google.com>

On 1/9/2026 12:15 PM, Sean Christopherson wrote:
> 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.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   arch/x86/kvm/vmx/nested.c | 2 ++
>   arch/x86/kvm/vmx/vmx.c    | 2 --
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 6137e5307d0f..61113ead3d7b 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -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) {
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 6b96f7aea20b..5bb67566e43a 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -8670,8 +8670,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;


  reply	other threads:[~2026-01-09 11:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  4:15 [PATCH v3 0/4] KVM: nVMX: Disallow access to vmcs12 fields that aren't supported by "hardware" Sean Christopherson
2026-01-09  4:15 ` [PATCH v3 1/4] KVM: nVMX: Setup VMX MSRs on loading CPU during nested_vmx_hardware_setup() Sean Christopherson
2026-01-09 11:24   ` Xiaoyao Li [this message]
2026-01-09  4:15 ` [PATCH v3 2/4] KVM: VMX: Add a wrapper around ROL16() to get a vmcs12 from a field encoding Sean Christopherson
2026-01-09 11:34   ` Xiaoyao Li
2026-01-09  4:15 ` [PATCH v3 3/4] KVM: nVMX: Disallow access to vmcs12 fields that aren't supported by "hardware" Sean Christopherson
2026-01-09 14:08   ` Xiaoyao Li
2026-01-09 14:44     ` Sean Christopherson
2026-01-09 15:17       ` Sean Christopherson
2026-01-09  4:15 ` [PATCH v3 4/4] KVM: nVMX: Remove explicit filtering of GUEST_INTR_STATUS from shadow VMCS fields Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd83c23b-80f9-42e6-a1f8-fb2f45384dbf@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=chao.gao@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=xin@zytor.com \
    --cc=yosry.ahmed@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.