Skip to content

Commit 02c163e

Browse files
committed
Merge tag 'cxl-for-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL updates from Dan Williams: "CXL has mechanisms to enumerate the performance characteristics of memory devices. Those mechanisms allow Linux to build the equivalent of ACPI SRAT, SLIT, and HMAT tables dynamically at runtime. That capability is necessary because static ACPI can not represent dynamic CXL configurations (and reconfigurations). So, building on the v6.8 work to add "Quality of Service" enumeration, this update plumbs CXL "access coordinates" (read/write access latency and bandwidth) in all the same places that ACPI HMAT feeds similar data. Follow-on patches from the -mm side can then use that data to feed mechanisms like mm/memory-tiers.c. Greg has acked the touch to drivers/base/. The other feature update this cycle is support for CXL error injection via the ACPI EINJ module. That facility enables injection of bus protocol errors provided the user knows the magic address values to insert in the interface. To hide that magic, and make this easier to use, new error injection attributes were added to CXL debugfs. That interface injects the errors relative to a CXL object rather than require user tooling to know how to lookup and inject RCRB (Root Complex Register Block) addresses into the raw EINJ debugfs interface. It received some helpful review comments from Tony, but no explicit acks from the ACPI side. The primary user visible change for existing EINJ users is that they may find that einj.ko was already loaded by cxl_core.ko. Previously, einj.ko was only loaded on demand. The usual collection of miscellaneous cleanups are also present this cycle. Summary: - Supplement ACPI HMAT reported memory performance with native CXL memory performance enumeration - Add support for CXL error injection via the ACPI EINJ mechanism - Cleanup CXL DOE and CDAT integration - Miscellaneous cleanups and fixes" * tag 'cxl-for-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (21 commits) Documentation/ABI/testing/debugfs-cxl: Fix "Unexpected indentation" lib/firmware_table: Provide buffer length argument to cdat_table_parse() cxl/pci: Get rid of pointer arithmetic reading CDAT table cxl/pci: Rename DOE mailbox handle to doe_mb cxl: Fix the incorrect assignment of SSLBIS entry pointer initial location cxl/core: Add CXL EINJ debugfs files EINJ, Documentation: Update EINJ kernel doc EINJ: Add CXL error type support EINJ: Migrate to a platform driver cxl/region: Deal with numa nodes not enumerated by SRAT cxl/region: Add memory hotplug notifier for cxl region cxl/region: Add sysfs attribute for locality attributes of CXL regions cxl/region: Calculate performance data for a region cxl: Set cxlmd->endpoint before adding port device cxl: Move QoS class to be calculated from the nearest CPU cxl: Split out host bridge access coordinates cxl: Split out combine_coordinates() for common shared usage ACPI: HMAT / cxl: Add retrieval of generic port coordinates for both access classes ACPI: HMAT: Introduce 2 levels of generic port access class base/node / ACPI: Enumerate node access class for 'struct access_coordinate' ...
2 parents 5c84b05 + ed1ff2f commit 02c163e

File tree

27 files changed

+1004
-148
lines changed

27 files changed

+1004
-148
lines changed

Documentation/ABI/testing/debugfs-cxl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,37 @@ Description:
3333
device cannot clear poison from the address, -ENXIO is returned.
3434
The clear_poison attribute is only visible for devices
3535
supporting the capability.
36+
37+
What: /sys/kernel/debug/cxl/einj_types
38+
Date: January, 2024
39+
KernelVersion: v6.9
40+
Contact: linux-cxl@vger.kernel.org
41+
Description:
42+
(RO) Prints the CXL protocol error types made available by
43+
the platform in the format:
44+
45+
0x<error number> <error type>
46+
47+
The possible error types are (as of ACPI v6.5):
48+
49+
0x1000 CXL.cache Protocol Correctable
50+
0x2000 CXL.cache Protocol Uncorrectable non-fatal
51+
0x4000 CXL.cache Protocol Uncorrectable fatal
52+
0x8000 CXL.mem Protocol Correctable
53+
0x10000 CXL.mem Protocol Uncorrectable non-fatal
54+
0x20000 CXL.mem Protocol Uncorrectable fatal
55+
56+
The <error number> can be written to einj_inject to inject
57+
<error type> into a chosen dport.
58+
59+
What: /sys/kernel/debug/cxl/$dport_dev/einj_inject
60+
Date: January, 2024
61+
KernelVersion: v6.9
62+
Contact: linux-cxl@vger.kernel.org
63+
Description:
64+
(WO) Writing an integer to this file injects the corresponding
65+
CXL protocol error into $dport_dev ($dport_dev will be a device
66+
name from /sys/bus/pci/devices). The integer to type mapping for
67+
injection can be found by reading from einj_types. If the dport
68+
was enumerated in RCH mode, a CXL 1.1 error is injected, otherwise
69+
a CXL 2.0 error is injected.

Documentation/ABI/testing/sysfs-bus-cxl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,37 @@ Description:
552552
attribute is only visible for devices supporting the
553553
capability. The retrieved errors are logged as kernel
554554
events when cxl_poison event tracing is enabled.
555+
556+
557+
What: /sys/bus/cxl/devices/regionZ/accessY/read_bandwidth
558+
/sys/bus/cxl/devices/regionZ/accessY/write_banwidth
559+
Date: Jan, 2024
560+
KernelVersion: v6.9
561+
Contact: linux-cxl@vger.kernel.org
562+
Description:
563+
(RO) The aggregated read or write bandwidth of the region. The
564+
number is the accumulated read or write bandwidth of all CXL memory
565+
devices that contributes to the region in MB/s. It is
566+
identical data that should appear in
567+
/sys/devices/system/node/nodeX/accessY/initiators/read_bandwidth or
568+
/sys/devices/system/node/nodeX/accessY/initiators/write_bandwidth.
569+
See Documentation/ABI/stable/sysfs-devices-node. access0 provides
570+
the number to the closest initiator and access1 provides the
571+
number to the closest CPU.
572+
573+
574+
What: /sys/bus/cxl/devices/regionZ/accessY/read_latency
575+
/sys/bus/cxl/devices/regionZ/accessY/write_latency
576+
Date: Jan, 2024
577+
KernelVersion: v6.9
578+
Contact: linux-cxl@vger.kernel.org
579+
Description:
580+
(RO) The read or write latency of the region. The number is
581+
the worst read or write latency of all CXL memory devices that
582+
contributes to the region in nanoseconds. It is identical data
583+
that should appear in
584+
/sys/devices/system/node/nodeX/accessY/initiators/read_latency or
585+
/sys/devices/system/node/nodeX/accessY/initiators/write_latency.
586+
See Documentation/ABI/stable/sysfs-devices-node. access0 provides
587+
the number to the closest initiator and access1 provides the
588+
number to the closest CPU.

Documentation/firmware-guide/acpi/apei/einj.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ configuration::
3232
CONFIG_ACPI_APEI
3333
CONFIG_ACPI_APEI_EINJ
3434

35+
...and to (optionally) enable CXL protocol error injection set::
36+
37+
CONFIG_ACPI_APEI_EINJ_CXL
38+
3539
The EINJ user interface is in <debugfs mount point>/apei/einj.
3640

3741
The following files belong to it:
@@ -118,6 +122,24 @@ The following files belong to it:
118122
this actually works depends on what operations the BIOS actually
119123
includes in the trigger phase.
120124

