kernel-hacking-2024-linux-s.../arch
Linus Torvalds 3f749befb0 x86: kvm: fix build error
The cpu_emergency_register_virt_callback() function is used
unconditionally by the x86 kvm code, but it is declared (and defined)
conditionally:

  #if IS_ENABLED(CONFIG_KVM_INTEL) || IS_ENABLED(CONFIG_KVM_AMD)
  void cpu_emergency_register_virt_callback(cpu_emergency_virt_cb *callback);
  ...

leading to a build error when neither KVM_INTEL nor KVM_AMD support is
enabled:

  arch/x86/kvm/x86.c: In function ‘kvm_arch_enable_virtualization’:
  arch/x86/kvm/x86.c:12517:9: error: implicit declaration of function ‘cpu_emergency_register_virt_callback’ [-Wimplicit-function-declaration]
  12517 |         cpu_emergency_register_virt_callback(kvm_x86_ops.emergency_disable_virtualization_cpu);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/x86/kvm/x86.c: In function ‘kvm_arch_disable_virtualization’:
  arch/x86/kvm/x86.c:12522:9: error: implicit declaration of function ‘cpu_emergency_unregister_virt_callback’ [-Wimplicit-function-declaration]
  12522 |         cpu_emergency_unregister_virt_callback(kvm_x86_ops.emergency_disable_virtualization_cpu);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix the build by defining empty helper functions the same way the old
cpu_emergency_disable_virtualization() function was dealt with for the
same situation.

Maybe we could instead have made the call sites conditional, since the
callers (kvm_arch_{en,dis}able_virtualization()) have an empty weak
fallback.  I'll leave that to the kvm people to argue about, this at
least gets the build going for that particular config.

Fixes: 590b09b1d8 ("KVM: x86: Register "emergency disable" callbacks when virt is enabled")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Kai Huang <kai.huang@intel.com>
Cc: Chao Gao <chao.gao@intel.com>
Cc: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-29 14:47:33 -07:00
..
alpha asm-generic updates for 6.12 2024-09-26 11:54:40 -07:00
arc Kbuild updates for v6.12 2024-09-24 13:02:06 -07:00
arm soc: convert ep93xx to devicetree 2024-09-26 12:00:25 -07:00
arm64 x86: 2024-09-28 09:20:14 -07:00
csky mm: make arch_get_unmapped_area() take vm_flags by default 2024-09-09 16:39:13 -07:00
hexagon hexagon: vdso: Fix build failure 2024-09-23 08:17:50 -07:00
loongarch x86: 2024-09-28 09:20:14 -07:00
m68k m68knommu: updates and fixes for v6.12 2024-09-24 10:48:44 -07:00
microblaze
mips x86: 2024-09-28 09:20:14 -07:00
nios2 mm: remove legacy install_special_mapping() code 2024-09-01 20:26:13 -07:00
openrisc
parisc [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
powerpc powerpc fixes for 6.12 #2 2024-09-25 11:17:25 -07:00
riscv x86: 2024-09-28 09:20:14 -07:00
s390 x86: 2024-09-28 09:20:14 -07:00
sh sh updates for v6.12 2024-09-27 10:10:21 -07:00
sparc This includes the following changes related to sparc for v6.12: 2024-09-25 11:21:06 -07:00
um This pull request contains the following changes for UML: 2024-09-27 12:48:48 -07:00
x86 x86: kvm: fix build error 2024-09-29 14:47:33 -07:00
xtensa ALong with the usual shower of singleton patches, notable patch series in 2024-09-21 07:29:05 -07:00
.gitignore
Kconfig Rust changes for v6.12 2024-09-25 10:25:40 -07:00