The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Vishal Aslot <vaslot@nvidia.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Li Ming <ming.li@zohomail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Zijun Hu <zijun.hu@oss.qualcomm.com>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] cxl/hdm: allow zero sized committed decoders
Date: Fri, 3 Oct 2025 09:20:20 -0700	[thread overview]
Message-ID: <427afe0e-0fd6-4361-ba27-350760e68147@intel.com> (raw)
In-Reply-To: <SN7PR12MB8131F796BAE8B6243E088879BBE7A@SN7PR12MB8131.namprd12.prod.outlook.com>



On 10/2/25 5:59 PM, Vishal Aslot wrote:
> init_hdm_decoder() fails with -ENXIO if a
> committed HDM decoder has zero size.
> 
> The CXL spec permits committing zero sized decoders.
> See "8.2.4.20.12 Committing Decoder Programming".
> It says,"It is legal for software to program Decoder
> Size to 0 and commit it. Such a decoder will not
> participate in HDM decode."
> 
> This patch updates init_hdm_decoder() to return
> -ENOSPC if the decoder is commited with zero-size.
> The caller leaves the decoder allocated but does not
> add it. It simply continues to the next decoder.
> 
> Signed-off-by: Vishal Aslot <vaslot@nvidia.com>

Hi Vishal,
Next time please post the next version of patches as a new thread and not a response to a previous discussion. It would make lore [1] viewing easier. Thanks!

[1]: https://lore.kernel.org/linux-cxl/aN_cUPzzwUy-s36n@gourry-fedora-PF4VCD3F/T/#t

DJ
 
