* [ndctl PATCH 1/2] cxl/list: emit decoder locked status
@ 2026-07-31 1:55 Alison Schofield
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Alison Schofield @ 2026-07-31 1:55 UTC (permalink / raw)
To: nvdimm, Richard Cheng; +Cc: Alison Schofield, linux-cxl
A committed zero-sized HDM decoder reports size 0, so 'cxl list'
renders it identically to an ordinary unconfigured decoder ("state":
"disabled"). The locked attribute that distinguishes firmware-committed
decoders is not included in the JSON output.
The library already reads the decoder's locked attribute and exports
cxl_decoder_is_locked(); it was simply never emitted. Add a "locked"
field to the decoder JSON, following the emit-only-when-true idiom used
by the capability flags so existing output is unchanged for the common
unlocked case.
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
cxl/json.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cxl/json.c b/cxl/json.c
index a92548828582..2214f7027d91 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -870,6 +870,12 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
json_object_object_add(jdecoder, "state", jobj);
}
+ if (cxl_decoder_is_locked(decoder)) {
+ jobj = json_object_new_boolean(true);
+ if (jobj)
+ json_object_object_add(jdecoder, "locked", jobj);
+ }
+
if (cxl_port_is_endpoint(port)) {
enum cxl_decoder_mode mode = cxl_decoder_get_mode(decoder);
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders
2026-07-31 1:55 [ndctl PATCH 1/2] cxl/list: emit decoder locked status Alison Schofield
@ 2026-07-31 1:55 ` Alison Schofield
2026-07-31 15:40 ` Dave Jiang
2026-10-24 2:55 ` Alison Schofield
2026-07-31 15:40 ` [ndctl PATCH 1/2] cxl/list: emit decoder locked status Dave Jiang
2026-10-24 2:56 ` Alison Schofield
2 siblings, 2 replies; 9+ messages in thread
From: Alison Schofield @ 2026-07-31 1:55 UTC (permalink / raw)
To: nvdimm, Richard Cheng; +Cc: Alison Schofield, linux-cxl
'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 <alison.schofield@intel.com>
---
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 1/2] cxl/list: emit decoder locked status
2026-07-31 1:55 [ndctl PATCH 1/2] cxl/list: emit decoder locked status Alison Schofield
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
@ 2026-07-31 15:40 ` Dave Jiang
2026-08-07 5:07 ` Richard Cheng
2026-10-24 2:56 ` Alison Schofield
2 siblings, 1 reply; 9+ messages in thread
From: Dave Jiang @ 2026-07-31 15:40 UTC (permalink / raw)
To: Alison Schofield, nvdimm, Richard Cheng; +Cc: linux-cxl
On 7/30/26 6:55 PM, Alison Schofield wrote:
> A committed zero-sized HDM decoder reports size 0, so 'cxl list'
> renders it identically to an ordinary unconfigured decoder ("state":
> "disabled"). The locked attribute that distinguishes firmware-committed
> decoders is not included in the JSON output.
>
> The library already reads the decoder's locked attribute and exports
> cxl_decoder_is_locked(); it was simply never emitted. Add a "locked"
> field to the decoder JSON, following the emit-only-when-true idiom used
> by the capability flags so existing output is unchanged for the common
> unlocked case.
>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> cxl/json.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/cxl/json.c b/cxl/json.c
> index a92548828582..2214f7027d91 100644
> --- a/cxl/json.c
> +++ b/cxl/json.c
> @@ -870,6 +870,12 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> json_object_object_add(jdecoder, "state", jobj);
> }
>
> + if (cxl_decoder_is_locked(decoder)) {
> + jobj = json_object_new_boolean(true);
> + if (jobj)
> + json_object_object_add(jdecoder, "locked", jobj);
> + }
> +
> if (cxl_port_is_endpoint(port)) {
> enum cxl_decoder_mode mode = cxl_decoder_get_mode(decoder);
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
@ 2026-07-31 15:40 ` Dave Jiang
2026-08-07 5:10 ` Richard Cheng
2026-10-24 2:55 ` Alison Schofield
1 sibling, 1 reply; 9+ messages in thread
From: Dave Jiang @ 2026-07-31 15:40 UTC (permalink / raw)
To: Alison Schofield, nvdimm, Richard Cheng; +Cc: linux-cxl
On 7/30/26 6:55 PM, Alison Schofield wrote:
> '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 <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 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) {
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 1/2] cxl/list: emit decoder locked status
2026-07-31 15:40 ` [ndctl PATCH 1/2] cxl/list: emit decoder locked status Dave Jiang
@ 2026-08-07 5:07 ` Richard Cheng
0 siblings, 0 replies; 9+ messages in thread
From: Richard Cheng @ 2026-08-07 5:07 UTC (permalink / raw)
To: Dave Jiang; +Cc: Alison Schofield, nvdimm, linux-cxl
On Fri, Jul 31, 2026 at 08:40:08AM +0800, Dave Jiang wrote:
>
>
> On 7/30/26 6:55 PM, Alison Schofield wrote:
> > A committed zero-sized HDM decoder reports size 0, so 'cxl list'
> > renders it identically to an ordinary unconfigured decoder ("state":
> > "disabled"). The locked attribute that distinguishes firmware-committed
> > decoders is not included in the JSON output.
> >
> > The library already reads the decoder's locked attribute and exports
> > cxl_decoder_is_locked(); it was simply never emitted. Add a "locked"
> > field to the decoder JSON, following the emit-only-when-true idiom used
> > by the capability flags so existing output is unchanged for the common
> > unlocked case.
> >
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>
Thanks alot !
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Best regards,
Richard Cheng.
> > ---
> > cxl/json.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/cxl/json.c b/cxl/json.c
> > index a92548828582..2214f7027d91 100644
> > --- a/cxl/json.c
> > +++ b/cxl/json.c
> > @@ -870,6 +870,12 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> > json_object_object_add(jdecoder, "state", jobj);
> > }
> >
> > + if (cxl_decoder_is_locked(decoder)) {
> > + jobj = json_object_new_boolean(true);
> > + if (jobj)
> > + json_object_object_add(jdecoder, "locked", jobj);
> > + }
> > +
> > if (cxl_port_is_endpoint(port)) {
> > enum cxl_decoder_mode mode = cxl_decoder_get_mode(decoder);
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders
2026-07-31 15:40 ` Dave Jiang
@ 2026-08-07 5:10 ` Richard Cheng
2026-10-24 2:29 ` Alison Schofield
0 siblings, 1 reply; 9+ messages in thread
From: Richard Cheng @ 2026-08-07 5:10 UTC (permalink / raw)
To: Dave Jiang; +Cc: Alison Schofield, nvdimm, linux-cxl
On Fri, Jul 31, 2026 at 08:40:24AM +0800, Dave Jiang wrote:
>
>
> On 7/30/26 6:55 PM, Alison Schofield wrote:
> > '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.
> >
Hi Alison,
patch looks good to me, just one small question,
what if the zero size decoder is programmed by userspace, not from FW.
in which case cxl_decoder_is_locked() won't return true, can we handle that situation ?
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Best regards,
Richard Cheng.
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>
> > ---
> > 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) {
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders
2026-08-07 5:10 ` Richard Cheng
@ 2026-10-24 2:29 ` Alison Schofield
0 siblings, 0 replies; 9+ messages in thread
From: Alison Schofield @ 2026-10-24 2:29 UTC (permalink / raw)
To: Richard Cheng; +Cc: Dave Jiang, nvdimm, linux-cxl
On Fri, Aug 07, 2026 at 01:10:47PM +0800, Richard Cheng wrote:
> On Fri, Jul 31, 2026 at 08:40:24AM +0800, Dave Jiang wrote:
> >
> >
> > On 7/30/26 6:55 PM, Alison Schofield wrote:
> > > '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.
> > >
>
> Hi Alison,
>
> patch looks good to me, just one small question,
> what if the zero size decoder is programmed by userspace, not from FW.
I don't see a path to that happening. Userspace can't commit a zero-size decoder.
Writing 0 to dpa_size just frees the allocation, and region attach rejects empty
decoders, so a committed zero-size decoder can only come from firmware.
>
> in which case cxl_decoder_is_locked() won't return true, can we handle that situation ?
>
More generally, an unlocked committed zero-size decoder looks identical to an idle slot
in sysfs, so telling them apart would need a new kernel attribute.
I'm going to merge these patches as is, and as we discover new flavors and ways to list
them we can add on.
Thanks for the reviews!
-- Alison
> Reviewed-by: Richard Cheng <icheng@nvidia.com>
>
> Best regards,
> Richard Cheng.
>
> > > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> >
> > Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> >
> > > ---
> > > 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) {
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
2026-07-31 15:40 ` Dave Jiang
@ 2026-10-24 2:55 ` Alison Schofield
1 sibling, 0 replies; 9+ messages in thread
From: Alison Schofield @ 2026-10-24 2:55 UTC (permalink / raw)
To: nvdimm, Richard Cheng; +Cc: linux-cxl
On Thu, Jul 30, 2026 at 06:55:20PM -0700, Alison Schofield wrote:
> '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.
Applied to pending for NDCTL v86
https://github.com/pmem/ndctl/commit/e252f4cc0792
>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ndctl PATCH 1/2] cxl/list: emit decoder locked status
2026-07-31 1:55 [ndctl PATCH 1/2] cxl/list: emit decoder locked status Alison Schofield
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
2026-07-31 15:40 ` [ndctl PATCH 1/2] cxl/list: emit decoder locked status Dave Jiang
@ 2026-10-24 2:56 ` Alison Schofield
2 siblings, 0 replies; 9+ messages in thread
From: Alison Schofield @ 2026-10-24 2:56 UTC (permalink / raw)
To: nvdimm, Richard Cheng; +Cc: linux-cxl
On Thu, Jul 30, 2026 at 06:55:19PM -0700, Alison Schofield wrote:
> A committed zero-sized HDM decoder reports size 0, so 'cxl list'
> renders it identically to an ordinary unconfigured decoder ("state":
> "disabled"). The locked attribute that distinguishes firmware-committed
> decoders is not included in the JSON output.
>
> The library already reads the decoder's locked attribute and exports
> cxl_decoder_is_locked(); it was simply never emitted. Add a "locked"
> field to the decoder JSON, following the emit-only-when-true idiom used
> by the capability flags so existing output is unchanged for the common
> unlocked case.
Applied to pending for NDCTL v86
https://github.com/pmem/ndctl/commit/007acdd87f15
>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> cxl/json.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/cxl/json.c b/cxl/json.c
> index a92548828582..2214f7027d91 100644
> --- a/cxl/json.c
> +++ b/cxl/json.c
> @@ -870,6 +870,12 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> json_object_object_add(jdecoder, "state", jobj);
> }
>
> + if (cxl_decoder_is_locked(decoder)) {
> + jobj = json_object_new_boolean(true);
> + if (jobj)
> + json_object_object_add(jdecoder, "locked", jobj);
> + }
> +
> if (cxl_port_is_endpoint(port)) {
> enum cxl_decoder_mode mode = cxl_decoder_get_mode(decoder);
>
> --
> 2.37.3
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-10-24 2:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 1:55 [ndctl PATCH 1/2] cxl/list: emit decoder locked status Alison Schofield
2026-07-31 1:55 ` [ndctl PATCH 2/2] cxl/list: list locked zero-sized decoders Alison Schofield
2026-07-31 15:40 ` Dave Jiang
2026-08-07 5:10 ` Richard Cheng
2026-10-24 2:29 ` Alison Schofield
2026-10-24 2:55 ` Alison Schofield
2026-07-31 15:40 ` [ndctl PATCH 1/2] cxl/list: emit decoder locked status Dave Jiang
2026-08-07 5:07 ` Richard Cheng
2026-10-24 2:56 ` Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox