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/[email protected]/ Signed-off-by: Richard Cheng <[email protected]> --- 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

