diff options
| author | Zheyun Shen <[email protected]> | 2025-05-22 23:37:28 +0000 |
|---|---|---|
| committer | Borislav Petkov (AMD) <[email protected]> | 2025-07-10 11:30:17 +0000 |
| commit | 4fdc3431e03b9c11803f399f91837fca487029a1 (patch) | |
| tree | 2ba967143c85a0e076f974a5945c11c9fc07806e /arch/x86/lib/cache-smp.c | |
| parent | x86/lib: Add WBNOINVD helper functions (diff) | |
| download | kernel-4fdc3431e03b9c11803f399f91837fca487029a1.tar.gz kernel-4fdc3431e03b9c11803f399f91837fca487029a1.zip | |
x86/lib: Add WBINVD and WBNOINVD helpers to target multiple CPUs
Extract KVM's open-coded calls to do writeback caches on multiple CPUs to
common library helpers for both WBINVD and WBNOINVD (KVM will use both).
Put the onus on the caller to check for a non-empty mask to simplify the
SMP=n implementation, e.g. so that it doesn't need to check that the one
and only CPU in the system is present in the mask.
[sean: move to lib, add SMP=n helpers, clarify usage]
Signed-off-by: Zheyun Shen <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Reviewed-by: Tom Lendacky <[email protected]>
Acked-by: Kai Huang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Link: https://lore.kernel.org/[email protected]
Diffstat (limited to 'arch/x86/lib/cache-smp.c')
| -rw-r--r-- | arch/x86/lib/cache-smp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c index 74e0d5ba867d..c5c60d07308c 100644 --- a/arch/x86/lib/cache-smp.c +++ b/arch/x86/lib/cache-smp.c @@ -20,6 +20,12 @@ void wbinvd_on_all_cpus(void) } EXPORT_SYMBOL(wbinvd_on_all_cpus); +void wbinvd_on_cpus_mask(struct cpumask *cpus) +{ + on_each_cpu_mask(cpus, __wbinvd, NULL, 1); +} +EXPORT_SYMBOL_GPL(wbinvd_on_cpus_mask); + static void __wbnoinvd(void *dummy) { wbnoinvd(); @@ -30,3 +36,9 @@ void wbnoinvd_on_all_cpus(void) on_each_cpu(__wbnoinvd, NULL, 1); } EXPORT_SYMBOL_GPL(wbnoinvd_on_all_cpus); + +void wbnoinvd_on_cpus_mask(struct cpumask *cpus) +{ + on_each_cpu_mask(cpus, __wbnoinvd, NULL, 1); +} +EXPORT_SYMBOL_GPL(wbnoinvd_on_cpus_mask); |
