[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250313-vverma7-cleanup_x86_ops-v1-2-0346c8211a0c@intel.com>
Date: Thu, 13 Mar 2025 13:30:02 -0600
From: Vishal Verma <vishal.l.verma@...el.com>
To: 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>,
Vishal Verma <vishal.l.verma@...el.com>
Subject: [PATCH 2/4] KVM: VMX: Move x86_ops wrappers under
CONFIG_KVM_INTEL_TDX
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.
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) | \
--
2.48.1
Powered by blists - more mailing lists