Skip to content

Commit db5ccb9

Browse files
committed
Merge tag 'cxl-for-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull CXL (Compute Express Link) updates from Dan Williams: "The bulk of this update is support for enumerating the performance capabilities of CXL memory targets and connecting that to a platform CXL memory QoS class. Some follow-on work remains to hook up this data into core-mm policy, but that is saved for v6.9. The next significant update is unifying how CXL event records (things like background scrub errors) are processed between so called "firmware first" and native error record retrieval. The CXL driver handler that processes the record retrieved from the device mailbox is now the handler for that same record format coming from an EFI/ACPI notification source. This also contains miscellaneous feature updates, like Get Timestamp, and other fixups. Summary: - Add support for parsing the Coherent Device Attribute Table (CDAT) - Add support for calculating a platform CXL QoS class from CDAT data - Unify the tracing of EFI CXL Events with native CXL Events. - Add Get Timestamp support - Miscellaneous cleanups and fixups" * tag 'cxl-for-6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: (41 commits) cxl/core: use sysfs_emit() for attr's _show() cxl/pci: Register for and process CPER events PCI: Introduce cleanup helpers for device reference counts and locks acpi/ghes: Process CXL Component Events cxl/events: Create a CXL event union cxl/events: Separate UUID from event structures cxl/events: Remove passing a UUID to known event traces cxl/events: Create common event UUID defines cxl/events: Promote CXL event structures to a core header cxl: Refactor to use __free() for cxl_root allocation in cxl_endpoint_port_probe() cxl: Refactor to use __free() for cxl_root allocation in cxl_find_nvdimm_bridge() cxl: Fix device reference leak in cxl_port_perf_data_calculate() cxl: Convert find_cxl_root() to return a 'struct cxl_root *' cxl: Introduce put_cxl_root() helper cxl/port: Fix missing target list lock cxl/port: Fix decoder initialization when nr_targets > interleave_ways cxl/region: fix x9 interleave typo cxl/trace: Pass UUID explicitly to event traces cxl/region: use %pap format to print resource_size_t cxl/region: Add dev_dbg() detail on failure to allocate HPA space ...
2 parents 244aefb + 73bf93e commit db5ccb9

37 files changed

Lines changed: 1844 additions & 328 deletions

File tree

Documentation/ABI/testing/sysfs-bus-cxl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ Description:
2828
Payload in the CXL-2.0 specification.
2929

3030

31+
What: /sys/bus/cxl/devices/memX/ram/qos_class
32+
Date: May, 2023
33+
KernelVersion: v6.8
34+
Contact: linux-cxl@vger.kernel.org
35+
Description:
36+
(RO) For CXL host platforms that support "QoS Telemmetry"
37+
this attribute conveys a comma delimited list of platform
38+
specific cookies that identifies a QoS performance class
39+
for the volatile partition of the CXL mem device. These
40+
class-ids can be compared against a similar "qos_class"
41+
published for a root decoder. While it is not required
42+
that the endpoints map their local memory-class to a
43+
matching platform class, mismatches are not recommended
44+
and there are platform specific performance related
45+
side-effects that may result. First class-id is displayed.
46+
47+
3148
What: /sys/bus/cxl/devices/memX/pmem/size
3249
Date: December, 2020
3350
KernelVersion: v5.12
@@ -38,6 +55,23 @@ Description:
3855
Payload in the CXL-2.0 specification.
3956

4057

58+
What: /sys/bus/cxl/devices/memX/pmem/qos_class
59+
Date: May, 2023
60+
KernelVersion: v6.8
61+
Contact: linux-cxl@vger.kernel.org
62+
Description:
63+
(RO) For CXL host platforms that support "QoS Telemmetry"
64+
this attribute conveys a comma delimited list of platform
65+
specific cookies that identifies a QoS performance class
66+
for the persistent partition of the CXL mem device. These
67+
class-ids can be compared against a similar "qos_class"
68+
published for a root decoder. While it is not required
69+
that the endpoints map their local memory-class to a
70+
matching platform class, mismatches are not recommended
71+
and there are platform specific performance related
72+
side-effects that may result. First class-id is displayed.
73+
74+
4175
What: /sys/bus/cxl/devices/memX/serial
4276
Date: January, 2022
4377
KernelVersion: v5.18

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5280,6 +5280,7 @@ M: Dan Williams <dan.j.williams@intel.com>
52805280
L: linux-cxl@vger.kernel.org
52815281
S: Maintained
52825282
F: drivers/cxl/
5283+
F: include/linux/cxl-event.h
52835284
F: include/uapi/linux/cxl_mem.h
52845285
F: tools/testing/cxl/
52855286

