EDAC: Add a Error Check Scrub control feature
authorShiju Jose <shiju.jose@huawei.com>
Wed, 12 Feb 2025 14:36:41 +0000 (14:36 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 25 Feb 2025 14:42:32 +0000 (15:42 +0100)
commitbcbd069b11b024994e30c7c2f3d716a4141fdab1
tree14a5ae0723696247b51cc9fac6146b23b4ef554a
parentf90b738166fe909df48de6a03744ddfbad5002f8
EDAC: Add a Error Check Scrub control feature

Add an Error Check Scrub (ECS) control to manage a memory device's ECS
feature.

The ECS is a feature defined in JEDEC DDR5 SDRAM Specification (JESD79-5) and
allows the DRAM to internally read, correct single-bit errors, and write back
corrected data bits to the DRAM array while providing transparency to error
counts.

The DDR5 device contains a number of memory media Field Replaceable Units
(FRU) per device. The DDR5 ECS feature and thus the ECS control driver
supports configuring the ECS parameters per FRU.

Memory devices support the ECS feature register with the EDAC device driver,
which retrieves the ECS descriptor from the EDAC ECS driver.  This driver
exposes sysfs ECS control attributes to userspace via

  /sys/bus/edac/devices/<dev-name>/ecs_fruX/.

The common sysfs ECS control interface abstracts the control of an arbitrary
ECS functionality to a common set of functions.

Support for the ECS feature is added separately because the control attributes
of the DDR5 ECS feature differ from those of the scrub feature.

The sysfs ECS attribute nodes are only present if the client driver has
implemented the corresponding attribute callback function and passed the
necessary operations to the EDAC RAS feature driver during registration.

  [ bp: Massage, fixup edac_dev_register() retvals. ]

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>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Tested-by: Fan Ni <fan.ni@samsung.com>
Link: https://lore.kernel.org/r/20250212143654.1893-4-shiju.jose@huawei.com
Documentation/ABI/testing/sysfs-edac-ecs [new file with mode: 0644]
Documentation/edac/scrub.rst
drivers/edac/Kconfig
drivers/edac/Makefile
drivers/edac/ecs.c [new file with mode: 0755]
drivers/edac/edac_device.c
include/linux/edac.h