125+
CXL error types are supported from ACPI 6.5 onwards (given a CXL port
126+
is present). The EINJ user interface for CXL error types is at
127+
<debugfs mount point>/cxl. The following files belong to it:
128+
129+
- einj_types:
130+
131+
Provides the same functionality as available_error_types above, but
132+
for CXL error types
133+
134+
- $dport_dev/einj_inject:
135+
136+
Injects a CXL error type into the CXL port represented by $dport_dev,
137+
where $dport_dev is the name of the CXL port (usually a PCIe device name).
138+
Error injections targeting a CXL 2.0+ port can use the legacy interface
139+
under <debugfs mount point>/apei/einj, while CXL 1.1/1.0 port injections
140+
must use this file.
141+
142+
121143
BIOS versions based on the ACPI 4.0 specification have limited options
122144
in controlling where the errors are injected. Your BIOS may support an
123145
extension (enabled with the param_extension=1 module parameter, or boot
@@ -181,6 +203,18 @@ You should see something like this in dmesg::
181203
[22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0
182204
[22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0)
183205

206+
A CXL error injection example with $dport_dev=0000:e0:01.1::
207+
208+
# cd /sys/kernel/debug/cxl/
209+
# ls
210+
0000:e0:01.1 0000:0c:00.0
211+
# cat einj_types # See which errors can be injected
212+
0x00008000 CXL.mem Protocol Correctable
213+
0x00010000 CXL.mem Protocol Uncorrectable non-fatal
214+
0x00020000 CXL.mem Protocol Uncorrectable fatal
215+
# cd 0000:e0:01.1 # Navigate to dport to inject into
216+
# echo 0x8000 > einj_inject # Inject error
217+
184218
Special notes for injection into SGX enclaves:
185219

186220
There may be a separate BIOS setup option to enable SGX injection.

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5321,6 +5321,7 @@ M: Dan Williams <dan.j.williams@intel.com>
53215321
L: linux-cxl@vger.kernel.org
53225322
S: Maintained
53235323
F: drivers/cxl/
5324+
F: include/linux/cxl-einj.h
53245325
F: include/linux/cxl-event.h
53255326
F: include/uapi/linux/cxl_mem.h
53265327
F: tools/testing/cxl/

drivers/acpi/apei/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ config ACPI_APEI_EINJ
6060
mainly used for debugging and testing the other parts of
6161
APEI and some other RAS features.
6262

63+
config ACPI_APEI_EINJ_CXL
64+
bool "CXL Error INJection Support"
65+
default ACPI_APEI_EINJ
66+
depends on ACPI_APEI_EINJ
67+
depends on CXL_BUS && CXL_BUS <= ACPI_APEI_EINJ
68+
help
69+
Support for CXL protocol Error INJection through debugfs/cxl.
70+
Availability and which errors are supported is dependent on
71+
the host platform. Look to ACPI v6.5 section 18.6.4 and kernel
72+
EINJ documentation for more information.
73+
74+
If unsure say 'n'
75+
6376
config ACPI_APEI_ERST_DEBUG
6477
tristate "APEI Error Record Serialization Table (ERST) Debug Support"
6578
depends on ACPI_APEI

drivers/acpi/apei/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
obj-$(CONFIG_ACPI_APEI) += apei.o
33
obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o
44
obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o
5+
einj-y := einj-core.o
6+
einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
57
obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o
68

79
apei-y := apei-base.o hest.o erst.o bert.o

drivers/acpi/apei/apei-internal.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,22 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus)
130130
}
131131

132132
int apei_osc_setup(void);
133+
134+
int einj_get_available_error_type(u32 *type);
135+
int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3,
136+
u64 param4);
137+
int einj_cxl_rch_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
138+
u64 param3, u64 param4);
139+
bool einj_is_cxl_error_type(u64 type);
140+
int einj_validate_error_type(u64 type);
141+
142+
#ifndef ACPI_EINJ_CXL_CACHE_CORRECTABLE
143+
#define ACPI_EINJ_CXL_CACHE_CORRECTABLE BIT(12)
144+
#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE BIT(13)
145+
#define ACPI_EINJ_CXL_CACHE_FATAL BIT(14)
146+
#define ACPI_EINJ_CXL_MEM_CORRECTABLE BIT(15)
147+
#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE BIT(16)
148+
#define ACPI_EINJ_CXL_MEM_FATAL BIT(17)
149+
#endif
150+
133151
#endif

0 commit comments

Comments
 (0)