linux-stable/arch/x86
Yazen Ghannam c9275305d6 x86/mce/inject: Clear test status value
[ Upstream commit 6175b40775 ]

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: 891e465a1b ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 15:27:18 -08:00
..
boot x86/sev: Check for user-space IOIO pointing to kernel space 2023-10-25 12:03:04 +02:00
coco x86/tdx: Allow 32-bit emulation by default 2023-12-13 18:39:05 +01:00
configs
crypto crypto: x86/sha - load modules based on CPU features 2023-11-28 17:07:07 +00:00
entry x86/entry: Do not allow external 0x80 interrupts 2023-12-13 18:39:05 +01:00
events KVM: x86/pmu: fix masking logic for MSR_CORE_PERF_GLOBAL_CTRL 2024-01-10 17:10:21 +01:00
hyperv x86/hyperv: Fix the detection of E820_TYPE_PRAM in a Gen2 VM 2023-12-20 17:00:21 +01:00
ia32
include x86/entry: Convert INT 0x80 emulation to IDTENTRY 2023-12-13 18:39:05 +01:00
kernel x86/mce/inject: Clear test status value 2024-01-25 15:27:18 -08:00
kvm KVM: SVM: Update EFER software model on CR0 trap for SEV-ES 2023-12-13 18:39:29 +01:00
lib x86/lib: Fix overflow when counting digits 2024-01-25 15:27:18 -08:00
math-emu
mm x86/coco: Disable 32-bit emulation by default on TDX and SEV 2023-12-13 18:39:04 +01:00
net bpf: Support new 32bit offset jmp instruction 2024-01-10 17:10:29 +01:00
pci x86/pci/xen: populate MSI sysfs entries 2023-05-30 14:03:22 +01:00
platform x86/efi: Make efi_set_virtual_address_map IBT safe 2023-07-19 16:21:45 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-11-21 14:16:16 +01:00
purgatory x86/purgatory: Remove LTO flags 2023-09-23 11:11:09 +02:00
ras
realmode x86/boot: Skip realmode init code when running as Xen PV guest 2022-12-31 13:32:16 +01:00
tools
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 13:55:22 +01:00
video
virt/vmx/tdx
xen x86/xen: add CPU dependencies for 32-bit build 2024-01-01 12:38:59 +00:00
.gitignore
Kbuild
Kconfig x86/srso: Add a Speculative RAS Overflow mitigation 2023-08-08 20:03:50 +02:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block 2023-02-09 11:28:13 +01:00
Makefile.um um: Only disable SSE on clang to work around old GCC bugs 2023-05-01 08:26:27 +09:00
Makefile_32.cpu