]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/lib: Add WBNOINVD helper functions
authorKevin Loughlin <kevinloughlin@google.com>
Thu, 22 May 2025 23:37:27 +0000 (16:37 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 10 Jul 2025 11:23:10 +0000 (13:23 +0200)
commit07f99c3fbe6e322bdb222fbfd59f708ced799cc5
tree06a45129c12e0a93574763b0ca13c261b38d0923
parente638081751a292560a8aed36ec72e8f65b057892
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 <kevinloughlin@google.com>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/20250522233733.3176144-4-seanjc@google.com
arch/x86/include/asm/smp.h
arch/x86/include/asm/special_insns.h
arch/x86/lib/cache-smp.c