Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Li Zhijian <lizhijian@fujitsu.com>, <linux-cxl@vger.kernel.org>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>,
	Dave Jiang <dave.jiang@intel.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>,
	<linux-kernel@vger.kernel.org>,
	"Li Zhijian" <lizhijian@fujitsu.com>,
	Gregory Price <gourry@gourry.net>
Subject: Re: [PATCH v3] cxl/acpi: Verify CHBS length for CXL2.0
Date: Wed, 9 Apr 2025 18:13:30 -0700	[thread overview]
Message-ID: <67f71b3a1ebeb_2ce62948e@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <20250410010545.99590-1-lizhijian@fujitsu.com>

Li Zhijian wrote:
> Per CXL Spec r3.1 Table 9-21, both CXL1.1 and CXL2.0 have defined their
> own length, verify it to avoid an invalid CHBS.
> 
> Additionally, this patch also removes the redundant macro CXL_RCRB_SIZE,
> favoring the use of `ACPI_CEDT_CHBS_LENGTH_CXL11`, which offers clearer
> semantic meaning.

Right, it was a mistake to allow the CXL_RCRB_SIZE definition to leak
into the kernel in v6.2 when ACPI_CEDT_CHBS_LENGTH_CXL11 had existed
since v5.14.

> 
> Reviewed-by: Gregory Price <gourry@gourry.net>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> V3:
>  - say more words in removing CXL_RCRB_SIZE # Alison
>  - Collected Reviewed-by
> V2: don't factor out, just validate # Dan
> ---
>  drivers/cxl/acpi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index cb14829bb9be..2e63e50b2c40 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -11,8 +11,6 @@
>  #include "cxlpci.h"
>  #include "cxl.h"
>  
> -#define CXL_RCRB_SIZE	SZ_8K
> -
>  struct cxl_cxims_data {
>  	int nr_maps;
>  	u64 xormaps[] __counted_by(nr_maps);
> @@ -478,8 +476,10 @@ static int cxl_get_chbs_iter(union acpi_subtable_headers *header, void *arg,
>  
>  	chbs = (struct acpi_cedt_chbs *) header;
>  
> -	if (chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11 &&
> -	    chbs->length != CXL_RCRB_SIZE)
> +	if ((chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11 &&
> +	    chbs->length != ACPI_CEDT_CHBS_LENGTH_CXL11) ||
> +	   (chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL20 &&
> +	    chbs->length != ACPI_CEDT_CHBS_LENGTH_CXL20))
>  		return 0;

I have a small readability preference for:

        if (chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL11 &&
            chbs->length != ACPI_CEDT_CHBS_LENGTH_CXL11)
                return 0;
        if (chbs->cxl_version == ACPI_CEDT_CHBS_VERSION_CXL20 &&
            chbs->length != ACPI_CEDT_CHBS_LENGTH_CXL20)
                return 0;

...but not enough to ask you to respin this again.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

  reply	other threads:[~2025-04-10  1:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10  1:05 [PATCH v3] cxl/acpi: Verify CHBS length for CXL2.0 Li Zhijian
2025-04-10  1:13 ` Dan Williams [this message]
2025-04-10 15:43 ` 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=67f71b3a1ebeb_2ce62948e@dwillia2-mobl3.amr.corp.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=gourry@gourry.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --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