CXL 3.0 Spec 8.2.9.8.3.3 defines Set Alert Configuration mailbox command.
This patchset adds support for the command to configure warning alert.
Example:
# ./cxl set-alert-config mem0 -L 30 --life-used-alert=on
{
"memdev":"mem0",
"ram_size":"1024.00 MiB (1073.74 MB)",
"alert_config":{
"life_used_prog_warn_threshold_valid":true,
"dev_over_temperature_prog_warn_threshold_valid":false,
"dev_under_temperature_prog_warn_threshold_valid":false,
"corrected_volatile_mem_err_prog_warn_threshold_valid":false,
"corrected_pmem_err_prog_warn_threshold_valid":false,
"life_used_prog_warn_threshold_writable":true,
"dev_over_temperature_prog_warn_threshold_writable":true,
"dev_under_temperature_prog_warn_threshold_writable":true,
"corrected_volatile_mem_err_prog_warn_threshold_writable":true,
"corrected_pmem_err_prog_warn_threshold_writable":true,
"life_used_crit_alert_threshold":75,
"life_used_prog_warn_threshold":30,
"dev_over_temperature_crit_alert_threshold":0,
"dev_under_temperature_crit_alert_threshold":0,
"dev_over_temperature_prog_warn_threshold":0,
"dev_under_temperature_prog_warn_threshold":0,
"corrected_volatile_mem_err_prog_warn_threshold":0,
"corrected_pmem_err_prog_warn_threshold":0
},
"serial":"0",
"host":"0000:0d:00.0"
}
cxl memdev: cmd_set_alert_config: set alert configuration 1 mem
The implementation is based on the 'ndctl-inject-smart'. Variable and function
names are aligned with the implementation of 'Get Alert Configuration'.
Changes in v2
- Rebase on the latest pending branch
- Remove full usage text in the commit message (Vishal)
- Correct texts in document and log_info() (Vishal)
- Change strncmp() to strcmp() for parsing params (Vishal)
- Link to v1:
https://lore.kernel.org/r/[email protected]
Jehoon Park (2):
libcxl: add support for Set Alert Configuration mailbox command
cxl: add 'set-alert-config' command to cxl tool
Documentation/cxl/cxl-set-alert-config.txt | 96 +++++++++
Documentation/cxl/lib/libcxl.txt | 1 +
Documentation/cxl/meson.build | 1 +
cxl/builtin.h | 1 +
cxl/cxl.c | 1 +
cxl/lib/libcxl.c | 21 ++
cxl/lib/libcxl.sym | 12 ++
cxl/lib/private.h | 12 ++
cxl/libcxl.h | 16 ++
cxl/memdev.c | 220 ++++++++++++++++++++-
10 files changed, 380 insertions(+), 1 deletion(-)
create mode 100644 Documentation/cxl/cxl-set-alert-config.txt
base-commit: a871e6153b11fe63780b37cdcb1eb347b296095c
--
2.17.1