drivers/acpi/apei/ghes.c

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/interrupt.h>
2727
#include <linux/timer.h>
2828
#include <linux/cper.h>
29+
#include <linux/cxl-event.h>
2930
#include <linux/platform_device.h>
3031
#include <linux/mutex.h>
3132
#include <linux/ratelimit.h>
@@ -673,6 +674,78 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata,
673674
schedule_work(&entry->work);
674675
}
675676

677+
/*
678+
* Only a single callback can be registered for CXL CPER events.
679+
*/
680+
static DECLARE_RWSEM(cxl_cper_rw_sem);
681+
static cxl_cper_callback cper_callback;
682+
683+
/* CXL Event record UUIDs are formatted as GUIDs and reported in section type */
684+
685+
/*
686+
* General Media Event Record
687+
* CXL rev 3.0 Section 8.2.9.2.1.1; Table 8-43
688+
*/
689+
#define CPER_SEC_CXL_GEN_MEDIA_GUID \
690+
GUID_INIT(0xfbcd0a77, 0xc260, 0x417f, \
691+
0x85, 0xa9, 0x08, 0x8b, 0x16, 0x21, 0xeb, 0xa6)
692+
693+
/*
694+
* DRAM Event Record
695+
* CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
696+
*/
697+
#define CPER_SEC_CXL_DRAM_GUID \
698+
GUID_INIT(0x601dcbb3, 0x9c06, 0x4eab, \
699+
0xb8, 0xaf, 0x4e, 0x9b, 0xfb, 0x5c, 0x96, 0x24)
700+
701+
/*
702+
* Memory Module Event Record
703+
* CXL rev 3.0 section 8.2.9.2.1.3; Table 8-45
704+
*/
705+
#define CPER_SEC_CXL_MEM_MODULE_GUID \
706+
GUID_INIT(0xfe927475, 0xdd59, 0x4339, \
707+
0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74)
708+
709+
static void cxl_cper_post_event(enum cxl_event_type event_type,
710+
struct cxl_cper_event_rec *rec)
711+
{
712+
if (rec->hdr.length <= sizeof(rec->hdr) ||
713+
rec->hdr.length > sizeof(*rec)) {
714+
pr_err(FW_WARN "CXL CPER Invalid section length (%u)\n",
715+
rec->hdr.length);
716+
return;
717+
}
718+
719+
if (!(rec->hdr.validation_bits & CPER_CXL_COMP_EVENT_LOG_VALID)) {
720+
pr_err(FW_WARN "CXL CPER invalid event\n");
721+
return;
722+
}
723+
724+
guard(rwsem_read)(&cxl_cper_rw_sem);
725+
if (cper_callback)
726+
cper_callback(event_type, rec);
727+
}
728+
729+
int cxl_cper_register_callback(cxl_cper_callback callback)
730+
{
731+
guard(rwsem_write)(&cxl_cper_rw_sem);
732+
if (cper_callback)
733+
return -EINVAL;
734+
cper_callback = callback;
735+
return 0;
736+
}
737+
EXPORT_SYMBOL_NS_GPL(cxl_cper_register_callback, CXL);
738+
739+
int cxl_cper_unregister_callback(cxl_cper_callback callback)
740+
{
741+
guard(rwsem_write)(&cxl_cper_rw_sem);
742+
if (callback != cper_callback)
743+
return -EINVAL;
744+
cper_callback = NULL;
745+
return 0;
746+
}
747+
EXPORT_SYMBOL_NS_GPL(cxl_cper_unregister_callback, CXL);
748+
676749
static bool ghes_do_proc(struct ghes *ghes,
677750
const struct acpi_hest_generic_status *estatus)
678751
{
@@ -707,6 +780,22 @@ static bool ghes_do_proc(struct ghes *ghes,
707780
}
708781
else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) {
709782
queued = ghes_handle_arm_hw_error(gdata, sev, sync);
783+
} else if (guid_equal(sec_type, &CPER_SEC_CXL_GEN_MEDIA_GUID)) {
784+
struct cxl_cper_event_rec *rec =
785+
acpi_hest_get_payload(gdata);
786+
787+
cxl_cper_post_event(CXL_CPER_EVENT_GEN_MEDIA, rec);
788+
} else if (guid_equal(sec_type, &CPER_SEC_CXL_DRAM_GUID)) {
789+
struct cxl_cper_event_rec *rec =
790+
acpi_hest_get_payload(gdata);
791+
792+
cxl_cper_post_event(CXL_CPER_EVENT_DRAM, rec);
793+
} else if (guid_equal(sec_type,
794+
&CPER_SEC_CXL_MEM_MODULE_GUID)) {
795+
struct cxl_cper_event_rec *rec =
796+
acpi_hest_get_payload(gdata);
797+
798+
cxl_cper_post_event(CXL_CPER_EVENT_MEM_MODULE, rec);
710799
} else {
711800
void *err = acpi_hest_get_payload(gdata);
712801

0 commit comments

Comments
 (0)