]> www.infradead.org Git - users/hch/misc.git/commit
KVM: VMX: Clean up and macrofy x86_ops
authorVishal Verma <vishal.l.verma@intel.com>
Tue, 18 Mar 2025 06:35:09 +0000 (00:35 -0600)
committerSean Christopherson <seanjc@google.com>
Fri, 2 May 2025 20:37:26 +0000 (13:37 -0700)
commit907092bf7cbddee4381729f23a33780d84b1bb7c
tree0999427b4ec847340c23cade88966176c6458d94
parent1a81d9d5a1da862ccc49cedec1df603aafa7c600
KVM: VMX: Clean up and macrofy x86_ops

Eliminate a lot of stub definitions by using macros to define the TDX vs
non-TDX versions of various x86_ops. Moving the x86_ops wrappers under
CONFIG_KVM_INTEL_TDX also allows nearly all of vmx/main.c to go under a
single #ifdef, eliminating trampolines in the generated code, and almost
all of the stubs.

For example, with CONFIG_KVM_INTEL_TDX=n, before this cleanup,
vt_refresh_apicv_exec_ctrl() would produce:

0000000000036490 <vt_refresh_apicv_exec_ctrl>:
   36490:       f3 0f 1e fa             endbr64
   36494:       e8 00 00 00 00          call   36499 <vt_refresh_apicv_exec_ctrl+0x9>
                        36495: R_X86_64_PLT32   __fentry__-0x4
   36499:       e9 00 00 00 00          jmp    3649e <vt_refresh_apicv_exec_ctrl+0xe>
                        3649a: R_X86_64_PLT32   vmx_refresh_apicv_exec_ctrl-0x4
   3649e:       66 90                   xchg   %ax,%ax

After this patch, this is completely eliminated.

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>
Link: https://lore.kernel.org/r/20250318-vverma7-cleanup_x86_ops-v2-4-701e82d6b779@intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/main.c
arch/x86/kvm/vmx/x86_ops.h