Skip to content

Commit 6175b40

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce/inject: Clear test status value
AMD systems generally allow MCA "simulation" where MCA registers can be written with valid data and the full MCA handling flow can be tested by software. However, the platform on Scalable MCA systems, can prevent software from writing data to the MCA registers. There is no architectural way to determine this configuration. Therefore, the MCE injection module will check for this behavior by writing and reading back a test status value. This is done during module init, and the check can run on any CPU with any valid MCA bank. If MCA_STATUS writes are ignored by the platform, then there are no side effects on the hardware state. If the writes are not ignored, then the test status value will remain in the hardware MCA_STATUS register. It is likely that the value will not be overwritten by hardware or software, since the tested CPU and bank are arbitrary. Therefore, the user may see a spurious, synthetic MCA error reported whenever MCA is polled for this CPU. Clear the test value immediately after writing it. It is very unlikely that a valid MCA error is logged by hardware during the test. Errors that cause an #MC won't be affected. Fixes: 891e465 ("x86/mce: Check whether writes to MCA_STATUS are getting ignored") Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20231118193248.1296798-2-yazen.ghannam@amd.com
1 parent 612905e commit 6175b40

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ static void check_hw_inj_possible(void)
746746

747747
wrmsrl_safe(mca_msr_reg(bank, MCA_STATUS), status);
748748
rdmsrl_safe(mca_msr_reg(bank, MCA_STATUS), &status);
749+
wrmsrl_safe(mca_msr_reg(bank, MCA_STATUS), 0);
749750

750751
if (!status) {
751752
hw_injection_possible = false;

0 commit comments

Comments
 (0)