Skip to content

Commit 2c93762

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Relocate mds/taa/mmio/rfds defines
Move the mds, taa, mmio, and rfds mitigation enums earlier in the file to prepare for restructuring of these mitigations as they are all inter-related. No functional change. Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20250108202515.385902-3-david.kaplan@amd.com
1 parent 98c7a71 commit 2c93762

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,37 @@ static const char * const mds_strings[] = {
247247
[MDS_MITIGATION_VMWERV] = "Vulnerable: Clear CPU buffers attempted, no microcode",
248248
};
249249

250+
enum taa_mitigations {
251+
TAA_MITIGATION_OFF,
252+
TAA_MITIGATION_UCODE_NEEDED,
253+
TAA_MITIGATION_VERW,
254+
TAA_MITIGATION_TSX_DISABLED,
255+
};
256+
257+
/* Default mitigation for TAA-affected CPUs */
258+
static enum taa_mitigations taa_mitigation __ro_after_init =
259+
IS_ENABLED(CONFIG_MITIGATION_TAA) ? TAA_MITIGATION_VERW : TAA_MITIGATION_OFF;
260+
261+
enum mmio_mitigations {
262+
MMIO_MITIGATION_OFF,
263+
MMIO_MITIGATION_UCODE_NEEDED,
264+
MMIO_MITIGATION_VERW,
265+
};
266+
267+
/* Default mitigation for Processor MMIO Stale Data vulnerabilities */
268+
static enum mmio_mitigations mmio_mitigation __ro_after_init =
269+
IS_ENABLED(CONFIG_MITIGATION_MMIO_STALE_DATA) ? MMIO_MITIGATION_VERW : MMIO_MITIGATION_OFF;
270+
271+
enum rfds_mitigations {
272+
RFDS_MITIGATION_OFF,
273+
RFDS_MITIGATION_VERW,
274+
RFDS_MITIGATION_UCODE_NEEDED,
275+
};
276+
277+
/* Default mitigation for Register File Data Sampling */
278+
static enum rfds_mitigations rfds_mitigation __ro_after_init =
279+
IS_ENABLED(CONFIG_MITIGATION_RFDS) ? RFDS_MITIGATION_VERW : RFDS_MITIGATION_OFF;
280+
250281
static void __init mds_select_mitigation(void)
251282
{
252283
if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
@@ -290,16 +321,6 @@ early_param("mds", mds_cmdline);
290321
#undef pr_fmt
291322
#define pr_fmt(fmt) "TAA: " fmt
292323

293-
enum taa_mitigations {
294-
TAA_MITIGATION_OFF,
295-
TAA_MITIGATION_UCODE_NEEDED,
296-
TAA_MITIGATION_VERW,
297-
TAA_MITIGATION_TSX_DISABLED,
298-
};
299-
300-
/* Default mitigation for TAA-affected CPUs */
301-
static enum taa_mitigations taa_mitigation __ro_after_init =
302-
IS_ENABLED(CONFIG_MITIGATION_TAA) ? TAA_MITIGATION_VERW : TAA_MITIGATION_OFF;
303324
static bool taa_nosmt __ro_after_init;
304325

305326
static const char * const taa_strings[] = {
@@ -390,15 +411,6 @@ early_param("tsx_async_abort", tsx_async_abort_parse_cmdline);
390411
#undef pr_fmt
391412
#define pr_fmt(fmt) "MMIO Stale Data: " fmt
392413

393-
enum mmio_mitigations {
394-
MMIO_MITIGATION_OFF,
395-
MMIO_MITIGATION_UCODE_NEEDED,
396-
MMIO_MITIGATION_VERW,
397-
};
398-
399-
/* Default mitigation for Processor MMIO Stale Data vulnerabilities */
400-
static enum mmio_mitigations mmio_mitigation __ro_after_init =
401-
IS_ENABLED(CONFIG_MITIGATION_MMIO_STALE_DATA) ? MMIO_MITIGATION_VERW : MMIO_MITIGATION_OFF;
402414
static bool mmio_nosmt __ro_after_init = false;
403415

404416
static const char * const mmio_strings[] = {
@@ -487,16 +499,6 @@ early_param("mmio_stale_data", mmio_stale_data_parse_cmdline);
487499
#undef pr_fmt
488500
#define pr_fmt(fmt) "Register File Data Sampling: " fmt
489501

490-
enum rfds_mitigations {
491-
RFDS_MITIGATION_OFF,
492-
RFDS_MITIGATION_VERW,
493-
RFDS_MITIGATION_UCODE_NEEDED,
494-
};
495-
496-
/* Default mitigation for Register File Data Sampling */
497-
static enum rfds_mitigations rfds_mitigation __ro_after_init =
498-
IS_ENABLED(CONFIG_MITIGATION_RFDS) ? RFDS_MITIGATION_VERW : RFDS_MITIGATION_OFF;
499-
500502
static const char * const rfds_strings[] = {
501503
[RFDS_MITIGATION_OFF] = "Vulnerable",
502504
[RFDS_MITIGATION_VERW] = "Mitigation: Clear Register File",

0 commit comments

Comments
 (0)