* [ndctl PATCH] test/cxl-topology.sh: test zero-sized decoders
@ 2026-07-09 2:28 Richard Cheng
0 siblings, 0 replies; only message in thread
From: Richard Cheng @ 2026-07-09 2:28 UTC (permalink / raw)
To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
danwilliams
Cc: iweiny, ming.li, kobak, kaihengf, linux-cxl, linux-kernel, nvdimm,
Richard Cheng
The kernel series [1] teaches the CXL core to enumerate committed
zero-sized HDM decoders and adds the opt-in mock_zero_size_decoders
cxl_test topology. Since the param defaults off, the existing ndctl
suite never exercises that path, leaving the series without userspace
regression coverage.
After the existing default-topology checks, detect the module param with
modinfo. When available, reload cxl_test with mock_zero_size_decoders=1,
discover both endpoint decoders through the auto-region mapping, and
verify that decoder IDs 1 and 2 exist with size 0 and locked set.
Unsupported kernels retain the existing baseline coverage.
Tested on arm64. The focused test passed. The full CXL suite passed and 1
unrelated cxl-security skip. Four zero-sized endpoint decoders were
validated, cxl_test unloaded cleanly, and no relevant dmesg errors were
shown.
[1]:
https://lore.kernel.org/linux-cxl/20260708104024.68029-1-icheng@nvidia.com/
Signed-off-by: Richard Cheng <icheng@nvidia.com>
---
test/cxl-topology.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
index 170c9ca..3345cd8 100644
--- a/test/cxl-topology.sh
+++ b/test/cxl-topology.sh
@@ -276,3 +276,35 @@ $CXL disable-bus $root -f
check_dmesg "$LINENO"
modprobe -r cxl_test
+
+if ! modinfo cxl_test | grep -q '^parm:.*mock_zero_size_decoders'; then
+ exit 0
+fi
+
+modprobe cxl_test mock_zero_size_decoders=1
+
+region_json=$("$CXL" list -b cxl_test -R -T -u)
+[ -n "$region_json" ] || err "$LINENO"
+mapfile -t endpoint_decoders < <(
+ jq -r '.mappings[]?.decoder // empty' <<<"$region_json"
+)
+((${#endpoint_decoders[@]} == 2)) || err "$LINENO"
+
+for decoder in "${endpoint_decoders[@]}"; do
+ [[ "$decoder" == *.0 ]] || err "$LINENO"
+
+ for id in 1 2; do
+ empty_decoder="${decoder%.*}.$id"
+ decoder_path="/sys/bus/cxl/devices/$empty_decoder"
+ [ -d "$decoder_path" ] || err "$LINENO"
+
+ size=$(cat "$decoder_path/size")
+ locked=$(cat "$decoder_path/locked")
+ ((size == 0)) || err "$LINENO"
+ ((locked == 1)) || err "$LINENO"
+ done
+done
+
+check_dmesg "$LINENO"
+
+modprobe -r cxl_test
base-commit: 15e932c4e1318a9608ad9b799ad83a32a8b5970d
prerequisite-patch-id: 96641092f7122fa9b6a894ab56f71c4d50c02650
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-09 2:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 2:28 [ndctl PATCH] test/cxl-topology.sh: test zero-sized decoders Richard Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox