cxl: Add mce notifier to emit aliased address for extended linear cache
authorDave Jiang <dave.jiang@intel.com>
Wed, 26 Feb 2025 16:21:21 +0000 (09:21 -0700)
committerDave Jiang <dave.jiang@intel.com>
Wed, 26 Feb 2025 21:13:49 +0000 (14:13 -0700)
commit516e5bd0b6bf4ae1ad072df637b428a737c3c870
tree685260cc04d2d2fdc760b065a5db7d65c13ffe78
parent8c520c5f1e767ed6b47feefca1ed32a097e9b707
cxl: Add mce notifier to emit aliased address for extended linear cache

Below is a setup with extended linear cache configuration with an example
layout of memory region shown below presented as a single memory region
consists of 256G memory where there's 128G of DRAM and 128G of CXL memory.
The kernel sees a region of total 256G of system memory.

              128G DRAM                          128G CXL memory
|-----------------------------------|-------------------------------------|

Data resides in either DRAM or far memory (FM) with no replication. Hot
data is swapped into DRAM by the hardware behind the scenes. When error is
detected in one location, it is possible that error also resides in the
aliased location. Therefore when a memory location that is flagged by MCE
is part of the special region, the aliased memory location needs to be
offlined as well.

Add an mce notify callback to identify if the MCE address location is part
of an extended linear cache region and handle accordingly.

Added symbol export to set_mce_nospec() in x86 code in order to call
set_mce_nospec() from the CXL MCE notify callback.

Link: https://lore.kernel.org/linux-cxl/668333b17e4b2_5639294fd@dwillia2-xfh.jf.intel.com.notmuch/
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20250226162224.3633792-5-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
arch/x86/mm/pat/set_memory.c
drivers/cxl/Kconfig
drivers/cxl/core/Makefile
drivers/cxl/core/mbox.c
drivers/cxl/core/mce.c [new file with mode: 0644]
drivers/cxl/core/mce.h [new file with mode: 0644]
drivers/cxl/core/region.c
drivers/cxl/cxl.h
drivers/cxl/cxlmem.h
tools/testing/cxl/Kbuild