2024-04-04 15:15:09

by Yazen Ghannam

[permalink] [raw]
Subject: [PATCH v2 03/16] x86/mce/amd: Use fixed bank number for quirks

Quirks break micro-architectural definitions. Therefore, quirk
conditions don't need to follow micro-architectural requirements.

Currently, there is a quirk to filter some errors from the
Instruction Fetch (IF) unit on specific models. The IF unit is
represented by MCA bank 1 for these models. Related to this quirk is
code to disable MCA Thresholding for the IF bank.

Check the bank number for the quirks instead of determining the bank
type.

Signed-off-by: Yazen Ghannam <[email protected]>
---

Notes:
Link:
https://lkml.kernel.org/r/[email protected]

v1->v2:
* No change.

arch/x86/kernel/cpu/mce/amd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
index 9a0133ef7e20..bc78e751dfcc 100644
--- a/arch/x86/kernel/cpu/mce/amd.c
+++ b/arch/x86/kernel/cpu/mce/amd.c
@@ -605,13 +605,12 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,

bool amd_filter_mce(struct mce *m)
{
- enum smca_bank_types bank_type = smca_get_bank_type(m->extcpu, m->bank);
struct cpuinfo_x86 *c = &boot_cpu_data;

/* See Family 17h Models 10h-2Fh Erratum #1114. */
if (c->x86 == 0x17 &&
c->x86_model >= 0x10 && c->x86_model <= 0x2F &&
- bank_type == SMCA_IF && XEC(m->status, 0x3f) == 10)
+ m->bank == 1 && XEC(m->status, 0x3f) == 10)
return true;

/* NB GART TLB error reporting is disabled by default. */
@@ -643,7 +642,7 @@ static void disable_err_thresholding(struct cpuinfo_x86 *c, unsigned int bank)
} else if (c->x86 == 0x17 &&
(c->x86_model >= 0x10 && c->x86_model <= 0x2F)) {

- if (smca_get_bank_type(smp_processor_id(), bank) != SMCA_IF)
+ if (bank != 1)
return;

msrs[0] = MSR_AMD64_SMCA_MCx_MISC(bank);
--
2.34.1