All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH V2 0/2] add support for CCI Get Alert Configuration
@ 2022-10-25 20:43 Jonathan Zhang
  2022-10-25 20:43 ` [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output Jonathan Zhang
  2022-10-25 20:43 ` [ndctl PATCH V2 2/2] cxl: display alert configuration fields Jonathan Zhang
  0 siblings, 2 replies; 8+ messages in thread
From: Jonathan Zhang @ 2022-10-25 20:43 UTC (permalink / raw)
  To: linux-cxl, vishal.l.verma, wzhang; +Cc: Jonathan Zhang

CXL spec 3.0 section 8.2.9.8.3.2 defines CCI command
Get Alert Configuration.

This patchset adds support for it.

v2:
- Change the command parameter from "alert" to "alert-config" (Vishal).
- Update the format based on clang-formt (Vishal).
- Updated the names to be consistent with the existing code (Vishal). Such as:
-- pers_mem --> pmem
-- temp --> temperature
-- drop "get_" from some function names.

Jonathan Zhang (2):
  libcxl: add accessors for Get Alert Configuration CCI output
  cxl: display alert configuration fields in list command

 Documentation/cxl/cxl-list.txt   |  33 ++++++
 Documentation/cxl/lib/libcxl.txt |   1 +
 cxl/filter.c                     |   2 +
 cxl/filter.h                     |   1 +
 cxl/json.c                       | 185 +++++++++++++++++++++++++++++++
 cxl/lib/libcxl.c                 | 163 +++++++++++++++++++++++++++
 cxl/lib/libcxl.sym               |  23 ++++
 cxl/lib/private.h                |  38 +++++++
 cxl/libcxl.h                     |  35 ++++++
 cxl/list.c                       |   6 +-
 util/json.h                      |   1 +
 11 files changed, 486 insertions(+), 2 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output
  2022-10-25 20:43 [ndctl PATCH V2 0/2] add support for CCI Get Alert Configuration Jonathan Zhang
