]> git.ipfire.org Git - thirdparty/linux.git/commit
x86/mce: Implement recovery for errors in TDX/SEAM non-root mode
authorTony Luck <tony.luck@intel.com>
Mon, 8 Apr 2024 18:09:44 +0000 (11:09 -0700)
committerIngo Molnar <mingo@kernel.org>
Tue, 9 Apr 2024 07:30:36 +0000 (09:30 +0200)
commit7911f145de5fecbee1d67f27f73bec12f0fbc472
tree8bb7b17dff8b89abd71c3b392c23cd136e563fad
parent0e6ebfd163645d300fdf4abedd1718195ad293bc
x86/mce: Implement recovery for errors in TDX/SEAM non-root mode

Machine check SMIs (MSMI) signaled during SEAM operation (typically
inside TDX guests), on a system with Intel eMCA enabled, might eventually
be reported to the kernel #MC handler with the saved RIP on the stack
pointing to the instruction in kernel code after the SEAMCALL instruction
that entered the SEAM operation. Linux currently says that is a fatal
error and shuts down.

There is a new bit in IA32_MCG_STATUS that, when set to 1, indicates
that the machine check didn't originally occur at that saved RIP, but
during SEAM non-root operation.

Add new entries to the severity table to detect this for both data load
and instruction fetch that set the severity to "AR" (action required).

Increase the width of the mcgmask/mcgres fields in "struct severity"
from unsigned char to unsigned short since the new bit is in position 12.

Action required for these errors is just mark the page as poisoned and
return from the machine check handler.

HW ABI notes:
=============

The SEAM_NR bit in IA32_MCG_STATUS hasn't yet made it into the Intel
Software Developers' Manual. But it is described in section 16.5.2
of "Intel(R) Trust Domain Extensions (Intel(R) TDX) Module Base
Architecture Specification" downloadable from:

  https://cdrdv2.intel.com/v1/dl/getContent/733575

Backport notes:
===============

Little value in backporting this patch to stable or LTS kernels as
this is only relevant with support for TDX, which I assume won't be
backported. But for anyone taking this to v6.1 or older, you also
need commit:

  a51cbd0d86d3 ("x86/mce: Use severity table to handle uncorrected errors in kernel")

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240408180944.44638-1-tony.luck@intel.com
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/severity.c