From: Li Ming <ming.li@zohomail.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
dave@stgolabs.net, jonathan.cameron@huawei.com,
alison.schofield@intel.com, vishal.l.verma@intel.com,
ira.weiny@intel.com, dan.j.williams@intel.com
Subject: Re: [PATCH v1 1/1] cxl/hdm: Verify HDM decoder capabilities after parsing
Date: Fri, 28 Feb 2025 10:48:29 +0800 [thread overview]
Message-ID: <8ecd1237-4719-4f08-8826-2735eb6f472f@zohomail.com> (raw)
In-Reply-To: <34a30d8d-f4e2-4c3b-8386-d07f7b8cfaa1@intel.com>
On 2/27/2025 11:21 PM, Dave Jiang wrote:
>
> On 2/27/25 3:32 AM, Li Ming wrote:
>> devm_cxl_setup_hdm() only checks if decoder_count is 0 after parsing HDM
>> decoder capability, But according to the implementation of
>> cxl_hdm_decoder_count(), cxlhdm->decoder_count will never be 0.
>>
>> Per CXL specification, the values ranges of decoder_count and
>> target_count are limited. Adding a checking for the values of them
>> in case hardware initialized them with wrong values.
>>
>> Signed-off-by: Li Ming <ming.li@zohomail.com>
>> ---
>> base-commit: 22eea823f69ae39dc060c4027e8d1470803d2e49 cxl/next
>> ---
>> drivers/cxl/core/hdm.c | 31 ++++++++++++++++++++++++++++++-
>> 1 file changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
>> index 70cae4ebf8a4..a98191867c22 100644
>> --- a/drivers/cxl/core/hdm.c
>> +++ b/drivers/cxl/core/hdm.c
>> @@ -138,6 +138,34 @@ static bool should_emulate_decoders(struct cxl_endpoint_dvsec_info *info)
>> return true;
>> }
>>
>> +static int cxlhdm_decoder_caps_verify(struct cxl_hdm *cxlhdm)
>> +{
>> + /*
>> + * CXL r3.2 section 8.2.4.20.1
>> + * CXL devices shall not advertise more than 10 decoders,
>> + * CXL switches and HBs may advertise up to 32 decoders.
>> + */
>> + if (is_cxl_endpoint(cxlhdm->port) && cxlhdm->decoder_count > 10)
> #define the limit please
Will do, thanks.
>
>> + return -EINVAL;
>> + else if (cxlhdm->decoder_count > 32)
> same here
>
> DJ
Will do, thanks for review.
Ming
[snip]
next prev parent reply other threads:[~2025-02-28 2:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 10:32 [PATCH v1 1/1] cxl/hdm: Verify HDM decoder capabilities after parsing Li Ming
2025-02-27 15:21 ` Dave Jiang
2025-02-28 2:48 ` Li Ming [this message]
2025-02-27 21:47 ` Alison Schofield
2025-02-28 2:47 ` Li Ming
2025-02-28 18:34 ` Alison Schofield
2025-02-28 23:45 ` Dan Williams
2025-03-01 3:00 ` Li Ming
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=8ecd1237-4719-4f08-8826-2735eb6f472f@zohomail.com \
--to=ming.li@zohomail.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@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=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