From: Richard Cheng <icheng@nvidia.com>
To: dave@stgolabs.net, jic23@kernel.org, dave.jiang@intel.com,
alison.schofield@intel.com, vishal.l.verma@intel.com,
djbw@kernel.org, danwilliams@nvidia.com
Cc: iweiny@kernel.org, ming.li@zohomail.com, kobak@nvidia.com,
kaihengf@nvidia.com, linux-cxl@vger.kernel.org,
linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev,
Richard Cheng <icheng@nvidia.com>
Subject: [ndctl PATCH] test/cxl-topology.sh: test zero-sized decoders
Date: Thu, 9 Jul 2026 10:28:57 +0800 [thread overview]
Message-ID: <20260709022857.18732-1-icheng@nvidia.com> (raw)
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
reply other threads:[~2026-07-09 2:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709022857.18732-1-icheng@nvidia.com \
--to=icheng@nvidia.com \
--cc=alison.schofield@intel.com \
--cc=danwilliams@nvidia.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=kaihengf@nvidia.com \
--cc=kobak@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox