tools/testing/cxl: Add a sysfs attr to test poison inject limits
authorAlison Schofield <alison.schofield@intel.com>
Wed, 19 Apr 2023 03:26:33 +0000 (20:26 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sun, 23 Apr 2023 19:08:39 +0000 (12:08 -0700)
commit98980d76c3fc3d56b34e425eb102b10355ccc743
tree3ceb586c609d5f43ce95e8d93ecba1b8b70f9c4f
parent8eac7ea72593010726713c5359a4b6aedf29b6fe
tools/testing/cxl: Add a sysfs attr to test poison inject limits

CXL devices may report a maximum number of addresses that a device
allows to be poisoned using poison injection. When cxl_test creates
mock CXL memory devices, it defaults to MOCK_INJECT_DEV_MAX==88 for
all mocked memdevs.

Add a sysfs attribute, poison_inject_max to module cxl_mock_mem so
that users can set a custom device injection limit. Fail, and return
-EBUSY, if the mock poison list is not empty.

/sys/bus/platform/drivers/cxl_mock_mem/poison_inject_max

A simple usage model is to set the attribute before running a test in
order to emulate a device's poison handling.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/0f25b2862b90013545450222d2199e435c6cc11a.1681874357.git.alison.schofield@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
tools/testing/cxl/test/mem.c