[ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders

Alison Schofield <[email protected]> Thu, 30 Jul 2026 18:55:20 -0700
Newsgroups dev.linux.lists.nvdimm,org.kernel.vger.linux-cxl
Message-ID <018112d2f7890f3a3f38cc96aee5cf98cf5f3a9d.1785462417.git.alison.schofield@intel.com>
'cxl list' hides zero-sized decoders unless --idle is given, assuming
they are unconfigured idle slots. That assumption does not hold for
locked HDM decoders, which may legitimately report size 0 while being
committed by firmware.

Do not suppress locked zero-sized decoders from the default listing.
Combined with the "locked" field in the decoder JSON, they are visible
and distinguishable from idle, unlocked slots that remain hidden
without --idle.

Signed-off-by: Alison Schofield <[email protected]>
---
 cxl/filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cxl/filter.c b/cxl/filter.c
index 5d634d3b2512..e6d45ac7b9e6 100644
--- a/cxl/filter.c
+++ b/cxl/filter.c
@@ -847,7 +847,8 @@ static void walk_decoders(struct cxl_port *port, struct cxl_filter_params *p,
 		if (!util_cxl_decoder_filter_by_region(decoder,
 						       p->region_filter))
 			goto walk_children;
-		if (!p->idle && cxl_decoder_get_size(decoder) == 0)
+		if (!p->idle && cxl_decoder_get_size(decoder) == 0 &&
+		    !cxl_decoder_is_locked(decoder))
 			continue;
 		jdecoder = util_cxl_decoder_to_json(decoder, flags);
 		if (!decoder) {
-- 
2.37.3