@ 2022-10-25 20:43 ` Jonathan Zhang
  2022-10-31 18:57   ` Alison Schofield
  2022-10-25 20:43 ` [ndctl PATCH V2 2/2] cxl: display alert configuration fields Jonathan Zhang
  1 sibling, 1 reply; 8+ messages in thread
From: Jonathan Zhang @ 2022-10-25 20:43 UTC (permalink / raw)
  To: linux-cxl, vishal.l.verma, wzhang; +Cc: Jonathan Zhang, Jonathan Zhang

From: Jonathan Zhang <jonzhang@fb.com>

CXL 3.0 spec section 8.2.9.8.3.2 "Get Alert Configuration
(Opcode 4201h) defines the get-alert-config command to
retrieve the devices's critical alert and programmable
warning configurations.

Add the methods to issue the command and get the fields
defined.

Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
---
 Documentation/cxl/lib/libcxl.txt |   1 +
 cxl/lib/libcxl.c                 | 163 +++++++++++++++++++++++++++++++
 cxl/lib/libcxl.sym               |  23 +++++
 cxl/lib/private.h                |  38 +++++++
 cxl/libcxl.h                     |  35 +++++++
 5 files changed, 260 insertions(+)

diff --git a/Documentation/cxl/lib/libcxl.txt b/Documentation/cxl/lib/libcxl.txt
index fd2962a..dec3641 100644
--- a/Documentation/cxl/lib/libcxl.txt
+++ b/Documentation/cxl/lib/libcxl.txt
@@ -121,6 +121,7 @@ information this call requires root / CAP_SYS_ADMIN.
 struct cxl_cmd *cxl_cmd_new_raw(struct cxl_memdev *memdev, int opcode);
 struct cxl_cmd *cxl_cmd_new_identify(struct cxl_memdev *memdev);
 struct cxl_cmd *cxl_cmd_new_get_health_info(struct cxl_memdev *memdev);
+struct cxl_cmd *cxl_cmd_new_get_alert_config(struct cxl_memdev *memdev);
 struct cxl_cmd *cxl_cmd_new_read_label(struct cxl_memdev *memdev,
 					unsigned int offset, unsigned int length);
 struct cxl_cmd *cxl_cmd_new_write_label(struct cxl_memdev *memdev, void *buf,
diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c
index e8c5d44..c604331 100644
--- a/cxl/lib/libcxl.c
+++ b/cxl/lib/libcxl.c
@@ -3140,6 +3140,169 @@ do {									\
 	return !!(c->field & mask);					\
 } while(0)
 
+CXL_EXPORT struct cxl_cmd *
+cxl_cmd_new_get_alert_config(struct cxl_memdev *memdev)
+{
+	return cxl_cmd_new_generic(memdev, CXL_MEM_COMMAND_ID_GET_ALERT_CONFIG);
+}
+
+#define cmd_alert_get_valid_alerts_field(c, m)                                 \
+	cmd_get_field_u8_mask(c, get_alert_config, GET_ALERT_CONFIG,           \
+			      valid_alerts, m)
+
+CXL_EXPORT int
+cxl_cmd_alert_config_life_used_prog_warn_threshold_valid(struct cxl_cmd *cmd)
+{
+	cmd_alert_get_valid_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_VALID_ALERTS_LIFE_USED_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_valid_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_VALID_ALERTS_DEV_OVER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_valid_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_VALID_ALERTS_DEV_UNDER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_valid_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_VALID_ALERTS_CORR_VOLATILE_MEM_ERR_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_valid_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_VALID_ALERTS_CORR_PMEM_ERR_PROG_WARN_THRESHOLD_MASK);
+}
+
+#define cmd_alert_get_prog_alerts_field(c, m)                                  \
+	cmd_get_field_u8_mask(c, get_alert_config, GET_ALERT_CONFIG,           \
+			      programmable_alerts, m)
+
+CXL_EXPORT int
+cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(struct cxl_cmd *cmd)
+{
+	cmd_alert_get_prog_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_prog_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_DEV_OVER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_prog_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_DEV_UNDER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_prog_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_CORR_VOLATILE_MEM_ERR_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd)
+{
+	cmd_alert_get_prog_alerts_field(
+		cmd,
+		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_CORR_PMEM_ERR_PROG_WARN_THRESHOLD_MASK);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_life_used_crit_alert_threshold(struct cxl_cmd *cmd)
+{
+	cmd_get_field_u8(cmd, get_alert_config, GET_ALERT_CONFIG,
+			 life_used_crit_alert_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_life_used_prog_warn_threshold(struct cxl_cmd *cmd)
+{
+	cmd_get_field_u8(cmd, get_alert_config, GET_ALERT_CONFIG,
+			 life_used_prog_warn_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  dev_over_temperature_crit_alert_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  dev_under_temperature_crit_alert_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  dev_over_temperature_prog_warn_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  dev_under_temperature_prog_warn_threshold);
+}
+
+CXL_EXPORT int
+cxl_cmd_alert_config_get_corrected_volatile_mem_err_prog_warn_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  corrected_volatile_mem_err_prog_warn_threshold);
+}
+
+CXL_EXPORT int cxl_cmd_alert_config_get_corrected_pmem_err_prog_warn_threshold(
+	struct cxl_cmd *cmd)
+{
+	cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG,
+			  corrected_pmem_err_prog_warn_threshold);
+}
+
 CXL_EXPORT struct cxl_cmd *cxl_cmd_new_get_health_info(
 		struct cxl_memdev *memdev)
 {
diff --git a/cxl/lib/libcxl.sym b/cxl/lib/libcxl.sym
index 8bb91e0..d63fde9 100644
--- a/cxl/lib/libcxl.sym
+++ b/cxl/lib/libcxl.sym
@@ -217,3 +217,26 @@ global:
 	cxl_decoder_get_max_available_extent;
 	cxl_decoder_get_region;
 } LIBCXL_2;
+
+LIBCXL_4 {
+global:
+	cxl_cmd_new_get_alert_config;
+	cxl_cmd_alert_config_life_used_prog_warn_threshold_valid;
+	cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_valid;
+	cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_valid;
+	cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_valid;
+	cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_valid;
+	cxl_cmd_alert_config_life_used_prog_warn_threshold_writable;
+	cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_writable;
+	cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_writable;
+	cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_writable;
+	cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_writable;
+	cxl_cmd_alert_config_get_life_used_crit_alert_threshold;
+	cxl_cmd_alert_config_get_life_used_prog_warn_threshold;
+	cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold;
+	cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold;
+	cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold;
+	cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold;
+	cxl_cmd_alert_config_get_corrected_volatile_mem_err_prog_warn_threshold;
+	cxl_cmd_alert_config_get_corrected_pmem_err_prog_warn_threshold;
+} LIBCXL_3;
diff --git a/cxl/lib/private.h b/cxl/lib/private.h
index 437eade..777c6f1 100644
--- a/cxl/lib/private.h
+++ b/cxl/lib/private.h
@@ -228,6 +228,44 @@ struct cxl_cmd_get_health_info {
 	le32 pmem_errors;
 } __attribute__((packed));
 
+/* CXL 3.0 8.2.9.8.3.2 Get Alert Configuration */
+struct cxl_cmd_get_alert_config {
+	u8 valid_alerts;
+	u8 programmable_alerts;
+	u8 life_used_crit_alert_threshold;
+	u8 life_used_prog_warn_threshold;
+	le16 dev_over_temperature_crit_alert_threshold;
+	le16 dev_under_temperature_crit_alert_threshold;
+	le16 dev_over_temperature_prog_warn_threshold;
+	le16 dev_under_temperature_prog_warn_threshold;
+	le16 corrected_volatile_mem_err_prog_warn_threshold;
+	le16 corrected_pmem_err_prog_warn_threshold;
+} __attribute__((packed));
+
+/* CXL 3.0 8.2.9.8.3.2 Get Alert Configuration Byte 0 Valid Alerts */
+#define CXL_CMD_ALERT_CONFIG_VALID_ALERTS_LIFE_USED_PROG_WARN_THRESHOLD_MASK   \
+	BIT(0)
+#define CXL_CMD_ALERT_CONFIG_VALID_ALERTS_DEV_OVER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK \
+	BIT(1)
+#define CXL_CMD_ALERT_CONFIG_VALID_ALERTS_DEV_UNDER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK \
+	BIT(2)
+#define CXL_CMD_ALERT_CONFIG_VALID_ALERTS_CORR_VOLATILE_MEM_ERR_PROG_WARN_THRESHOLD_MASK \
+	BIT(3)
+#define CXL_CMD_ALERT_CONFIG_VALID_ALERTS_CORR_PMEM_ERR_PROG_WARN_THRESHOLD_MASK \
+	BIT(4)
+
+/* CXL 3.0 8.2.9.8.3.2 Get Alert Configuration Byte 1 Programmable Alerts */
+#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK    \
+	BIT(0)
+#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_DEV_OVER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK \
+	BIT(1)
+#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_DEV_UNDER_TEMPERATURE_PROG_WARN_THRESHOLD_MASK \
+	BIT(2)
+#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_CORR_VOLATILE_MEM_ERR_PROG_WARN_THRESHOLD_MASK \
+	BIT(3)
+#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_CORR_PMEM_ERR_PROG_WARN_THRESHOLD_MASK \
+	BIT(4)
+
 struct cxl_cmd_get_partition {
 	le64 active_volatile;
 	le64 active_persistent;
diff --git a/cxl/libcxl.h b/cxl/libcxl.h
index 9fe4e99..8b4b182 100644
--- a/cxl/libcxl.h
+++ b/cxl/libcxl.h
@@ -354,6 +354,41 @@ int cxl_cmd_health_info_get_temperature(struct cxl_cmd *cmd);
 int cxl_cmd_health_info_get_dirty_shutdowns(struct cxl_cmd *cmd);
 int cxl_cmd_health_info_get_volatile_errors(struct cxl_cmd *cmd);
 int cxl_cmd_health_info_get_pmem_errors(struct cxl_cmd *cmd);
+struct cxl_cmd *cxl_cmd_new_get_alert_config(struct cxl_memdev *memdev);
+int cxl_cmd_alert_config_life_used_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_valid(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_writable(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_life_used_crit_alert_threshold(struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_life_used_prog_warn_threshold(struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_corrected_volatile_mem_err_prog_warn_threshold(
+	struct cxl_cmd *cmd);
+int cxl_cmd_alert_config_get_corrected_pmem_err_prog_warn_threshold(
+	struct cxl_cmd *cmd);
 struct cxl_cmd *cxl_cmd_new_read_label(struct cxl_memdev *memdev,
 		unsigned int offset, unsigned int length);
 ssize_t cxl_cmd_read_label_get_payload(struct cxl_cmd *cmd, void *buf,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [ndctl PATCH V2 2/2] cxl: display alert configuration fields
  2022-10-25 20:43 [ndctl PATCH V2 0/2] add support for CCI Get Alert Configuration Jonathan Zhang
  2022-10-25 20:43 ` [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output Jonathan Zhang
@ 2022-10-25 20:43 ` Jonathan Zhang
  2022-10-31 18:50   ` Alison Schofield
  1 sibling, 1 reply; 8+ messages in thread
From: Jonathan Zhang @ 2022-10-25 20:43 UTC (permalink / raw)
  To: linux-cxl, vishal.l.verma, wzhang; +Cc: Jonathan Zhang, Jonathan Zhang

From: Jonathan Zhang <jonzhang@fb.com>

CXL device's critical alert and programmable warning configurations
are displayed when:
* list command is issued.
* "--alert-config" is issued.

Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
---
 Documentation/cxl/cxl-list.txt |  33 ++++++
 cxl/filter.c                   |   2 +
 cxl/filter.h                   |   1 +
 cxl/json.c                     | 185 +++++++++++++++++++++++++++++++++
 cxl/list.c                     |   6 +-
 util/json.h                    |   1 +
 6 files changed, 226 insertions(+), 2 deletions(-)

diff --git a/Documentation/cxl/cxl-list.txt b/Documentation/cxl/cxl-list.txt
index 14a2b4b..c762368 100644
--- a/Documentation/cxl/cxl-list.txt
+++ b/Documentation/cxl/cxl-list.txt
@@ -219,6 +219,39 @@ OPTIONS
   }
 ]
 ----
