[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1593703107-8852-3-git-send-email-mihai.carabas@oracle.com>
Date: Thu, 2 Jul 2020 18:18:22 +0300
From: Mihai Carabas <mihai.carabas@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
Mihai Carabas <mihai.carabas@...cle.com>
Subject: [PATCH RFC 2/7] x86: cpu: modify boot_command_line to saved_command_line
as boot_command_line has the __initdata attribute and cannot be
used after booting the kernel. command_line evaluation needs to
be used on microcode late loading in order to enforce the proper
mitigations for different CPU bugs.
Signed-off-by: Mihai Carabas <mihai.carabas@...cle.com>
---
arch/x86/kernel/cpu/bugs.c | 11 ++++++-----
arch/x86/kernel/cpu/tsx.c | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 7091947..1760598 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -684,7 +684,7 @@ static void spec_v2_user_print_cond(const char *reason, bool secure)
break;
}
- ret = cmdline_find_option(boot_command_line, "spectre_v2_user",
+ ret = cmdline_find_option(saved_command_line, "spectre_v2_user",
arg, sizeof(arg));
if (ret < 0)
return SPECTRE_V2_USER_CMD_AUTO;
@@ -822,11 +822,12 @@ static enum spectre_v2_mitigation_cmd spectre_v2_parse_cmdline(void)
char arg[20];
int ret, i;
- if (cmdline_find_option_bool(boot_command_line, "nospectre_v2") ||
+ if (cmdline_find_option_bool(saved_command_line, "nospectre_v2") ||
cpu_mitigations_off())
return SPECTRE_V2_CMD_NONE;
- ret = cmdline_find_option(boot_command_line, "spectre_v2", arg, sizeof(arg));
+ ret = cmdline_find_option(saved_command_line, "spectre_v2", arg,
+ sizeof(arg));
if (ret < 0)
return SPECTRE_V2_CMD_AUTO;
@@ -1096,11 +1097,11 @@ static enum ssb_mitigation_cmd ssb_parse_cmdline(void)
char arg[20];
int ret, i;
- if (cmdline_find_option_bool(boot_command_line, "nospec_store_bypass_disable") ||
+ if (cmdline_find_option_bool(saved_command_line, "nospec_store_bypass_disable") ||
cpu_mitigations_off()) {
return SPEC_STORE_BYPASS_CMD_NONE;
} else {
- ret = cmdline_find_option(boot_command_line, "spec_store_bypass_disable",
+ ret = cmdline_find_option(saved_command_line, "spec_store_bypass_disable",
arg, sizeof(arg));
if (ret < 0)
return SPEC_STORE_BYPASS_CMD_AUTO;
diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c
index 7c46581..436fa93 100644
--- a/arch/x86/kernel/cpu/tsx.c
+++ b/arch/x86/kernel/cpu/tsx.c
@@ -92,7 +92,7 @@ void tsx_init(void)
if (!tsx_ctrl_is_supported())
return;
- ret = cmdline_find_option(boot_command_line, "tsx", arg, sizeof(arg));
+ ret = cmdline_find_option(saved_command_line, "tsx", arg, sizeof(arg));
if (ret >= 0) {
if (!strcmp(arg, "on")) {
tsx_ctrl_state = TSX_CTRL_ENABLE;
--
1.8.3.1
Powered by blists - more mailing lists