x86/mce/inject: Check if a bank is populated before injecting
authorSmita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Thu, 4 Nov 2021 21:58:41 +0000 (16:58 -0500)
committerBorislav Petkov <bp@suse.de>
Wed, 8 Dec 2021 11:00:56 +0000 (12:00 +0100)
commite48d008bd13eaa9068ff59c65275d17516179f7b
treeb6e0743b4adeaa3852d8424d938c56366eca6d1a
parent2322b532ad9043336f36ba2634ab3620d5d5b4f5
x86/mce/inject: Check if a bank is populated before injecting

The MCA_IPID register uniquely identifies a bank's type on Scalable MCA
(SMCA) systems. When an MCA bank is not populated, the MCA_IPID register
will read as zero and writes to it will be ignored.

On a hw-type error injection (injection which writes the actual MCA
registers in an attempt to cause a real MCE) check the value of this
register before trying to inject the error.

Do not impose any limitations on a sw injection and allow the user to
test out all the decoding paths without relying on the available hardware,
as its purpose is to just test the code.

 [ bp: Heavily massage. ]

Link: https://lkml.kernel.org/r/20211019233641.140275-2-Smita.KoralahalliChannabasappa@amd.com
Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211104215846.254012-2-Smita.KoralahalliChannabasappa@amd.com
arch/x86/kernel/cpu/mce/inject.c