Skip to contentSkip to conversation

ndctl: Add support and test for CXL Features support

PATCH Superseded Dave Jiang 3 participants 10 messages May 9, 2025 – May 22, 2025

Subsystems (3)

v6 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Dave Jiang

author maintainer
#0 lore raw

v6 cover ndctl: Add support and test for CXL Features support

v6:
- Rename cxl-features.control.c back to fwctl.c. (Dan)
- Move features behind a meson option. (Dan)
- See individual commits for specific changes from v5.

v5:
- Add documentation for exported symbols. (Alison)
- Create 'struct cxl_fwctl' as object under cxl_memdev. (Dan)
- Make command prep common code. (Alison)
- Rename fwctl.c to cxl-features-control.c. (Alison)
- See individual commits for specific changes from v4.

v4:
- Adjust to kernel changes of input/output structs
- Fixup skip/pass/fail logic
- Added new kernel headers detection and dependency in meson.build

v3:
- Update test to use opcode instead of command id.

v2:
- Drop features device enumeration
- Add discovery of char device under memdev

The series provides support of libcxl enumerating FWCTL character device under the cxl_memdev device. It discovers the char device major and minor numbers for the CXL features device in order to allow issuing of ioctls to the device.

A unit test is added to locate cxl_memdev exported by the cxl_test kernel module and issue all the supported ioctls to the associated FWCTL char device to verify that all the ioctl paths are working as expected.

Kernel series: https://lore.kernel.org/linux-cxl/[email protected]/T/#t

Dave Jiang (4):
cxl: Add cxl_bus_get_by_provider()
cxl: Enumerate major/minor of FWCTL char device
ndctl: Add features.h from kernel UAPI cxl/test: Add test for cxl features device

 Documentation/cxl/lib/libcxl.txt |  24 ++++
 cxl/fwctl/cxl.h                  |  56 ++++++++
 cxl/fwctl/features.h             | 179 ++++++++++++++++++++++++
 cxl/fwctl/fwctl.h                | 141 +++++++++++++++++++
 cxl/lib/libcxl.c                 |  90 ++++++++++++
 cxl/lib/libcxl.sym               |   8 ++
 cxl/lib/private.h                |   6 +
 cxl/libcxl.h                     |   7 +
 meson_options.txt                |   2 +
 test/cxl-features.sh             |  31 +++++
 test/fwctl.c                     | 439 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/meson.build                 |  19 +++
 12 files changed, 1002 insertions(+)
author maintainer
#1 lore raw

PATCH v6 1/4 cxl: Add cxl_bus_get_by_provider()

Add helper function cxl_bus_get_by_provider() in order to support unit test that will utilize the API call.

---
 Documentation/cxl/lib/libcxl.txt |  2 ++
 cxl/lib/libcxl.c                 | 11 +++++++++++
 cxl/lib/libcxl.sym               |  5 +++++
 cxl/libcxl.h                     |  2 ++
 4 files changed, 20 insertions(+)
Documentation/cxl/lib/libcxl.txt +2 -0
index 40598a08b9f4..25ff406c2920 100644
@@ -215,6 +215,8 @@ the associated bus object.
 const char *cxl_bus_get_provider(struct cxl_bus *bus);
 const char *cxl_bus_get_devname(struct cxl_bus *bus);
 int cxl_bus_get_id(struct cxl_bus *bus);
+struct cxl_bus *cxl_bus_get_by_provider(struct cxl_ctx *ctx,
+					const char *provider);
 ----
 
 The provider name of a bus is a persistent name that is independent of
cxl/lib/libcxl.c +11 -0
index 63aa4ef3acdc..bab7343e8a4a 100644
@@ -3358,6 +3358,17 @@ CXL_EXPORT struct cxl_ctx *cxl_bus_get_ctx(struct cxl_bus *bus)
 	return cxl_port_get_ctx(&bus->port);
 }
 