> ---
>  drivers/cxl/core/hdm.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index e9e1d555cec6..50164fd1b434 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -1047,10 +1047,10 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
>                 }
> 
> +               port->commit_end = cxld->id;
> +
>                 if (size == 0) {
> -                       dev_warn(&port->dev,
> +                       dev_dbg(&port->dev,
>                                  "decoder%d.%d: Committed with zero size\n",
>                                  port->id, cxld->id);
> -                       return -ENXIO;
> +                       return -ENOSPC;
>                 }
> -               port->commit_end = cxld->id;
>         } else {
> @@ -1210,6 +1210,9 @@ int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
>                 rc = init_hdm_decoder(port, cxld, target_map, hdm, i,
>                                       &dpa_base, info);
>                 if (rc) {
> +                       if (rc == -ENOSPC) {
> +                               continue;
> +                       }
>                         dev_warn(&port->dev,
>                                  "Failed to initialize decoder%d.%d\n",
>                                  port->id, i);
> --
> 2.34.1
> 
>> ________________________________________
>> From: Vishal Aslot <vaslot@nvidia.com>
>> Sent: Wednesday, October 1, 2025 8:57 PM
>> To: Dave Jiang; Davidlohr Bueso; Jonathan Cameron; Alison Schofield; Vishal Verma; Ira Weiny; Dan Williams; Li Ming; Peter Zijlstra; Dan Carpenter; Zijun Hu; linux-cxl@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH] cxl/hdm: allow zero sized committed decoders
>>
>> External email: Use caution opening links or attachments
>>
>>
>>> ________________________________________
>>> From: Dave Jiang <dave.jiang@intel.com>
>>> Sent: Wednesday, October 1, 2025 5:46 PM
>>> To: Vishal Aslot; Davidlohr Bueso; Jonathan Cameron; Alison Schofield; Vishal Verma; Ira Weiny; Dan Williams; Li Ming; Peter Zijlstra; Dan Carpenter; Zijun Hu; linux-cxl@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Subject: Re: [PATCH] cxl/hdm: allow zero sized committed decoders
>>>
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> On 10/1/25 3:03 PM, Vishal Aslot wrote:
>>>> Thanks for the quick review, Dave. Yes, forgot to put the commit message. :)
>>>> About the copyright message. Should I not be updating the year to 2025 in it?
>>>
>>> I wouldn't bother unless you are doing massive changes and in that case it would be adding NVidia copyright anyhow for you. Also, typically linux mailing lists prefer responding inline and >> not top posting.
>>
>> Ah, understood. Thanks for the mentoring.
>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ________________________________________
>>>> From: Dave Jiang <dave.jiang@intel.com>
>>>> Sent: Wednesday, October 1, 2025 4:28 PM
>>>> To: Vishal Aslot; Davidlohr Bueso; Jonathan Cameron; Alison Schofield; Vishal Verma; Ira Weiny; Dan Williams; Li Ming; Peter Zijlstra; Dan Carpenter; Zijun Hu; linux-cxl@vger.kernel.org
>>>> Cc: linux-kernel@vger.kernel.org
>>>> Subject: Re: [PATCH] cxl/hdm: allow zero sized committed decoders
>>>>
>>>> External email: Use caution opening links or attachments
>>>>
>>>>
>>>> On 10/1/25 1:37 PM, Vishal Aslot wrote:
>>>>> Signed-off-by: Vishal Aslot <vaslot@nvidia.com>
>>>>
>>>> Missing commit log?
>>
>> Yes, will add one in v2.
>>
>>>>>
>>>>> ---
>>>>>  drivers/cxl/core/hdm.c | 9 +++++++--
>>>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
>>>>> index e9e1d555cec6..97a5f27f5b72 100644
>>>>> --- a/drivers/cxl/core/hdm.c
>>>>> +++ b/drivers/cxl/core/hdm.c
>>>>> @@ -1,5 +1,5 @@
>>>>>  // SPDX-License-Identifier: GPL-2.0-only
>>>>> -/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
>>>>> +/* Copyright(c) 2022-2025 Intel Corporation. All rights reserved. */
>>>>
>>>> Stray change?
>>
>> No, it was intentional but I understand that for this small update, I don't need to update copyright info. I'll undo this change in v2.
>>
>>>>
>>>>>  #include <linux/seq_file.h>
>>>>>  #include <linux/device.h>
>>>>>  #include <linux/delay.h>
>>>>> @@ -1050,7 +1050,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
>>>>>                         dev_warn(&port->dev,
>>>>>                                  "decoder%d.%d: Committed with zero size\n",
>>>>>                                  port->id, cxld->id);
>>>>
>>>> I wonder if we should make this dev_dbg() now that it's a valid case.
>>
>> Yes, makes sense. I'll change it to dev_dbg() in v2.
>>
>>>>
>>>>> -                       return -ENXIO;
>>>>> +                       return -ENOSPC;
>>>>>                 }
>>>>>                 port->commit_end = cxld->id;
>>>>>         } else {
>>>>> @@ -1210,6 +1210,11 @@ int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
>>>>>                 rc = init_hdm_decoder(port, cxld, target_map, hdm, i,
>>>>>                                       &dpa_base, info);
>>>>>                 if (rc) {
>>>>> +                       if (rc == -ENOSPC) {
>>>>> +                               put_device(&cxld->dev);
>>>>
>>>> Why put_device()? Should we enumerate this decoder instead of pretend it doesn't exist? essentially only a dev_set_name() and device_add()?
>>
>> That is a good point. The decoder has been committed so it should be accounted for in the OS.
>> I'll remove put_device() in v2.
>>
>>>>
>>>>> +                               rc = 0;
>>>>
>>>> Don't think this is needed since the continue will put it at start of the loop where rc gets written by init_hdm_decoder() return value.
>>
>> Agreed. I was being paranoid. Will remove it in v2.
>>
>>>>
>>>>> +                               continue;
>>>>> +                       }
>>>>>                         dev_warn(&port->dev,
>>>>>                                  "Failed to initialize decoder%d.%d\n",
>>>>>                                  port->id, i);
>>>>> --
>>>>> 2.34.1
>>>>


  parent reply	other threads:[~2025-10-03 16:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-01 20:37 [PATCH] cxl/hdm: allow zero sized committed decoders Vishal Aslot
2025-10-01 21:28 ` Dave Jiang
2025-10-01 22:03   ` Vishal Aslot
2025-10-01 22:46     ` Dave Jiang
2025-10-02  1:57       ` Vishal Aslot
2025-10-03  0:59         ` [PATCH v2] " Vishal Aslot
2025-10-03  4:28           ` Gregory Price
2025-10-04 13:30             ` Vishal Aslot
2025-10-03 16:20           ` Dave Jiang [this message]
2025-10-03 20:02             ` Vishal Aslot
2025-10-04  0:06           ` Davidlohr Bueso
2025-10-04 13:34             ` Vishal Aslot
2025-10-02  5:48 ` [PATCH] " Gregory Price
2025-10-02 15:32   ` Dave Jiang
2025-10-03  1:03     ` Vishal Aslot
2025-10-03 14:23       ` Gregory Price
2025-10-04 13:49         ` Vishal Aslot
2025-10-06 17:06           ` Gregory Price
2025-10-03 16:14       ` Dave Jiang
2025-10-04 14:05         ` Vishal Aslot
2025-10-06 14:54           ` Dave Jiang

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=427afe0e-0fd6-4361-ba27-350760e68147@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=peterz@infradead.org \
    --cc=vaslot@nvidia.com \
    --cc=vishal.l.verma@intel.com \
    --cc=zijun.hu@oss.qualcomm.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