Em Tue, 16 Jul 2024 16:03:26 +0100 <shiju.jose@xxxxxxxxxx> escreveu: > From: Shiju Jose <shiju.jose@xxxxxxxxxx> > > Add generic EDAC scrub control driver supports configuring the memory scrubbers > in the system. The device with scrub feature, get the scrub descriptor from the > EDAC scrub and registers with the EDAC RAS feature driver, which adds the sysfs > scrub control interface. The scrub control attributes are available to the > userspace in /sys/bus/edac/devices/<dev-name>/scrub/. > > Generic EDAC scrub driver and the common sysfs scrub interface promotes > unambiguous access from the userspace irrespective of the underlying scrub > devices. > > Co-developed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Signed-off-by: Shiju Jose <shiju.jose@xxxxxxxxxx> > --- > Documentation/ABI/testing/sysfs-edac-scrub | 64 +++++ > drivers/edac/Makefile | 2 +- > drivers/edac/edac_ras_feature.c | 1 + > drivers/edac/edac_scrub.c | 312 +++++++++++++++++++++ > include/linux/edac_ras_feature.h | 28 ++ > 5 files changed, 406 insertions(+), 1 deletion(-) > create mode 100644 Documentation/ABI/testing/sysfs-edac-scrub > create mode 100755 drivers/edac/edac_scrub.c > > diff --git a/Documentation/ABI/testing/sysfs-edac-scrub b/Documentation/ABI/testing/sysfs-edac-scrub > new file mode 100644 > index 000000000000..dd19afd5e165 > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-edac-scrub > @@ -0,0 +1,64 @@ > +What: /sys/bus/edac/devices/<dev-name>/scrub > +Date: Oct 2024 > +KernelVersion: 6.12 > +Contact: linux-edac@xxxxxxxxxxxxxxx > +Description: > + The sysfs edac bus devices /<dev-name>/scrub subdirectory > + belongs to the memory scrub control feature, where <dev-name> > + directory corresponds to a device/memory region registered > + with the edac scrub driver and thus registered with the > + generic edac ras driver too. > + > +What: /sys/bus/edac/devices/<dev-name>/scrub/addr_range_base > +Date: Oct 2024 > +KernelVersion: 6.12 > +Contact: linux-edac@xxxxxxxxxxxxxxx > +Description: > + (RW) The base of the address range of the memory region > + to be scrubbed (on-demand scrubbing). > + > +What: /sys/bus/edac/devices/<dev-name>/scrub/addr_range_size > +Date: Oct 2024 > +KernelVersion: 6.12 > +Contact: linux-edac@xxxxxxxxxxxxxxx > +Description: > + (RW) The size of the address range of the memory region > + to be scrubbed (on-demand scrubbing). > + > +What: /sys/bus/edac/devices/<dev-name>/scrub/enable_background > +Date: Oct 2024 > +KernelVersion: 6.12 > +Contact: linux-edac@xxxxxxxxxxxxxxx > +Description: > + (RW) Start/Stop background(patrol) scrubbing if supported. > + > +What: /sys/bus/edac/devices/<dev-name>/scrub/enable_on_demand > +Date: Oct 2024 > +KernelVersion: 6.12 > +Contact: linux-edac@xxxxxxxxxxxxxxx > +Description: > + (RW) Start/Stop on-demand scrubbing the memory region > + if supported. This is a generic comment for all sysfs calls: what happens if not supported? There are a couple of ways to implement it, like: 1. Don't create the attribute; 2. return an error code (-ENOENT? -EINVAL?) if trying to read or write to the devnode - please detail the used error code(s); In any case, please define the behavior and document it.