@@ -415,6 +415,68 @@ OPTIONS
--region::
Specify CXL region device name(s), or device id(s), to filter the listing.
+-L::
+--media-errors::
+ Include media-error information. The poison list is retrieved from the
+ device(s) and media_error records are added to the listing. Apply this
+ option to memdevs and regions where devices support the poison list
+ capability. "offset:" is relative to the region resource when listing
+ by region and is the absolute device DPA when listing by memdev.
+ "source:" is one of: External, Internal, Injected, Vendor Specific,
+ or Unknown, as defined in CXL Specification v3.1 Table 8-140.
+
+----
+# cxl list -m mem9 --media-errors -u
+{
+ "memdev":"mem9",
+ "pmem_size":"1024.00 MiB (1073.74 MB)",
+ "pmem_qos_class":42,
+ "ram_size":"1024.00 MiB (1073.74 MB)",
+ "ram_qos_class":42,
+ "serial":"0x5",
+ "numa_node":1,
+ "host":"cxl_mem.5",
+ "media_errors":[
+ {
+ "offset":"0x40000000",
+ "length":64,
+ "source":"Injected"
+ }
+ ]
+}
+
+# cxl list -r region5 --media-errors -u
+{
+ "region":"region5",
+ "resource":"0xf110000000",
+ "size":"2.00 GiB (2.15 GB)",
+ "type":"pmem",
+ "interleave_ways":2,
+ "interleave_granularity":4096,
+ "decode_state":"commit",
+ "media_errors":[
+ {
+ "offset":"0x1000",
+ "length":64,
+ "source":"Injected"
+ },
+ {
+ "offset":"0x2000",
+ "length":64,
+ "source":"Injected"
+ }
+ ]
+}
+----
+More complex cxl list queries can be created by using cxl list object and
+filtering options. The first example below emits all the endpoint ports
+with their decoders and memdevs with media-errors. The second example filters
+that output further by a single memdev.
+----
+# cxl list -DEM -p endpoint --media-errors
+# cxl list -DEM -p mem9 --media-errors
+----
+
-v::
--verbose::
Increase verbosity of the output. This can be specified
@@ -431,7 +493,7 @@ OPTIONS
devices with --idle.
- *-vvv*
Everything *-vv* provides, plus enable
- --health and --partition.
+ --health, --partition, --media-errors.
--debug::
If the cxl tool was built with debug enabled, turn on debug
@@ -30,6 +30,7 @@ struct cxl_filter_params {
bool fw;
bool alert_config;
bool dax;
+ bool media_errors;
int verbose;
struct log_ctx ctx;
};
@@ -88,6 +89,8 @@ static inline unsigned long cxl_filter_to_flags(struct cxl_filter_params *param)
flags |= UTIL_JSON_ALERT_CONFIG;
if (param->dax)
flags |= UTIL_JSON_DAX | UTIL_JSON_DAX_DEVS;
+ if (param->media_errors)
+ flags |= UTIL_JSON_MEDIA_ERRORS;
return flags;
}
@@ -57,6 +57,8 @@ static const struct option options[] = {
"include memory device firmware information"),
OPT_BOOLEAN('A', "alert-config", ¶m.alert_config,
"include alert configuration information"),
+ OPT_BOOLEAN('L', "media-errors", ¶m.media_errors,
+ "include media-error information "),
OPT_INCR('v', "verbose", ¶m.verbose, "increase output detail"),
#ifdef ENABLE_DEBUG
OPT_BOOLEAN(0, "debug", &debug, "debug list walk"),
@@ -121,6 +123,7 @@ int cmd_list(int argc, const char **argv, struct cxl_ctx *ctx)
param.fw = true;
param.alert_config = true;
param.dax = true;
+ param.media_errors = true;
/* fallthrough */
case 2:
param.idle = true;