diff options
| author | Borislav Petkov (AMD) <bp@alien8.de> | 2026-06-19 18:50:41 -0700 |
|---|---|---|
| committer | Borislav Petkov (AMD) <bp@alien8.de> | 2026-07-06 21:34:26 -0700 |
| commit | 3eaa50e1e255ec261c757b9eea811ef3bac10d1e (patch) | |
| tree | bf0083c895d6cfce97f943096f426ff600eda42a /arch/um/include | |
| parent | 8cdeaa50eae8dad34885515f62559ee83e7e8dda (diff) | |
| download | linux-next-3eaa50e1e255ec261c757b9eea811ef3bac10d1e.tar.gz linux-next-3eaa50e1e255ec261c757b9eea811ef3bac10d1e.zip | |
x86/cpu: Hide and rename static_cpu_has()
cpu_feature_enabled() is the one to use to test feature flags so hide
the static thing which doesn't pay attention to disabled mask bits
anyway.
Use the following command to do the replacement:
$ git grep --files-with-matches -w static_cpu_has -- ':(exclude)*cpufeature.h' \
| xargs sed -i 's/static_cpu_has(/cpu_feature_enabled\(/g'
There should be no functional changes resulting from this.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Link: https://patch.msgid.link/20260620015041.336288-1-bp@kernel.org
Diffstat (limited to 'arch/um/include')
| -rw-r--r-- | arch/um/include/asm/cpufeature.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/arch/um/include/asm/cpufeature.h b/arch/um/include/asm/cpufeature.h index 4354f6984271..f7770083c0a4 100644 --- a/arch/um/include/asm/cpufeature.h +++ b/arch/um/include/asm/cpufeature.h @@ -49,7 +49,7 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; * is not relevant. */ #define cpu_feature_enabled(bit) \ - (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : static_cpu_has(bit)) + (__builtin_constant_p(bit) && DISABLED_MASK_BIT_SET(bit) ? 0 : _static_cpu_has(bit)) #define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit) @@ -64,15 +64,7 @@ extern void setup_clear_cpu_cap(unsigned int bit); #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) -/* - * Static testing of CPU features. Used the same as boot_cpu_has(). It - * statically patches the target code for additional performance. Use - * static_cpu_has() only in fast paths, where every cycle counts. Which - * means that the boot_cpu_has() variant is already fast enough for the - * majority of cases and you should stick to using it as it is generally - * only two instructions: a RIP-relative MOV and a TEST. - */ -static __always_inline bool _static_cpu_has(u16 bit) +static __always_inline bool __static_cpu_has(u16 bit) { asm goto("1: jmp 6f\n" "2:\n" @@ -116,7 +108,7 @@ t_no: return false; } -#define static_cpu_has(bit) \ +#define _static_cpu_has(bit) \ ( \ __builtin_constant_p(boot_cpu_has(bit)) ? \ boot_cpu_has(bit) : \ @@ -126,7 +118,7 @@ t_no: #define cpu_has_bug(c, bit) cpu_has(c, (bit)) #define set_cpu_bug(c, bit) set_cpu_cap(c, (bit)) -#define static_cpu_has_bug(bit) static_cpu_has((bit)) +#define static_cpu_has_bug(bit) _static_cpu_has((bit)) #define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit)) #define boot_cpu_set_bug(bit) set_cpu_cap(&boot_cpu_data, (bit)) |
