* [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0
@ 2025-04-07 8:02 Li Zhijian
2025-04-08 1:12 ` Gregory Price
2025-04-09 1:55 ` Alison Schofield
0 siblings, 2 replies; 4+ messages in thread
From: Li Zhijian @ 2025-04-07 8:02 UTC (permalink / raw)
To: linux-cxl
Cc: Jonathan Cameron, Dave Jiang, Alison Schofield, Vishal Verma,
Ira Weiny, Dan Williams, linux-kernel, Li Zhijian
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.
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
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;
if (!chbs->base)
--
2.47.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0
2025-04-07 8:02 [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0 Li Zhijian
@ 2025-04-08 1:12 ` Gregory Price
2025-04-09 1:55 ` Alison Schofield
1 sibling, 0 replies; 4+ messages in thread
From: Gregory Price @ 2025-04-08 1:12 UTC (permalink / raw)
To: Li Zhijian
Cc: linux-cxl, Jonathan Cameron, Dave Jiang, Alison Schofield,
Vishal Verma, Ira Weiny, Dan Williams, linux-kernel
On Mon, Apr 07, 2025 at 04:02:17PM +0800, 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.
>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0
2025-04-07 8:02 [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0 Li Zhijian
2025-04-08 1:12 ` Gregory Price
@ 2025-04-09 1:55 ` Alison Schofield
2025-04-09 10:03 ` Zhijian Li (Fujitsu)
1 sibling, 1 reply; 4+ messages in thread
From: Alison Schofield @ 2025-04-09 1:55 UTC (permalink / raw)
To: Li Zhijian
Cc: linux-cxl, Jonathan Cameron, Dave Jiang, Vishal Verma, Ira Weiny,
Dan Williams, linux-kernel
On Mon, Apr 07, 2025 at 04:02:17PM +0800, 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.
Can you comment on removing the comparison to CXL_RCRB_SIZE. At some
point someone thought that was useful. As you remove it, please
explain.
>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> 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;
>
> if (!chbs->base)
> --
> 2.47.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0
2025-04-09 1:55 ` Alison Schofield
@ 2025-04-09 10:03 ` Zhijian Li (Fujitsu)
0 siblings, 0 replies; 4+ messages in thread
From: Zhijian Li (Fujitsu) @ 2025-04-09 10:03 UTC (permalink / raw)
To: Alison Schofield
Cc: linux-cxl@vger.kernel.org, Jonathan Cameron, Dave Jiang,
Vishal Verma, Ira Weiny, Dan Williams,
linux-kernel@vger.kernel.org
On 09/04/2025 09:55, Alison Schofield wrote:
> On Mon, Apr 07, 2025 at 04:02:17PM +0800, 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.
>
> Can you comment on removing the comparison to CXL_RCRB_SIZE. At some
> point someone thought that was useful. As you remove it, please
> explain.
Thanks for your feedback.
Okay, I will update it in the commit log in V3
Remove the redundant macro CXL_RCRB_SIZE, as it has the same meaning as
ACPI_CEDT_CHBS_LENGTH_CXL11, which name is more comprehensible.
Thanks
Zhijian
>
>
>>
>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
>> ---
>> 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;
>>
>> if (!chbs->base)
>> --
>> 2.47.0
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-09 10:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 8:02 [PATCH v2] cxl/acpi: Verify CHBS length for CXL2.0 Li Zhijian
2025-04-08 1:12 ` Gregory Price
2025-04-09 1:55 ` Alison Schofield
2025-04-09 10:03 ` Zhijian Li (Fujitsu)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox