aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/lib/cache-smp.c
diff options
context:
space:
mode:
authorKevin Loughlin <[email protected]>2025-05-22 23:37:27 +0000
committerBorislav Petkov (AMD) <[email protected]>2025-07-10 11:23:10 +0000
commit07f99c3fbe6e322bdb222fbfd59f708ced799cc5 (patch)
tree06a45129c12e0a93574763b0ca13c261b38d0923 /arch/x86/lib/cache-smp.c
parentx86/lib: Drop the unused return value from wbinvd_on_all_cpus() (diff)
downloadkernel-07f99c3fbe6e322bdb222fbfd59f708ced799cc5.tar.gz
kernel-07f99c3fbe6e322bdb222fbfd59f708ced799cc5.zip
x86/lib: Add WBNOINVD helper functions
In line with WBINVD usage, add WBNOINVD helper functions. Explicitly fall back to WBINVD (via alternative()) if WBNOINVD isn't supported even though the instruction itself is backwards compatible (WBNOINVD is WBINVD with an ignored REP prefix), so that disabling X86_FEATURE_WBNOINVD behaves as one would expect, e.g. in case there's a hardware issue that affects WBNOINVD. Opportunistically, add comments explaining the architectural behavior of WBINVD and WBNOINVD, and provide hints and pointers to uarch-specific behavior. Note, alternative() ensures compatibility with early boot code as needed. [ bp: Massage, fix typos, make export _GPL. ] Signed-off-by: Kevin Loughlin <[email protected]> Co-developed-by: Sean Christopherson <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Reviewed-by: Kai Huang <[email protected]> Acked-by: Ingo Molnar <[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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index 079c3f3cd32c..74e0d5ba867d 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -19,3 +19,14 @@ void wbinvd_on_all_cpus(void)
on_each_cpu(__wbinvd, NULL, 1);
}
EXPORT_SYMBOL(wbinvd_on_all_cpus);
+
+static void __wbnoinvd(void *dummy)
+{
+ wbnoinvd();
+}
+
+void wbnoinvd_on_all_cpus(void)
+{
+ on_each_cpu(__wbnoinvd, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(wbnoinvd_on_all_cpus);