From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (193.142.43.55:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 01 Nov 2019 15:43:42 -0000 Received: from youngberry.canonical.com ([91.189.89.112]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1iQZ5R-0002I3-0l for speck@linutronix.de; Fri, 01 Nov 2019 16:43:41 +0100 Received: from 2.general.tyhicks.us.vpn ([10.172.64.53] helo=sec) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iQZ5J-0003Xr-6z for speck@linutronix.de; Fri, 01 Nov 2019 15:43:33 +0000 Date: Fri, 1 Nov 2019 15:43:31 +0000 From: Tyler Hicks Subject: [MODERATED] [PATCH] NX build fixup Message-ID: <20191101154157.GA24333@sec> References: <20191101145835.GA9011@elm> MIME-Version: 1.0 In-Reply-To: <20191101145835.GA9011@elm> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: From: Tyler Hicks 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 --- 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