Skip to content

Commit 0c6e6f1

Browse files
shijujose4davejiang
authored andcommitted
cxl/edac: Add CXL memory device patrol scrub control feature
CXL spec 3.2 section 8.2.10.9.11.1 describes the device patrol scrub control feature. The device patrol scrub proactively locates and makes corrections to errors in regular cycle. Allow specifying the number of hours within which the patrol scrub must be completed, subject to minimum and maximum limits reported by the device. Also allow disabling scrub allowing trade-off error rates against performance. Add support for patrol scrub control on CXL memory devices. Register with the EDAC device driver, which retrieves the scrub attribute descriptors from EDAC scrub and exposes the sysfs scrub control attributes to userspace. For example, scrub control for the CXL memory device "cxl_mem0" is exposed in /sys/bus/edac/devices/cxl_mem0/scrubX/. Additionally, add support for region-based CXL memory patrol scrub control. CXL memory regions may be interleaved across one or more CXL memory devices. For example, region-based scrub control for "cxl_region1" is exposed in /sys/bus/edac/devices/cxl_region1/scrubX/. [dj: A few formatting fixes from Jonathan] Reviewed-by: Dave Jiang <dave.jiang@intel.com> Co-developed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Acked-by: Dan Williams <dan.j.williams@intel.com> Link: https://patch.msgid.link/20250521124749.817-4-shiju.jose@huawei.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent f76e0bb commit 0c6e6f1

File tree

8 files changed

+592
-0
lines changed

8 files changed

+592
-0
lines changed

drivers/cxl/Kconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,39 @@ config CXL_FEATURES
114114

115115
If unsure say 'n'
116116

117+
config CXL_EDAC_MEM_FEATURES
118+
bool "CXL: EDAC Memory Features"
119+
depends on EXPERT
120+
depends on CXL_MEM
121+
depends on CXL_FEATURES
122+
depends on EDAC >= CXL_BUS
123+
help
124+
The CXL EDAC memory feature is optional and allows host to
125+
control the EDAC memory features configurations of CXL memory
126+
expander devices.
127+
128+
Say 'y' if you have an expert need to change default settings
129+
of a memory RAS feature established by the platform/device.
130+
Otherwise say 'n'.
131+
132+
config CXL_EDAC_SCRUB
133+
bool "Enable CXL Patrol Scrub Control (Patrol Read)"
134+
depends on CXL_EDAC_MEM_FEATURES
135+
depends on EDAC_SCRUB
136+
help
137+
The CXL EDAC scrub control is optional and allows host to
138+
control the scrub feature configurations of CXL memory expander
139+
devices.
140+
141+
When enabled 'cxl_mem' and 'cxl_region' EDAC devices are
142+
published with memory scrub control attributes as described by
143+
Documentation/ABI/testing/sysfs-edac-scrub.
144+
145+
Say 'y' if you have an expert need to change default settings
146+
of a memory scrub feature established by the platform/device
147+
(e.g. scrub rates for the patrol scrub feature).
148+
Otherwise say 'n'.
149+
117150
config CXL_PORT
118151
default CXL_BUS
119152
tristate

drivers/cxl/core/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ cxl_core-$(CONFIG_TRACING) += trace.o
2020
cxl_core-$(CONFIG_CXL_REGION) += region.o
2121
cxl_core-$(CONFIG_CXL_MCE) += mce.o
2222
cxl_core-$(CONFIG_CXL_FEATURES) += features.o
23+
cxl_core-$(CONFIG_CXL_EDAC_MEM_FEATURES) += edac.o

0 commit comments

Comments
 (0)