Skip to content

Commit 4efaec6

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce/amd: Support SMCA Corrected Error Interrupt
AMD systems optionally support MCA thresholding which provides the ability for hardware to send an interrupt when a set error threshold is reached. This feature counts errors of all severities, but it is commonly used to report correctable errors with an interrupt rather than polling. Scalable MCA systems allow the platform to take control of this feature. In this case, the OS will not see the feature configuration and control bits in the MCA_MISC* registers. The OS will not receive the MCA thresholding interrupt, and it will need to poll for correctable errors. A "corrected error interrupt" will be available on Scalable MCA systems. This will be used in the same configuration where the platform controls MCA thresholding. However, the platform will now be able to send the MCA thresholding interrupt to the OS. Check for, and enable, this feature during per-CPU SMCA init. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tony Luck <tony.luck@intel.com> Tested-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/20251104-wip-mca-updates-v8-0-66c8eacf67b9@amd.com
1 parent 134b1ea commit 4efaec6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • arch/x86/kernel/cpu/mce

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,23 @@ static void smca_configure(unsigned int bank, unsigned int cpu)
308308
high |= BIT(5);
309309
}
310310

311+
/*
312+
* SMCA Corrected Error Interrupt
313+
*
314+
* MCA_CONFIG[IntPresent] is bit 10, and tells us if the bank can
315+
* send an MCA Thresholding interrupt without the OS initializing
316+
* this feature. This can be used if the threshold limit is managed
317+
* by the platform.
318+
*
319+
* MCA_CONFIG[IntEn] is bit 40 (8 in the high portion of the MSR).
320+
* The OS should set this to inform the platform that the OS is ready
321+
* to handle the MCA Thresholding interrupt.
322+
*/
323+
if ((low & BIT(10)) && data->thr_intr_en) {
324+
__set_bit(bank, data->thr_intr_banks);
325+
high |= BIT(8);
326+
}
327+
311328
this_cpu_ptr(mce_banks_array)[bank].lsb_in_status = !!(low & BIT(8));
312329

313330
wrmsr(smca_config, low, high);

0 commit comments

Comments
 (0)