From: Alastair D'Silva <alastair@xxxxxxxxxxx> When health & performance data is requested from the controller, it responds with an error log containing the requested information. This patch allows the request to me issued via an IOCTL. Signed-off-by: Alastair D'Silva <alastair@xxxxxxxxxxx> --- drivers/nvdimm/ocxl/scm.c | 16 ++++++++++++++++ include/uapi/nvdimm/ocxl-scm.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/nvdimm/ocxl/scm.c b/drivers/nvdimm/ocxl/scm.c index 854787950334..d482b3213a02 100644 --- a/drivers/nvdimm/ocxl/scm.c +++ b/drivers/nvdimm/ocxl/scm.c @@ -1048,6 +1048,18 @@ static int scm_ioctl_event_check(struct scm_data *scm_data, u64 __user *uarg) return rc; } +/** + * scm_req_controller_health_perf() - Request controller health & performance data + * @scm_data: the SCM metadata + * Return: 0 on success, negative on failure + */ +int scm_req_controller_health_perf(struct scm_data *scm_data) +{ + return ocxl_global_mmio_set64(scm_data->ocxl_afu, GLOBAL_MMIO_HCI, + OCXL_LITTLE_ENDIAN, + GLOBAL_MMIO_HCI_REQ_HEALTH_PERF); +} + static long scm_file_ioctl(struct file *file, unsigned int cmd, unsigned long args) { @@ -1086,6 +1098,10 @@ static long scm_file_ioctl(struct file *file, unsigned int cmd, case SCM_IOCTL_EVENT_CHECK: rc = scm_ioctl_event_check(scm_data, (u64 __user *)args); break; + + case SCM_IOCTL_REQUEST_HEALTH: + rc = scm_req_controller_health_perf(scm_data); + break; } return rc; diff --git a/include/uapi/nvdimm/ocxl-scm.h b/include/uapi/nvdimm/ocxl-scm.h index e86ffb02d31f..55a7ad59d614 100644 --- a/include/uapi/nvdimm/ocxl-scm.h +++ b/include/uapi/nvdimm/ocxl-scm.h @@ -90,5 +90,6 @@ struct scm_ioctl_eventfd { #define SCM_IOCTL_CONTROLLER_STATS _IO(SCM_MAGIC, 0x05) #define SCM_IOCTL_EVENTFD _IOW(SCM_MAGIC, 0x06, struct scm_ioctl_eventfd) #define SCM_IOCTL_EVENT_CHECK _IOR(SCM_MAGIC, 0x07, __u64) +#define SCM_IOCTL_REQUEST_HEALTH _IO(SCM_MAGIC, 0x08) #endif /* _UAPI_OCXL_SCM_H */ -- 2.23.0