+-A::
+--alert::
+	Include alert configuration in the memdev listing. Example listing:
+----
+# cxl list -m mem0 -A
+[
+  {
+    "memdev":"mem0",
+    "pmem_size":0,
+    "ram_size":273535729664,
+    "alert":{
+      "life_used_prog_warn_threshold_valid":false,
+      "dev_over_temperature_prog_warn_threshold_valid":false,
+      "dev_under_temperature_prog_warn_threshold_valid":false,
+      "corrected_volatile_mem_err_prog_warn_threshold_valid":true,
+      "corrected_pmem_err_prog_warn_threshold_valid":false,
+      "life_used_prog_warn_threshold_writable":false,
+      "dev_over_temperature_prog_warn_threshold_writable":false,
+      "dev_under_temperature_prog_warn_threshold_writable":false,
+      "corrected_volatile_mem_err_prog_warn_threshold_writable":true,
+      "corrected_pmem_err_prog_warn_threshold_writable":false,
+      "life_used_crit_alert_threshold":0,
+      "life_used_prog_warn_threshold":0,
+      "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
+    },
+  }
+]
+----
 
 -B::
 --buses::
diff --git a/cxl/filter.c b/cxl/filter.c
index 56c6599..beb64de 100644
--- a/cxl/filter.c
+++ b/cxl/filter.c
@@ -686,6 +686,8 @@ static unsigned long params_to_flags(struct cxl_filter_params *param)
 		flags |= UTIL_JSON_TARGETS;
 	if (param->partition)
 		flags |= UTIL_JSON_PARTITION;
+	if (param->alert_config)
+		flags |= UTIL_JSON_ALERT_CONFIG;
 	return flags;
 }
 
diff --git a/cxl/filter.h b/cxl/filter.h
index 256df49..cd514c9 100644
--- a/cxl/filter.h
+++ b/cxl/filter.h
@@ -26,6 +26,7 @@ struct cxl_filter_params {
 	bool human;
 	bool health;
 	bool partition;
+	bool alert_config;
 	int verbose;
 	struct log_ctx ctx;
 };
diff --git a/cxl/json.c b/cxl/json.c
index 63c1751..2f74452 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -185,6 +185,185 @@ err_jobj:
 	return NULL;
 }
 
+static struct json_object *
+util_cxl_memdev_alert_config_to_json(struct cxl_memdev *memdev,
+				     unsigned long flags)
+{
+	struct json_object *jalert_config;
+	struct json_object *jobj;
+	struct cxl_cmd *cmd;
+	int rc;
+
+	jalert_config = json_object_new_object();
+	if (!jalert_config)
+		return NULL;
+	if (!memdev)
+		goto err_jobj;
+
+	cmd = cxl_cmd_new_get_alert_config(memdev);
+	if (!cmd)
+		goto err_jobj;
+
+	rc = cxl_cmd_submit(cmd);
+	if (rc < 0)
+		goto err_cmd;
+	rc = cxl_cmd_get_mbox_status(cmd);
+	if (rc != 0)
+		goto err_cmd;
+
+	rc = cxl_cmd_alert_config_life_used_prog_warn_threshold_valid(cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(jalert_config,
+				       "life_used_prog_warn_threshold_valid",
+				       jobj);
+
+	rc = cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_valid(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_over_temperature_prog_warn_threshold_valid", jobj);
+
+	rc = cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_valid(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_under_temperature_prog_warn_threshold_valid",
+			jobj);
+
+	rc = cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_valid(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"corr_volatile_mem_err_prog_warn_threshold_valid",
+			jobj);
+
+	rc = cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_valid(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"corr_pmem_err_prog_warn_threshold_valid", jobj);
+
+	rc = cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(jalert_config,
+				       "life_used_prog_warn_threshold_writable",
+				       jobj);
+
+	rc = cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_writable(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_over_temperature_prog_warn_threshold_writable",
+			jobj);
+
+	rc = cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_writable(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_under_temperature_prog_warn_threshold_writable",
+			jobj);
+
+	rc = cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_writable(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"corr_volatile_mem_err_prog_warn_threshold_writable",
+			jobj);
+
+	rc = cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_writable(
+		cmd);
+	jobj = json_object_new_boolean(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"corr_pmem_err_prog_warn_threshold_writable", jobj);
+
+	rc = cxl_cmd_alert_config_get_life_used_crit_alert_threshold(cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(jalert_config,
+				       "life_used_crit_alert_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_life_used_prog_warn_threshold(cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(jalert_config,
+				       "life_used_prog_warn_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_over_temperature_crit_alert_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_under_temperature_crit_alert_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_over_temperature_prog_warn_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"dev_under_temperature_prog_warn_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_corrected_volatile_mem_err_prog_warn_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(
+			jalert_config,
+			"corr_volatile_mem_err_prog_warn_threshold", jobj);
+
+	rc = cxl_cmd_alert_config_get_corrected_pmem_err_prog_warn_threshold(
+		cmd);
+	jobj = json_object_new_int(rc);
+	if (jobj)
+		json_object_object_add(jalert_config,
+				       "corr_pmem_err_prog_warn_threshold",
+				       jobj);
+
+	cxl_cmd_unref(cmd);
+	return jalert_config;
+
+err_cmd:
+	cxl_cmd_unref(cmd);
+err_jobj:
+	json_object_put(jalert_config);
+	return NULL;
+}
+
 /*
  * Present complete view of memdev partition by presenting fields from
  * both GET_PARTITION_INFO and IDENTIFY mailbox commands.
@@ -330,6 +509,12 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
 			json_object_object_add(jdev, "health", jobj);
 	}
 
+	if (flags & UTIL_JSON_ALERT_CONFIG) {
+		jobj = util_cxl_memdev_alert_config_to_json(memdev, flags);
+		if (jobj)
+			json_object_object_add(jdev, "alert_config", jobj);
+	}
+
 	serial = cxl_memdev_get_serial(memdev);
 	if (serial < ULLONG_MAX) {
 		jobj = util_json_object_hex(serial, flags);
diff --git a/cxl/list.c b/cxl/list.c
index 8c48fbb..5dd76b9 100644
--- a/cxl/list.c
+++ b/cxl/list.c
@@ -52,8 +52,9 @@ static const struct option options[] = {
 		    "include memory device health information"),
 	OPT_BOOLEAN('I', "partition", &param.partition,
 		    "include memory device partition information"),
-	OPT_INCR('v', "verbose", &param.verbose,
-		 "increase output detail"),
+	OPT_BOOLEAN('A', "alert-config", &param.alert_config,
+		    "include alert configuration information"),
+	OPT_INCR('v', "verbose", &param.verbose, "increase output detail"),
 #ifdef ENABLE_DEBUG
 	OPT_BOOLEAN(0, "debug", &debug, "debug list walk"),
 #endif
@@ -113,6 +114,7 @@ int cmd_list(int argc, const char **argv, struct cxl_ctx *ctx)
 	case 3:
 		param.health = true;
 		param.partition = true;
+		param.alert_config = true;
 		/* fallthrough */
 	case 2:
 		param.idle = true;
diff --git a/util/json.h b/util/json.h
index 73bb9f0..ea370df 100644
--- a/util/json.h
+++ b/util/json.h
@@ -20,6 +20,7 @@ enum util_json_flags {
 	UTIL_JSON_HEALTH	= (1 << 10),
 	UTIL_JSON_TARGETS	= (1 << 11),
 	UTIL_JSON_PARTITION	= (1 << 12),
+	UTIL_JSON_ALERT_CONFIG	= (1 << 13),
 };
 
 void util_display_json_array(FILE *f_out, struct json_object *jarray,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [ndctl PATCH V2 2/2] cxl: display alert configuration fields
  2022-10-25 20:43 ` [ndctl PATCH V2 2/2] cxl: display alert configuration fields Jonathan Zhang
@ 2022-10-31 18:50   ` Alison Schofield
  0 siblings, 0 replies; 8+ messages in thread
From: Alison Schofield @ 2022-10-31 18:50 UTC (permalink / raw)
  To: Jonathan Zhang; +Cc: linux-cxl, vishal.l.verma, wzhang, Jonathan Zhang

On Tue, Oct 25, 2022 at 01:43:20PM -0700, Jonathan Zhang wrote:
> From: Jonathan Zhang <jonzhang@fb.com>
> 
> CXL device's critical alert and programmable warning configurations
> are displayed when:
> * list command is issued.
> * "--alert-config" is issued.
> 

Hi Jonathan,

The change from 'alert' to 'alert-config' in the cmdline needs to carry
through to the JSON output and the man page example too.

Alison


> Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
> ---
>  Documentation/cxl/cxl-list.txt |  33 ++++++
>  cxl/filter.c                   |   2 +
>  cxl/filter.h                   |   1 +
>  cxl/json.c                     | 185 +++++++++++++++++++++++++++++++++
>  cxl/list.c                     |   6 +-
>  util/json.h                    |   1 +
>  6 files changed, 226 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/cxl/cxl-list.txt b/Documentation/cxl/cxl-list.txt
> index 14a2b4b..c762368 100644
> --- a/Documentation/cxl/cxl-list.txt
> +++ b/Documentation/cxl/cxl-list.txt
> @@ -219,6 +219,39 @@ OPTIONS
>    }
>  ]
>  ----
> +-A::
> +--alert::
> +	Include alert configuration in the memdev listing. Example listing:
> +----
> +# cxl list -m mem0 -A
> +[
> +  {
> +    "memdev":"mem0",
> +    "pmem_size":0,
> +    "ram_size":273535729664,
> +    "alert":{
> +      "life_used_prog_warn_threshold_valid":false,
> +      "dev_over_temperature_prog_warn_threshold_valid":false,
> +      "dev_under_temperature_prog_warn_threshold_valid":false,
> +      "corrected_volatile_mem_err_prog_warn_threshold_valid":true,
> +      "corrected_pmem_err_prog_warn_threshold_valid":false,
> +      "life_used_prog_warn_threshold_writable":false,
> +      "dev_over_temperature_prog_warn_threshold_writable":false,
> +      "dev_under_temperature_prog_warn_threshold_writable":false,
> +      "corrected_volatile_mem_err_prog_warn_threshold_writable":true,
> +      "corrected_pmem_err_prog_warn_threshold_writable":false,
> +      "life_used_crit_alert_threshold":0,
> +      "life_used_prog_warn_threshold":0,
> +      "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
> +    },
> +  }
> +]
> +----
>  
>  -B::
>  --buses::
> diff --git a/cxl/filter.c b/cxl/filter.c
> index 56c6599..beb64de 100644
> --- a/cxl/filter.c
> +++ b/cxl/filter.c
> @@ -686,6 +686,8 @@ static unsigned long params_to_flags(struct cxl_filter_params *param)
>  		flags |= UTIL_JSON_TARGETS;
>  	if (param->partition)
>  		flags |= UTIL_JSON_PARTITION;
> +	if (param->alert_config)
> +		flags |= UTIL_JSON_ALERT_CONFIG;
>  	return flags;
>  }
>  
> diff --git a/cxl/filter.h b/cxl/filter.h
> index 256df49..cd514c9 100644
> --- a/cxl/filter.h
> +++ b/cxl/filter.h
> @@ -26,6 +26,7 @@ struct cxl_filter_params {
>  	bool human;
>  	bool health;
>  	bool partition;
> +	bool alert_config;
>  	int verbose;
>  	struct log_ctx ctx;
>  };
> diff --git a/cxl/json.c b/cxl/json.c
> index 63c1751..2f74452 100644
> --- a/cxl/json.c
> +++ b/cxl/json.c
> @@ -185,6 +185,185 @@ err_jobj:
>  	return NULL;
>  }
>  
> +static struct json_object *
> +util_cxl_memdev_alert_config_to_json(struct cxl_memdev *memdev,
> +				     unsigned long flags)
> +{
> +	struct json_object *jalert_config;
> +	struct json_object *jobj;
> +	struct cxl_cmd *cmd;
> +	int rc;
> +
> +	jalert_config = json_object_new_object();
> +	if (!jalert_config)
> +		return NULL;
> +	if (!memdev)
> +		goto err_jobj;
> +
> +	cmd = cxl_cmd_new_get_alert_config(memdev);
> +	if (!cmd)
> +		goto err_jobj;
> +
> +	rc = cxl_cmd_submit(cmd);
> +	if (rc < 0)
> +		goto err_cmd;
> +	rc = cxl_cmd_get_mbox_status(cmd);
> +	if (rc != 0)
> +		goto err_cmd;
> +
> +	rc = cxl_cmd_alert_config_life_used_prog_warn_threshold_valid(cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(jalert_config,
> +				       "life_used_prog_warn_threshold_valid",
> +				       jobj);
> +
> +	rc = cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_valid(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_over_temperature_prog_warn_threshold_valid", jobj);
> +
> +	rc = cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_valid(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_under_temperature_prog_warn_threshold_valid",
> +			jobj);
> +
> +	rc = cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_valid(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"corr_volatile_mem_err_prog_warn_threshold_valid",
> +			jobj);
> +
> +	rc = cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_valid(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"corr_pmem_err_prog_warn_threshold_valid", jobj);
> +
> +	rc = cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(jalert_config,
> +				       "life_used_prog_warn_threshold_writable",
> +				       jobj);
> +
> +	rc = cxl_cmd_alert_config_dev_over_temperature_prog_warn_threshold_writable(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_over_temperature_prog_warn_threshold_writable",
> +			jobj);
> +
> +	rc = cxl_cmd_alert_config_dev_under_temperature_prog_warn_threshold_writable(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_under_temperature_prog_warn_threshold_writable",
> +			jobj);
> +
> +	rc = cxl_cmd_alert_config_corrected_volatile_mem_err_prog_warn_threshold_writable(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"corr_volatile_mem_err_prog_warn_threshold_writable",
> +			jobj);
> +
> +	rc = cxl_cmd_alert_config_corrected_pmem_err_prog_warn_threshold_writable(
> +		cmd);
> +	jobj = json_object_new_boolean(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"corr_pmem_err_prog_warn_threshold_writable", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_life_used_crit_alert_threshold(cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(jalert_config,
> +				       "life_used_crit_alert_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_life_used_prog_warn_threshold(cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(jalert_config,
> +				       "life_used_prog_warn_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_over_temperature_crit_alert_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_under_temperature_crit_alert_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_over_temperature_prog_warn_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"dev_under_temperature_prog_warn_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_corrected_volatile_mem_err_prog_warn_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(
> +			jalert_config,
> +			"corr_volatile_mem_err_prog_warn_threshold", jobj);
> +
> +	rc = cxl_cmd_alert_config_get_corrected_pmem_err_prog_warn_threshold(
> +		cmd);
> +	jobj = json_object_new_int(rc);
> +	if (jobj)
> +		json_object_object_add(jalert_config,
> +				       "corr_pmem_err_prog_warn_threshold",
> +				       jobj);
> +
> +	cxl_cmd_unref(cmd);
> +	return jalert_config;
> +
> +err_cmd:
> +	cxl_cmd_unref(cmd);
> +err_jobj:
> +	json_object_put(jalert_config);
> +	return NULL;
> +}
> +
>  /*
>   * Present complete view of memdev partition by presenting fields from
>   * both GET_PARTITION_INFO and IDENTIFY mailbox commands.
> @@ -330,6 +509,12 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
>  			json_object_object_add(jdev, "health", jobj);
>  	}
>  
> +	if (flags & UTIL_JSON_ALERT_CONFIG) {
> +		jobj = util_cxl_memdev_alert_config_to_json(memdev, flags);
> +		if (jobj)
> +			json_object_object_add(jdev, "alert_config", jobj);
> +	}
> +
>  	serial = cxl_memdev_get_serial(memdev);
>  	if (serial < ULLONG_MAX) {
>  		jobj = util_json_object_hex(serial, flags);
> diff --git a/cxl/list.c b/cxl/list.c
> index 8c48fbb..5dd76b9 100644
> --- a/cxl/list.c
> +++ b/cxl/list.c
> @@ -52,8 +52,9 @@ static const struct option options[] = {
>  		    "include memory device health information"),
>  	OPT_BOOLEAN('I', "partition", &param.partition,
>  		    "include memory device partition information"),
> -	OPT_INCR('v', "verbose", &param.verbose,
> -		 "increase output detail"),
> +	OPT_BOOLEAN('A', "alert-config", &param.alert_config,
> +		    "include alert configuration information"),
> +	OPT_INCR('v', "verbose", &param.verbose, "increase output detail"),
>  #ifdef ENABLE_DEBUG
>  	OPT_BOOLEAN(0, "debug", &debug, "debug list walk"),
>  #endif
> @@ -113,6 +114,7 @@ int cmd_list(int argc, const char **argv, struct cxl_ctx *ctx)
>  	case 3:
>  		param.health = true;
>  		param.partition = true;
> +		param.alert_config = true;
>  		/* fallthrough */
>  	case 2:
>  		param.idle = true;
> diff --git a/util/json.h b/util/json.h
> index 73bb9f0..ea370df 100644
> --- a/util/json.h
> +++ b/util/json.h
> @@ -20,6 +20,7 @@ enum util_json_flags {
>  	UTIL_JSON_HEALTH	= (1 << 10),
>  	UTIL_JSON_TARGETS	= (1 << 11),
>  	UTIL_JSON_PARTITION	= (1 << 12),
> +	UTIL_JSON_ALERT_CONFIG	= (1 << 13),
>  };
>  
>  void util_display_json_array(FILE *f_out, struct json_object *jarray,
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output
  2022-10-25 20:43 ` [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output Jonathan Zhang
@ 2022-10-31 18:57   ` Alison Schofield
  2022-10-31 23:46     ` Jonathan Zhang (Infra)
  0 siblings, 1 reply; 8+ messages in thread
From: Alison Schofield @ 2022-10-31 18:57 UTC (permalink / raw)
  To: Jonathan Zhang; +Cc: linux-cxl, vishal.l.verma, wzhang, Jonathan Zhang

On Tue, Oct 25, 2022 at 01:43:19PM -0700, Jonathan Zhang wrote:
> From: Jonathan Zhang <jonzhang@fb.com>
> 
> CXL 3.0 spec section 8.2.9.8.3.2 "Get Alert Configuration
> (Opcode 4201h) defines the get-alert-config command to
> retrieve the devices's critical alert and programmable
> warning configurations.
> 
> Add the methods to issue the command and get the fields
> defined.
> 
> Signed-off-by: Jonathan Zhang <jonzhang@meta.com>

Consistency in typos are trickier to detect ;)

> +CXL_EXPORT int
> +cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(struct cxl_cmd *cmd)
> +{
> +	cmd_alert_get_prog_alerts_field(
> +		cmd,
> +		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK);
> +}
> +

--snip--

> +#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK    \
> +	BIT(0)

--snip--
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output
  2022-10-31 18:57   ` Alison Schofield
@ 2022-10-31 23:46     ` Jonathan Zhang (Infra)
  2022-11-01  0:57       ` Alison Schofield
  0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Zhang (Infra) @ 2022-10-31 23:46 UTC (permalink / raw)
  To: Alison Schofield
  Cc: Jonathan Zhang (Infra), linux-cxl, vishal.l.verma, Wei Zhang



> On Oct 31, 2022, at 11:57 AM, Alison Schofield <alison.schofield@intel.com> wrote:
> 
> > 
> On Tue, Oct 25, 2022 at 01:43:19PM -0700, Jonathan Zhang wrote:
>> From: Jonathan Zhang <jonzhang@fb.com>
>> 
>> CXL 3.0 spec section 8.2.9.8.3.2 "Get Alert Configuration
>> (Opcode 4201h) defines the get-alert-config command to
>> retrieve the devices's critical alert and programmable
>> warning configurations.
>> 
>> Add the methods to issue the command and get the fields
>> defined.
>> 
>> Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
> 
> Consistency in typos are trickier to detect ;)
> 
>> +CXL_EXPORT int
>> +cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(struct cxl_cmd *cmd)
>> +{
>> +	cmd_alert_get_prog_alerts_field(
>> +		cmd,
>> +		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK);
>> +}
>> +
> 
> --snip--
> 
>> +#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK    \
>> +	BIT(0)
> 
> --snip--
>> 
Thanks for the review. For the above snippets, I do not see any consistency issue though.
To save space, I have been using following abbreviations: 
* prog, short for programmable
* err, short for error
* warn, short for warning
* crit, short for critical
* dev, short for device
* config, short for configuration

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output
  2022-10-31 23:46     ` Jonathan Zhang (Infra)
@ 2022-11-01  0:57       ` Alison Schofield
  2022-11-01  1:24         ` Jonathan Zhang (Infra)
  0 siblings, 1 reply; 8+ messages in thread
From: Alison Schofield @ 2022-11-01  0:57 UTC (permalink / raw)
  To: Jonathan Zhang (Infra); +Cc: linux-cxl, vishal.l.verma, Wei Zhang

On Mon, Oct 31, 2022 at 11:46:56PM +0000, Jonathan Zhang (Infra) wrote:
> 
> 
> > On Oct 31, 2022, at 11:57 AM, Alison Schofield <alison.schofield@intel.com> wrote:
> > 
> > > 
> > On Tue, Oct 25, 2022 at 01:43:19PM -0700, Jonathan Zhang wrote:
> >> From: Jonathan Zhang <jonzhang@fb.com>
> >> 
> >> CXL 3.0 spec section 8.2.9.8.3.2 "Get Alert Configuration
> >> (Opcode 4201h) defines the get-alert-config command to
> >> retrieve the devices's critical alert and programmable
> >> warning configurations.
> >> 
> >> Add the methods to issue the command and get the fields
> >> defined.
> >> 
> >> Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
> > 
> > Consistency in typos are trickier to detect ;)
> > 
> >> +CXL_EXPORT int
> >> +cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(struct cxl_cmd *cmd)
> >> +{
> >> +	cmd_alert_get_prog_alerts_field(
> >> +		cmd,
> >> +		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK);
                                                 ^^ LIFE ?

> >> +}
> >> +
> > 
> > --snip--
> > 
> >> +#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK    \
> >> +	BIT(0)

                                               ^^ LIFE ?

> > 
> > --snip--
> >> 
> Thanks for the review. For the above snippets, I do not see any consistency issue though.

I'm sorry for being cryptic in my review comment.
Alison

> To save space, I have been using following abbreviations: 
> * prog, short for programmable
> * err, short for error
> * warn, short for warning
> * crit, short for critical
> * dev, short for device
> * config, short for configuration

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output
  2022-11-01  0:57       ` Alison Schofield
@ 2022-11-01  1:24         ` Jonathan Zhang (Infra)
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Zhang (Infra) @ 2022-11-01  1:24 UTC (permalink / raw)
  To: Alison Schofield
  Cc: Jonathan Zhang (Infra), linux-cxl, vishal.l.verma, Wei Zhang



> On Oct 31, 2022, at 5:57 PM, Alison Schofield <alison.schofield@intel.com> wrote:
> 
> > 
> On Mon, Oct 31, 2022 at 11:46:56PM +0000, Jonathan Zhang (Infra) wrote:
>> 
>> 
>>> On Oct 31, 2022, at 11:57 AM, Alison Schofield <alison.schofield@intel.com> wrote:
>>> 
>>>> 
>>> On Tue, Oct 25, 2022 at 01:43:19PM -0700, Jonathan Zhang wrote:
>>>> From: Jonathan Zhang <jonzhang@fb.com>
>>>> 
>>>> CXL 3.0 spec section 8.2.9.8.3.2 "Get Alert Configuration
>>>> (Opcode 4201h) defines the get-alert-config command to
>>>> retrieve the devices's critical alert and programmable
>>>> warning configurations.
>>>> 
>>>> Add the methods to issue the command and get the fields
>>>> defined.
>>>> 
>>>> Signed-off-by: Jonathan Zhang <jonzhang@meta.com>
>>> 
>>> Consistency in typos are trickier to detect ;)
>>> 
>>>> +CXL_EXPORT int
>>>> +cxl_cmd_alert_config_life_used_prog_warn_threshold_writable(struct cxl_cmd *cmd)
>>>> +{
>>>> +	cmd_alert_get_prog_alerts_field(
>>>> +		cmd,
>>>> +		CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK);
>                                                 ^^ LIFE ?
> 
>>>> +}
>>>> +
>>> 
>>> --snip--
>>> 
>>>> +#define CXL_CMD_ALERT_CONFIG_PROG_ALERTS_LIEF_USED_PROG_WARN_THRESHOLD_MASK    \
>>>> +	BIT(0)
> 
>                                               ^^ LIFE ?
> 
>>> 
>>> --snip--
>>>> 
>> Thanks for the review. For the above snippets, I do not see any consistency issue though.
> 
> I'm sorry for being cryptic in my review comment.
> Alison
Hi Alison, no worries. I do appreciate your help!

> 
>> To save space, I have been using following abbreviations: 
>> * prog, short for programmable
>> * err, short for error
>> * warn, short for warning
>> * crit, short for critical
>> * dev, short for device
>> * config, short for configuration


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-01  1:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 20:43 [ndctl PATCH V2 0/2] add support for CCI Get Alert Configuration Jonathan Zhang
2022-10-25 20:43 ` [ndctl PATCH V2 1/2] libcxl: add accessors for Get Alert Configuration CCI output Jonathan Zhang
2022-10-31 18:57   ` Alison Schofield
2022-10-31 23:46     ` Jonathan Zhang (Infra)
2022-11-01  0:57       ` Alison Schofield
2022-11-01  1:24         ` Jonathan Zhang (Infra)
2022-10-25 20:43 ` [ndctl PATCH V2 2/2] cxl: display alert configuration fields Jonathan Zhang
2022-10-31 18:50   ` Alison Schofield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.