Skip to content

Commit c86abc5

Browse files
committed
x86/mce/amd: Add default names for MCA banks and blocks
JIRA: https://issues.redhat.com/browse/RHEL-118444 commit d66e1e9 Author: Yazen Ghannam <yazen.ghannam@amd.com> Date: Tue Jun 24 14:15:58 2025 +0000 x86/mce/amd: Add default names for MCA banks and blocks Ensure that sysfs init doesn't fail for new/unrecognized bank types or if a bank has additional blocks available. Most MCA banks have a single thresholding block, so the block takes the same name as the bank. Unified Memory Controllers (UMCs) are a special case where there are two blocks and each has a unique name. However, the microarchitecture allows for five blocks. Any new MCA bank types with more than one block will be missing names for the extra blocks. The MCE sysfs will fail to initialize in this case. Fixes: 87a6d40 ("x86/mce/AMD: Update sysfs bank names for SMCA systems") Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/20250624-wip-mca-updates-v4-3-236dd74f645f@amd.com Signed-off-by: David Arcari <darcari@redhat.com>
1 parent f0248f1 commit c86abc5

File tree

1 file changed

+10
-3
lines changed
  • arch/x86/kernel/cpu/mce

1 file changed

+10
-3
lines changed

arch/x86/kernel/cpu/mce/amd.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,13 +1113,20 @@ static const char *get_name(unsigned int cpu, unsigned int bank, struct threshol
11131113
}
11141114

11151115
bank_type = smca_get_bank_type(cpu, bank);
1116-
if (bank_type >= N_SMCA_BANK_TYPES)
1117-
return NULL;
11181116

11191117
if (b && (bank_type == SMCA_UMC || bank_type == SMCA_UMC_V2)) {
11201118
if (b->block < ARRAY_SIZE(smca_umc_block_names))
11211119
return smca_umc_block_names[b->block];
1122-
return NULL;
1120+
}
1121+
1122+
if (b && b->block) {
1123+
snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN, "th_block_%u", b->block);
1124+
return buf_mcatype;
1125+
}
1126+
1127+
if (bank_type >= N_SMCA_BANK_TYPES) {
1128+
snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN, "th_bank_%u", bank);
1129+
return buf_mcatype;
11231130
}
11241131

11251132
if (per_cpu(smca_bank_counts, cpu)[bank_type] == 1)

0 commit comments

Comments
 (0)