public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Binbin Wu <binbin.wu@linux.intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rick Edgecombe <rick.p.edgecombe@intel.com>
Subject: Re: [PATCH 2/4] KVM: VMX: Move x86_ops wrappers under CONFIG_KVM_INTEL_TDX
Date: Fri, 14 Mar 2025 10:42:41 +0800	[thread overview]
Message-ID: <d4c19589-baa4-47a8-8d3d-bff10ba6aa64@linux.intel.com> (raw)
In-Reply-To: <20250313-vverma7-cleanup_x86_ops-v1-2-0346c8211a0c@intel.com>



On 3/14/2025 3:30 AM, Vishal Verma wrote:
> Rather than have a lot of stubs for x86_ops helpers, simply omit the
> wrappers when CONFIG_KVM_INTEL_TDX=n.  This allows nearly all of
> vmx/main.c to go under a single #ifdef.  That eliminates all the
> trampolines in the generated code, and almost all of the stubs.

In this patch, these vt_xxx() functions still are common code.
Move these functions inside CONFIG_KVM_INTEL_TDX will break the build for
kvm-intel when CONFIG_KVM_INTEL_TDX=n.

Maybe just squash this patch into 4/4?

>
> Based on a patch by Sean Christopherson <seanjc@google.com>
>
> Link: https://lore.kernel.org/kvm/Z6v9yjWLNTU6X90d@google.com/
> Cc: Sean Christopherson <seanjc@google.com>
> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>   arch/x86/kvm/vmx/tdx.h     | 2 +-
>   arch/x86/kvm/vmx/x86_ops.h | 2 +-
>   arch/x86/kvm/vmx/main.c    | 4 ++--
>   3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/tdx.h b/arch/x86/kvm/vmx/tdx.h
> index 8f8070d0f55e..b43d7a7c8f1c 100644
> --- a/arch/x86/kvm/vmx/tdx.h
> +++ b/arch/x86/kvm/vmx/tdx.h
> @@ -5,7 +5,7 @@
>   #include "tdx_arch.h"
>   #include "tdx_errno.h"
>   
> -#ifdef CONFIG_INTEL_TDX_HOST
> +#ifdef CONFIG_KVM_INTEL_TDX
>   #include "common.h"
>   
>   int tdx_bringup(void);
> diff --git a/arch/x86/kvm/vmx/x86_ops.h b/arch/x86/kvm/vmx/x86_ops.h
> index 19f770b0fc81..4704bed033b1 100644
> --- a/arch/x86/kvm/vmx/x86_ops.h
> +++ b/arch/x86/kvm/vmx/x86_ops.h
> @@ -121,7 +121,7 @@ void vmx_cancel_hv_timer(struct kvm_vcpu *vcpu);
>   #endif
>   void vmx_setup_mce(struct kvm_vcpu *vcpu);
>   
> -#ifdef CONFIG_INTEL_TDX_HOST
> +#ifdef CONFIG_KVM_INTEL_TDX
>   void tdx_disable_virtualization_cpu(void);
>   int tdx_vm_init(struct kvm *kvm);
>   void tdx_mmu_release_hkid(struct kvm *kvm);
> diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
> index 9d201ddb794a..ccb81a8b73f7 100644
> --- a/arch/x86/kvm/vmx/main.c
> +++ b/arch/x86/kvm/vmx/main.c
> @@ -10,9 +10,8 @@
>   #include "tdx.h"
>   #include "tdx_arch.h"
>   
> -#ifdef CONFIG_INTEL_TDX_HOST
> +#ifdef CONFIG_KVM_INTEL_TDX
>   static_assert(offsetof(struct vcpu_vmx, vt) == offsetof(struct vcpu_tdx, vt));
> -#endif
>   
>   static void vt_disable_virtualization_cpu(void)
>   {
> @@ -879,6 +878,7 @@ static int vt_gmem_private_max_mapping_level(struct kvm *kvm, kvm_pfn_t pfn)
>   
>   	return 0;
>   }
> +#endif
>   
>   #define VMX_REQUIRED_APICV_INHIBITS				\
>   	(BIT(APICV_INHIBIT_REASON_DISABLED) |			\
>


  reply	other threads:[~2025-03-14  2:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 19:30 [PATCH 0/4] KVM: TDX: Cleanup the kvm_x86_ops structure for vmx/tdx Vishal Verma
2025-03-13 19:30 ` [PATCH 1/4] KVM: TDX: Move apicv_pre_state_restore to posted_intr.c Vishal Verma
2025-03-14  2:36   ` Binbin Wu
2025-03-13 19:30 ` [PATCH 2/4] KVM: VMX: Move x86_ops wrappers under CONFIG_KVM_INTEL_TDX Vishal Verma
2025-03-14  2:42   ` Binbin Wu [this message]
2025-03-14 15:47     ` Verma, Vishal L
2025-03-13 19:30 ` [PATCH 3/4] KVM: VMX: Make naming consistent for kvm_complete_insn_gp via define Vishal Verma
2025-03-13 19:30 ` [PATCH 4/4] KVM: VMX: Clean up and macrofy x86_ops Vishal Verma

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=d4c19589-baa4-47a8-8d3d-bff10ba6aa64@linux.intel.com \
    --to=binbin.wu@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=vishal.l.verma@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox