@@ -18,6 +18,8 @@ OPTIONS
<memory device(s)>::
include::memdev-option.txt[]
+include::bus-option.txt[]
+
-f::
--force::
DANGEROUS: Override the safety measure that blocks attempts to disable
@@ -23,6 +23,8 @@ OPTIONS
<memory device(s)>::
include::memdev-option.txt[]
+include::bus-option.txt[]
+
-v::
Turn on verbose debug messages in the library (if libcxl was built with
logging and debug enabled).
@@ -24,6 +24,8 @@ OPTIONS
<memory device(s)>::
include::memdev-option.txt[]
+include::bus-option.txt[]
+
-d::
--decoder::
Specify the decoder to free. The CXL specification
@@ -20,6 +20,8 @@ OPTIONS
-------
include::labels-options.txt[]
+include::bus-option.txt[]
+
-o::
--output::
output file
@@ -24,6 +24,8 @@ OPTIONS
<memory device(s)>::
include::memdev-option.txt[]
+include::bus-option.txt[]
+
-d::
--decoder::
Specify the decoder to attempt the allocation. The CXL specification
@@ -35,6 +35,8 @@ OPTIONS
<memory device(s)>::
include::memdev-option.txt[]
+include::bus-option.txt[]
+
-t::
--type=::
Type of partition, 'pmem' or 'ram' (volatile), to modify.
@@ -21,6 +21,9 @@ not allow write access to the device's label data area.
OPTIONS
-------
include::labels-options.txt[]
+
+include::bus-option.txt[]
+
-i::
--input::
input file
@@ -36,6 +36,8 @@ struct cxl_filter_params {
struct cxl_memdev *util_cxl_memdev_filter(struct cxl_memdev *memdev,
const char *__ident,
const char *serials);
+struct cxl_memdev *util_cxl_memdev_filter_by_bus(struct cxl_memdev *memdev,
+ const char *__ident);
struct cxl_port *util_cxl_port_filter_by_memdev(struct cxl_port *port,
const char *ident,
const char *serial);
@@ -243,6 +243,25 @@ static struct cxl_port *util_cxl_port_filter_by_bus(struct cxl_port *port,
return NULL;
}
+struct cxl_memdev *util_cxl_memdev_filter_by_bus(struct cxl_memdev *memdev,
+ const char *__ident)
+{
+ struct cxl_ctx *ctx = cxl_memdev_get_ctx(memdev);
+ struct cxl_bus *bus;
+
+ if (!__ident)
+ return memdev;
+
+ cxl_bus_foreach(ctx, bus) {
+ if (!util_cxl_bus_filter(bus, __ident))
+ continue;
+ if (bus == cxl_memdev_get_bus(memdev))
+ return memdev;
+ }
+
+ return NULL;
+}
+
static struct cxl_decoder *
util_cxl_decoder_filter_by_bus(struct cxl_decoder *decoder, const char *__ident)
{
@@ -44,6 +44,8 @@ enum cxl_setpart_type {
};
#define BASE_OPTIONS() \
+OPT_STRING('b', "bus", ¶m.bus, "bus name", \
+ "Limit operation to the specified bus"), \
OPT_BOOLEAN('v',"verbose", ¶m.verbose, "turn on debug"), \
OPT_BOOLEAN('S', "serial", ¶m.serial, "use serial numbers to id memdevs")
@@ -753,6 +755,8 @@ static int memdev_action(int argc, const char **argv, struct cxl_ctx *ctx,
if (!util_cxl_memdev_filter(memdev, memdev_filter,
serial_filter))
continue;
+ if (!util_cxl_memdev_filter_by_bus(memdev, param.bus))
+ continue;
found = true;
if (action == action_write) {