mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Extend KVM's export macro framework to provide EXPORT_SYMBOL_FOR_KVM(), and use the helper macro to export symbols for KVM throughout x86 if and only if KVM will build one or more modules, and only for those modules. To avoid unnecessary exports when CONFIG_KVM=m but kvm.ko will not be built (because no vendor modules are selected), let arch code #define EXPORT_SYMBOL_FOR_KVM to suppress/override the exports. Note, the set of symbols to restrict to KVM was generated by manual search and audit; any "misses" are due to human error, not some grand plan. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Kai Huang <kai.huang@intel.com> Tested-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20251112173944.1380633-5-seanjc%40google.com
46 lines
872 B
C
46 lines
872 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <asm/paravirt.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/export.h>
|
|
#include <linux/kvm_types.h>
|
|
|
|
static void __wbinvd(void *dummy)
|
|
{
|
|
wbinvd();
|
|
}
|
|
|
|
void wbinvd_on_cpu(int cpu)
|
|
{
|
|
smp_call_function_single(cpu, __wbinvd, NULL, 1);
|
|
}
|
|
EXPORT_SYMBOL_FOR_KVM(wbinvd_on_cpu);
|
|
|
|
void wbinvd_on_all_cpus(void)
|
|
{
|
|
on_each_cpu(__wbinvd, NULL, 1);
|
|
}
|
|
EXPORT_SYMBOL(wbinvd_on_all_cpus);
|
|
|
|
void wbinvd_on_cpus_mask(struct cpumask *cpus)
|
|
{
|
|
on_each_cpu_mask(cpus, __wbinvd, NULL, 1);
|
|
}
|
|
EXPORT_SYMBOL_FOR_KVM(wbinvd_on_cpus_mask);
|
|
|
|
static void __wbnoinvd(void *dummy)
|
|
{
|
|
wbnoinvd();
|
|
}
|
|
|
|
void wbnoinvd_on_all_cpus(void)
|
|
{
|
|
on_each_cpu(__wbnoinvd, NULL, 1);
|
|
}
|
|
EXPORT_SYMBOL_FOR_KVM(wbnoinvd_on_all_cpus);
|
|
|
|
void wbnoinvd_on_cpus_mask(struct cpumask *cpus)
|
|
{
|
|
on_each_cpu_mask(cpus, __wbnoinvd, NULL, 1);
|
|
}
|
|
EXPORT_SYMBOL_FOR_KVM(wbnoinvd_on_cpus_mask);
|