[MODERATED] [PATCH] NX build fixup
Tyler Hicks <[email protected]> Fri, 1 Nov 2019 15:43:31 +0000
| Newsgroups | org.kernel.lore.historical-speck |
|---|---|
| Message-ID | <20191101154157.GA24333@sec> |
From: Tyler Hicks <[email protected]> Subject: [PATCH] cpu/speculation: Uninline and export CPU mitigations helpers A kernel module may need to check the value of the "mitigations=" kernel command line parameter as part of its setup when the module needs to perform software mitigations for a CPU flaw. Uninline and export the helper functions surrounding the cpu_mitigations enum to allow for their usage from a module. Signed-off-by: Tyler Hicks <[email protected]> --- Only compile tested, with both CONFIG_KVM=y and CONFIG_KVM=m. Paolo, if this looks good to you and Pawan, please include it in NX v9. include/linux/cpu.h | 13 ++----------- kernel/cpu.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 2a093434e975..f1965255526a 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -230,16 +230,7 @@ enum cpu_mitigations { extern enum cpu_mitigations cpu_mitigations; -/* mitigations=off */ -static inline bool cpu_mitigations_off(void) -{ - return cpu_mitigations == CPU_MITIGATIONS_OFF; -} - -/* mitigations=auto,nosmt */ -static inline bool cpu_mitigations_auto_nosmt(void) -{ - return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; -} +extern bool cpu_mitigations_off(void); +extern bool cpu_mitigations_auto_nosmt(void); #endif /* _LINUX_CPU_H_ */ diff --git a/kernel/cpu.c b/kernel/cpu.c index fc28e17940e0..bb9f3e636363 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2390,3 +2390,17 @@ static int __init mitigations_parse_cmdline(char *arg) return 0; } early_param("mitigations", mitigations_parse_cmdline); + +/* mitigations=off */ +bool cpu_mitigations_off(void) +{ + return cpu_mitigations == CPU_MITIGATIONS_OFF; +} +EXPORT_SYMBOL_GPL(cpu_mitigations_off); + +/* mitigations=auto,nosmt */ +bool cpu_mitigations_auto_nosmt(void) +{ + return cpu_mitigations == CPU_MITIGATIONS_AUTO_NOSMT; +} +EXPORT_SYMBOL_GPL(cpu_mitigations_auto_nosmt); -- 2.17.1