Skip to content

Commit c6e465b

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce: Define BSP-only SMCA init
Currently, on AMD systems, MCA interrupt handler functions are set during CPU init. However, the functions only need to be set once for the whole system. Assign the handlers only during BSP init. Do so only for SMCA systems to maintain the old behavior for legacy systems. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: https://lore.kernel.org/20250908-wip-mca-updates-v6-0-eef5d6c74b9c@amd.com
1 parent 669ce49 commit c6e465b

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,12 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
684684
deferred_error_interrupt_enable(c);
685685
}
686686

687+
void smca_bsp_init(void)
688+
{
689+
mce_threshold_vector = amd_threshold_interrupt;
690+
deferred_error_int_vector = amd_deferred_error_interrupt;
691+
}
692+
687693
/*
688694
* DRAM ECC errors are reported in the Northbridge (bank 4) with
689695
* Extended Error Code 8.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,9 @@ void mca_bsp_init(struct cpuinfo_x86 *c)
22442244
mce_flags.succor = cpu_feature_enabled(X86_FEATURE_SUCCOR);
22452245
mce_flags.smca = cpu_feature_enabled(X86_FEATURE_SMCA);
22462246

2247+
if (mce_flags.smca)
2248+
smca_bsp_init();
2249+
22472250
rdmsrq(MSR_IA32_MCG_CAP, cap);
22482251

22492252
/* Use accurate RIP reporting if available. */

arch/x86/kernel/cpu/mce/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,14 @@ static __always_inline void smca_extract_err_addr(struct mce *m)
294294
m->addr &= GENMASK_ULL(55, lsb);
295295
}
296296

297+
void smca_bsp_init(void);
297298
#else
298299
static inline void mce_threshold_create_device(unsigned int cpu) { }
299300
static inline void mce_threshold_remove_device(unsigned int cpu) { }
300301
static inline bool amd_filter_mce(struct mce *m) { return false; }
301302
static inline bool amd_mce_usable_address(struct mce *m) { return false; }
302303
static inline void smca_extract_err_addr(struct mce *m) { }
304+
static inline void smca_bsp_init(void) { }
303305
#endif
304306

305307
#ifdef CONFIG_X86_ANCIENT_MCE

0 commit comments

Comments
 (0)