Re: [ndctl PATCH 1/2] cxl/list: emit decoder locked status
Richard Cheng <[email protected]>
| Newsgroups | org.kernel.vger.linux-cxl,dev.linux.lists.nvdimm |
|---|---|
| Message-ID | <anVn1VThm2j9s7hZ@MWDK4CY14F> |
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 <[email protected]>
>
> Reviewed-by: Dave Jiang <[email protected]>
>
Thanks alot !
Reviewed-by: Richard Cheng <[email protected]>
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);
> >
>