+CXL_EXPORT struct cxl_bus *cxl_bus_get_by_provider(struct cxl_ctx *ctx,
+						   const char *provider)
+{
+	struct cxl_bus *bus;
+
+	cxl_bus_foreach(ctx, bus)
+		if (strcmp(provider, cxl_bus_get_provider(bus)) == 0)
+			return bus;
+	return NULL;
+}
+
 CXL_EXPORT void cxl_cmd_unref(struct cxl_cmd *cmd)
 {
 	if (!cmd)
cxl/lib/libcxl.sym +5 -0
index 763151fbef59..4c9760f377e6 100644
@@ -287,3 +287,8 @@ global:
 	cxl_memdev_trigger_poison_list;
 	cxl_region_trigger_poison_list;
 } LIBCXL_7;
+
+LIBCXL_9 {
+global:
+	cxl_bus_get_by_provider;
+} LIBECXL_8;
cxl/libcxl.h +2 -0
index 43c082acd836..7a32b9b65736 100644
@@ -122,6 +122,8 @@ int cxl_bus_get_id(struct cxl_bus *bus);
 struct cxl_port *cxl_bus_get_port(struct cxl_bus *bus);
 struct cxl_ctx *cxl_bus_get_ctx(struct cxl_bus *bus);
 int cxl_bus_disable_invalidate(struct cxl_bus *bus);
