On Fri, Jun 10, 2022 at 07:25:15PM +0000, Smita Koralahalli wrote:
arch/x86/kernel/cpu/mce/inject.c | 50 +++++++++++++++++++++++++++++-I've simplified, improved and removed some stuff. See if that still
arch/x86/kernel/cpu/mce/internal.h | 2 +-
2 files changed, 50 insertions(+), 2 deletions(-)
works on that platform which ignores writes.
+ cpu = get_cpu();
+
+ for (bank = 0; bank < MAX_NR_BANKS; ++bank) {
+ u64 status = MCI_STATUS_VAL, ipid;
+
+ /* Check whether bank is populated */
+ rdmsrl(MSR_AMD64_SMCA_MCx_IPID(bank), ipid);
+ if (!ipid)
+ continue;
+
+ toggle_hw_mce_inject(cpu, true);
+
+ if (wrmsrl_safe(mca_msr_reg(bank, MCA_STATUS), status)) {
+ hw_injection_possible = false;
+ pr_warn("Platform does not allow *hardware* error injection."
+ "Try using APEI EINJ instead.\n");
+ }
+
+ toggle_hw_mce_inject(cpu, false);
+
+ break;
+ }
+
+ put_cpu();
+}