[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4c19589-baa4-47a8-8d3d-bff10ba6aa64@linux.intel.com>
Date: Fri, 14 Mar 2025 10:42:41 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Vishal Verma <vishal.l.verma@...el.com>,
Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Rick Edgecombe <rick.p.edgecombe@...el.com>
Subject: Re: [PATCH 2/4] KVM: VMX: Move x86_ops wrappers under
CONFIG_KVM_INTEL_TDX
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@...gle.com>
>
> Link: https://lore.kernel.org/kvm/Z6v9yjWLNTU6X90d@google.com/
> Cc: Sean Christopherson <seanjc@...gle.com>
> Cc: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@...el.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) | \
>
Powered by blists - more mailing lists