+struct cxl_bus *cxl_bus_get_by_provider(struct cxl_ctx *ctx,
+					const char *provider);
 
 #define cxl_bus_foreach(ctx, bus)                                              \
 	for (bus = cxl_bus_get_first(ctx); bus != NULL;                        \
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

PATCH v6 2/4 cxl: Enumerate major/minor of FWCTL char device

In reply to Dave Jiang

Add major/minor discovery for the FWCTL character device that is associated with supprting CXL Features under 'struct cxl_fwctl'. A 'struct cxl_fwctl' may be installed under cxl_memdev if CXL Features are supported and FWCTL is enabled. Add libcxl API functions to retrieve the major and minor of the FWCTL character device.

---
v6:
- Fixup documentation. (Dan)
- Remove CXL_PATH_MAX and temp buffer usages. (Dan)
- Move to after memdev->dev_buf has been allocated.

---
 Documentation/cxl/lib/libcxl.txt | 22 +++++++++
 cxl/lib/libcxl.c                 | 79 ++++++++++++++++++++++++++++++++
 cxl/lib/libcxl.sym               |  3 ++
 cxl/lib/private.h                |  6 +++
 cxl/libcxl.h                     |  5 ++
 5 files changed, 115 insertions(+)
Documentation/cxl/lib/libcxl.txt +22 -0
index 25ff406c2920..75edf0859376 100644
@@ -42,6 +42,7 @@ struct cxl_memdev *cxl_memdev_get_next(struct cxl_memdev *memdev);
 struct cxl_ctx *cxl_memdev_get_ctx(struct cxl_memdev *memdev);
 const char *cxl_memdev_get_host(struct cxl_memdev *memdev)
 struct cxl_memdev *cxl_endpoint_get_memdev(struct cxl_endpoint *endpoint);
+struct cxl_fwctl *cxl_memdev_get_fwctl(struct cxl_memdev *memdev);
 
 #define cxl_memdev_foreach(ctx, memdev) \
         for (memdev = cxl_memdev_get_first(ctx); \
@@ -59,6 +60,9 @@ specific memdev.
 The host of a memdev is the PCIe Endpoint device that registered its CXL
 capabilities with the Linux CXL core.
 
+A memdev may host a 'struct cxl_fwctl' if CXL Features are supported,
+CONFIG_CXL_FEATURES is enabled, and Firmware Control (FWCTL) is also enabled.
+
 === MEMDEV: Attributes
 ----
 int cxl_memdev_get_id(struct cxl_memdev *memdev);
@@ -185,6 +189,24 @@ device is in use. When CXL_SETPART_NEXTBOOT mode is set, the change
 in partitioning shall become the “next” configuration, to become
 active on the next device reset.
 
+FWCTL
+-----
+The object representing a Firmware Control (FWCTL) device is 'struct cxl_fwctl'.
+Library interfaces related to these devices have the prefix 'cxl_fwctl_'.
+These interfaces are associated with interacting with the FWCTL aspect of the
+memdev. And currently specifically with the CXL FWCTL character device that is
+a child of the memdev.
+
+=== FWCTL: Attributes
+----
+int cxl_fwctl_get_major(struct cxl_memdev *memdev);
+int cxl_fwctl_get_minor(struct cxl_memdev *memdev);
+----
+
+The character device node for Feature (firmware) control can be found by
+default at /dev/fwctl/fwctl%d, or created with a major / minor returned
+from cxl_memdev_get_fwctl_{major,minor}().
+
 BUSES
 -----
 The CXL Memory space is CPU and Device coherent. The address ranges that
cxl/lib/libcxl.c +79 -0

103 lines not on this page · raw message

cxl/lib/libcxl.sym +3 -0
index 4c9760f377e6..3ad0cd06e25a 100644
@@ -291,4 +291,7 @@ global:
 LIBCXL_9 {
 global:
 	cxl_bus_get_by_provider;
+	cxl_memdev_get_fwctl;
+	cxl_fwctl_get_major;
+	cxl_fwctl_get_minor;
 } LIBECXL_8;
cxl/lib/private.h +6 -0
index b6cd910e9335..7d5a1bcc14ac 100644
@@ -34,6 +34,11 @@ enum cxl_fwl_loading {
 	CXL_FWL_LOADING_START,
 };
 
+struct cxl_fwctl {
+	int major;
+	int minor;
+};
+
 struct cxl_endpoint;
 struct cxl_memdev {
 	int id, major, minor;
@@ -56,6 +61,7 @@ struct cxl_memdev {
 	unsigned long long serial;
 	struct cxl_endpoint *endpoint;
 	struct cxl_fw_loader *fwl;
+	struct cxl_fwctl *fwctl;
 };
 
 struct cxl_dport {
cxl/libcxl.h +5 -0
index 7a32b9b65736..54d97d7bb501 100644
@@ -59,6 +59,7 @@ static inline enum cxl_fwl_status cxl_fwl_status_from_ident(char *status)
 }
 
 struct cxl_memdev;
+struct cxl_fwctl;
 struct cxl_memdev *cxl_memdev_get_first(struct cxl_ctx *ctx);
 struct cxl_memdev *cxl_memdev_get_next(struct cxl_memdev *memdev);
 int cxl_memdev_get_id(struct cxl_memdev *memdev);
@@ -69,6 +70,7 @@ const char *cxl_memdev_get_host(struct cxl_memdev *memdev);
 struct cxl_bus *cxl_memdev_get_bus(struct cxl_memdev *memdev);
 int cxl_memdev_get_major(struct cxl_memdev *memdev);
 int cxl_memdev_get_minor(struct cxl_memdev *memdev);
+struct cxl_fwctl *cxl_memdev_get_fwctl(struct cxl_memdev *memdev);
 struct cxl_ctx *cxl_memdev_get_ctx(struct cxl_memdev *memdev);
 unsigned long long cxl_memdev_get_pmem_size(struct cxl_memdev *memdev);
 unsigned long long cxl_memdev_get_ram_size(struct cxl_memdev *memdev);
@@ -81,6 +83,9 @@ int cxl_memdev_update_fw(struct cxl_memdev *memdev, const char *fw_path);
 int cxl_memdev_cancel_fw_update(struct cxl_memdev *memdev);
 int cxl_memdev_wait_sanitize(struct cxl_memdev *memdev, int timeout_ms);
 
+int cxl_fwctl_get_major(struct cxl_fwctl *fwctl);
+int cxl_fwctl_get_minor(struct cxl_fwctl *fwctl);
+
 /* ABI spelling mistakes are forever */
 static inline const char *cxl_memdev_get_firmware_version(
 		struct cxl_memdev *memdev)
Signature · 1 line
2.49.0
author maintainer
#3 lore raw

PATCH v6 3/4 ndctl: Add features.h from kernel UAPI

In reply to Dave Jiang

Pull in the kernel UAPI header files from CXL Features support and FWCTL. This is needed to support building the CXL Features unit test.

---
 cxl/fwctl/cxl.h      |  56 ++++++++++++++
 cxl/fwctl/features.h | 179 +++++++++++++++++++++++++++++++++++++++++++
 cxl/fwctl/fwctl.h    | 141 ++++++++++++++++++++++++++++++++++
 3 files changed, 376 insertions(+)
 create mode 100644 cxl/fwctl/cxl.h
 create mode 100644 cxl/fwctl/features.h
 create mode 100644 cxl/fwctl/fwctl.h
cxl/fwctl/cxl.h new file +56 -0
new file mode 100644
index 000000000000..43f522f0cdcd
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * Copyright (c) 2024-2025 Intel Corporation
+ *
+ * These are definitions for the mailbox command interface of CXL subsystem.
+ */
+#ifndef _UAPI_FWCTL_CXL_H_
+#define _UAPI_FWCTL_CXL_H_
+
+#include <linux/types.h>
+#include <linux/stddef.h>
+#include <cxl/features.h>
+
+/**
+ * struct fwctl_rpc_cxl - ioctl(FWCTL_RPC) input for CXL
+ * @opcode: CXL mailbox command opcode
+ * @flags: Flags for the command (input).
+ * @op_size: Size of input payload.
+ * @reserved1: Reserved. Must be 0s.
+ * @get_sup_feats_in: Get Supported Features input
+ * @get_feat_in: Get Feature input
+ * @set_feat_in: Set Feature input
+ */
+struct fwctl_rpc_cxl {
+	__struct_group(fwctl_rpc_cxl_hdr, hdr, /* no attrs */,
+		__u32 opcode;
+		__u32 flags;
+		__u32 op_size;
+		__u32 reserved1;
+	);
+	union {
+		struct cxl_mbox_get_sup_feats_in get_sup_feats_in;
+		struct cxl_mbox_get_feat_in get_feat_in;
+		struct cxl_mbox_set_feat_in set_feat_in;
+	};
+};
+
+/**
+ * struct fwctl_rpc_cxl_out - ioctl(FWCTL_RPC) output for CXL
+ * @size: Size of the output payload
+ * @retval: Return value from device
+ * @get_sup_feats_out: Get Supported Features output
+ * @payload: raw byte stream of payload
+ */
+struct fwctl_rpc_cxl_out {
+	__struct_group(fwctl_rpc_cxl_out_hdr, hdr, /* no attrs */,
+		__u32 size;
+		__u32 retval;
+	);
+	union {
+		struct cxl_mbox_get_sup_feats_out get_sup_feats_out;
+		__DECLARE_FLEX_ARRAY(__u8, payload);
+	};
+};
+
+#endif
cxl/fwctl/features.h new file +179 -0

179 lines not on this page · raw message

cxl/fwctl/fwctl.h new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.49.0
author maintainer
#4 lore raw

PATCH v6 4/4 cxl/test: Add test for cxl features device

In reply to Dave Jiang

Add a unit test to verify the features ioctl commands. Test support added for locating a features device, retrieve and verify the supported features commands, retrieve specific feature command data, retrieve test feature data, and write and verify test feature data.

---
v6:
- Provide a fwctl option and move everything behind it. (Dan)
- Rename test app back to fwctl.c. (Dan)
- Fix spelling error. (Dan)
- Expand scope of fwctl device in documentation. (Dan)

---
 cxl/fwctl/cxl.h      |   2 +-
 meson_options.txt    |   2 +
 test/cxl-features.sh |  31 +++
 test/fwctl.c         | 439 +++++++++++++++++++++++++++++++++++++++++++
 test/meson.build     |  19 ++
 5 files changed, 492 insertions(+), 1 deletion(-)
 create mode 100755 test/cxl-features.sh
 create mode 100644 test/fwctl.c
cxl/fwctl/cxl.h +1 -1
index 43f522f0cdcd..c560b2a1181d 100644
@@ -9,7 +9,7 @@
 
 #include <linux/types.h>
 #include <linux/stddef.h>
-#include <cxl/features.h>
+#include "features.h"
 
 /**
  * struct fwctl_rpc_cxl - ioctl(FWCTL_RPC) input for CXL
meson_options.txt +2 -0
index 5c41b1abe1f1..acc19be4ff0a 100644
@@ -28,3 +28,5 @@ option('iniparserdir', type : 'string',
        description : 'Path containing the iniparser header files')
 option('modprobedatadir', type : 'string',
        description : '''${sysconfdir}/modprobe.d/''')
+option('fwctl', type : 'feature', value : 'enabled',
+  description : 'enable firmware control')
test/cxl-features.sh new file +31 -0
new file mode 100755
index 000000000000..3498fa08be53
@@ -0,0 +1,31 @@
+#!/bin/bash -Ex
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2025 Intel Corporation. All rights reserved.
+
+rc=77
+# 237 is -ENODEV
+ERR_NODEV=237
+
+. $(dirname $0)/common
+FEATURES="$TEST_PATH"/fwctl
+
+trap 'err $LINENO' ERR
+
+modprobe cxl_test
+
+test -x "$FEATURES" || do_skip "no CXL Features Contrl"
+# disable trap
+trap - $(compgen -A signal)
+"$FEATURES"
+rc=$?
+
+echo "error: $rc"
+if [ "$rc" -eq "$ERR_NODEV" ]; then
+	do_skip "no CXL FWCTL char dev"
+elif [ "$rc" -ne 0 ]; then
+	echo "fail: $LINENO" && exit 1
+fi
+
+trap 'err $LINENO' ERR
+
+_cxl_cleanup
test/fwctl.c new file +439 -0

439 lines not on this page · raw message

test/meson.build +19 -0
index d871e28e17ce..918db7e6049b 100644
@@ -17,6 +17,13 @@ ndctl_deps = libndctl_deps + [
   versiondep,
 ]
 
+libcxl_deps = [
+  cxl_dep,
+  ndctl_dep,
+  uuid,
+  kmod,
+]
+
 libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
   dependencies : libndctl_deps,
   include_directories : root_inc,
@@ -235,6 +242,18 @@ if get_option('keyutils').enabled()
   ]
 endif
 
+uuid_dep = dependency('uuid', required: false)
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif
+
 foreach t : tests
   test(t[0], t[1],
     is_parallel : false,
Signature · 1 line
2.49.0
maintainer
#5 lore raw

Re: [NDCTL PATCH v6 4/4] cxl/test: Add test for cxl features device

Quoted 13 lines · Dave Jiang

Add a unit test to verify the features ioctl commands. Test support added for locating a features device, retrieve and verify the supported features commands, retrieve specific feature command data, retrieve test feature data, and write and verify test feature data.

---
v6:
- Provide a fwctl option and move everything behind it. (Dan)
- Rename test app back to fwctl.c. (Dan)
- Fix spelling error. (Dan)
- Expand scope of fwctl device in documentation. (Dan)

Quoted 10 lines
---
 cxl/fwctl/cxl.h      |   2 +-
 meson_options.txt    |   2 +
 test/cxl-features.sh |  31 +++
 test/fwctl.c         | 439 +++++++++++++++++++++++++++++++++++++++++++
 test/meson.build     |  19 ++
 5 files changed, 492 insertions(+), 1 deletion(-)
 create mode 100755 test/cxl-features.sh
 create mode 100644 test/fwctl.c

skip -

Quoted 23 lines
test/meson.build +8 -0
index d871e28e17ce..918db7e6049b 100644
@@ -17,6 +17,13 @@ ndctl_deps = libndctl_deps + [
   versiondep,
 ]
 
+libcxl_deps = [
+  cxl_dep,
+  ndctl_dep,
+  uuid,
+  kmod,
+]
+
 libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
   dependencies : libndctl_deps,
   include_directories : root_inc,
@@ -235,6 +242,18 @@ if get_option('keyutils').enabled()
   ]
 endif
 
+uuid_dep = dependency('uuid', required: false)

test/meson.build if get_option('keyutils').enabled() · line 255

Quoted 10 lines
test/meson.build +10 -0
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif

Is the fwctl feature enabled fuss still needed now that the UAPI headers are vendored locally? Seems the test will quickly SKIP if fwctl dev not found. I kind of like the idea of seeing a 'SKIP' and knowing the test didn't run than seeing nothing at all in the test output.

Quoted 7 lines
test/meson.build +1 -0
+
 foreach t : tests
   test(t[0], t[1],
     is_parallel : false,
Signature · 1 line
2.49.0
author maintainer
#6 lore raw

Re: [NDCTL PATCH v6 4/4] cxl/test: Add test for cxl features device

Quoted 50 lines · Alison Schofield
Quoted 13 lines · Dave Jiang

Add a unit test to verify the features ioctl commands. Test support added for locating a features device, retrieve and verify the supported features commands, retrieve specific feature command data, retrieve test feature data, and write and verify test feature data.

---
v6:
- Provide a fwctl option and move everything behind it. (Dan)
- Rename test app back to fwctl.c. (Dan)
- Fix spelling error. (Dan)
- Expand scope of fwctl device in documentation. (Dan)

Quoted 10 lines
---
 cxl/fwctl/cxl.h      |   2 +-
 meson_options.txt    |   2 +
 test/cxl-features.sh |  31 +++
 test/fwctl.c         | 439 +++++++++++++++++++++++++++++++++++++++++++
 test/meson.build     |  19 ++
 5 files changed, 492 insertions(+), 1 deletion(-)
 create mode 100755 test/cxl-features.sh
 create mode 100644 test/fwctl.c

skip -

Quoted 22 lines
test/meson.build +7 -0
index d871e28e17ce..918db7e6049b 100644
@@ -17,6 +17,13 @@ ndctl_deps = libndctl_deps + [
   versiondep,
 ]
 
+libcxl_deps = [
+  cxl_dep,
+  ndctl_dep,
+  uuid,
+  kmod,
+]
+
 libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
   dependencies : libndctl_deps,
   include_directories : root_inc,
@@ -235,6 +242,18 @@ if get_option('keyutils').enabled()
   ]
 endif
 
Quoted 16 lines

test/meson.build if get_option('keyutils').enabled() · line 255

Quoted 11 lines
test/meson.build +11 -0
+uuid_dep = dependency('uuid', required: false)
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif

Is the fwctl feature enabled fuss still needed now that the UAPI headers are vendored locally? Seems the test will quickly SKIP if fwctl dev not found. I kind of like the idea of seeing a 'SKIP' and knowing the test didn't run than seeing nothing at all in the test output.

This gives the option to disable fwctl if needed. Also there is a libuuid dependency since we use uuid lib calls.

Quoted 8 lines
Quoted 8 lines
test/meson.build +1 -0
+
 foreach t : tests
   test(t[0], t[1],
     is_parallel : false,
Signature · 1 line
2.49.0
#7 lore raw

Re: [NDCTL PATCH v6 4/4] cxl/test: Add test for cxl features device

Quoted 18 lines · Dave Jiang
Quoted 17 lines

test/meson.build if get_option('keyutils').enabled() · line 255

Quoted 12 lines
test/meson.build +11 -0
+uuid_dep = dependency('uuid', required: false)
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif

Is the fwctl feature enabled fuss still needed now that the UAPI headers are vendored locally? Seems the test will quickly SKIP if fwctl dev not found. I kind of like the idea of seeing a 'SKIP' and knowing the test didn't run than seeing nothing at all in the test output.

Quoted 1 line

This gives the option to disable fwctl if needed. Also there is a libuuid dependency since we use uuid lib calls.

Is it possible to go anywhere without uuid?

fedora$ sudo dnf remove libuuid-devel
meson setup build

...
Run-time dependency libkmod found: YES 33
Run-time dependency libudev found: YES 256
Found CMake: /usr/bin/cmake (3.30.8)
Run-time dependency uuid found: NO (tried pkgconfig and cmake)

meson.build:144:0: ERROR: Dependency "uuid" not found, tried pkgconfig and cmake

meson setup --help | grep uuid  # empty
git grep get_option.*uuid       # empty
grep -C 5 uuid meson.build      # does not look optional

It looks like a hard requirement to me.

UUIDs are rarely ever "optional". It could be required only by some optional tool but that does not seem to be the case here

Fun fact: it's not even possible to remove /usr/include/uuid/uuid.h on Arch Linux, not without breaking the system.

author maintainer
#8 lore raw

Re: [NDCTL PATCH v6 4/4] cxl/test: Add test for cxl features device

Quoted 36 lines · Marc Herbert
Quoted 18 lines · Dave Jiang
Quoted 17 lines

test/meson.build if get_option('keyutils').enabled() · line 255

Quoted 12 lines
test/meson.build +11 -0
+uuid_dep = dependency('uuid', required: false)
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif

Is the fwctl feature enabled fuss still needed now that the UAPI headers are vendored locally? Seems the test will quickly SKIP if fwctl dev not found. I kind of like the idea of seeing a 'SKIP' and knowing the test didn't run than seeing nothing at all in the test output.

Quoted 1 line

This gives the option to disable fwctl if needed. Also there is a libuuid dependency since we use uuid lib calls.

Is it possible to go anywhere without uuid?

fedora$ sudo dnf remove libuuid-devel
meson setup build

...
Run-time dependency libkmod found: YES 33
Run-time dependency libudev found: YES 256
Found CMake: /usr/bin/cmake (3.30.8)
Run-time dependency uuid found: NO (tried pkgconfig and cmake)

meson.build:144:0: ERROR: Dependency "uuid" not found, tried pkgconfig and cmake

Quoted 8 lines
meson setup --help | grep uuid  # empty
git grep get_option.*uuid       # empty
grep -C 5 uuid meson.build      # does not look optional

It looks like a hard requirement to me.

UUIDs are rarely ever "optional". It could be required only by some optional tool but that does not seem to be the case here

Apparently it's not an requirement for kernel build. As my feature user header caused issues due to lack of libuuid package.

Quoted 5 lines

Fun fact: it's not even possible to remove /usr/include/uuid/uuid.h on Arch Linux, not without breaking the system.

#9 lore raw

Re: [NDCTL PATCH v6 4/4] cxl/test: Add test for cxl features device

Quoted 24 lines
Quoted 24 lines
Quoted 20 lines
Quoted 19 lines
Quoted 4 lines
test/meson.build +1 -0
+uuid_dep = dependency('uuid', required: false)

test/meson.build if get_option('keyutils').enabled() · line 255

Quoted 10 lines
test/meson.build +10 -0
+if get_option('fwctl').enabled() and uuid_dep.found()
+  fwctl = executable('fwctl', 'fwctl.c',
+    dependencies : libcxl_deps,
+    include_directories : root_inc,
+  )
+  cxl_features = find_program('cxl-features.sh')
+  tests += [
+    [ 'cxl-features.sh',        cxl_features,       'cxl'   ],
+  ]
+endif

Is the fwctl feature enabled fuss still needed now that the UAPI headers are vendored locally? Seems the test will quickly SKIP if fwctl dev not found. I kind of like the idea of seeing a 'SKIP' and knowing the test didn't run than seeing nothing at all in the test output.

Quoted 1 line

This gives the option to disable fwctl if needed. Also there is a libuuid dependency since we use uuid lib calls.

Is it possible to go anywhere without uuid?

Quoted 8 lines
Quoted 6 lines

[snip]

It looks like a hard requirement to me.

UUIDs are rarely ever "optional". It could be required only by some optional tool but that does not seem to be the case here

Apparently it's not an requirement for kernel build. As my feature user header caused issues due to lack of libuuid package.

I think I wasn't clear, let me be more explicit: I think you should drop all the code with "uuid_dep" above. It would not just simplify the code (uuid_dep.found() is always true), but it would also get rid of some (unfounded) reader's anxiety about an (im)possible system configuration where fwctl is not tested without even printing a "SKIP".

It never hurts to express dependencies, but I think it's also bad to look like you can opt out when you cannot.