Re: [PATCH v20 04/22] cxl: Add type2 device basic support

Jonathan Cameron
2025-11-12T15:33:38Z

On Mon, 10 Nov 2025 15:36:39 +0000
alejandro.lucero-palau@amd.com wrote:

> From: Alejandro Lucero <alucerop@amd.com>
>
> Differentiate CXL memory expanders (type 3) from CXL device accelerators
> (type 2) with a new function for initializing cxl_dev_state and a macro
> for helping accel drivers to embed cxl_dev_state inside a private
> struct.
>
> Move structs to include/cxl as the size of the accel driver private
> struct embedding cxl_dev_state needs to know the size of this struct.
>
> Use same new initialization with the type3 pci driver.
>
> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Alison Schofield <alison.schofield@intel.com>
> Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
One minor thing that's probably a merge conflict gone slightly wrong
or something like that. After this patch you end up with two
CXL_NR_PARTITIONS_MAX defines.

> ---
> drivers/cxl/core/mbox.c | 12 +-
> drivers/cxl/core/memdev.c | 32 +++++
> drivers/cxl/core/pci_drv.c | 15 +--
> drivers/cxl/cxl.h | 97 +--------------
> drivers/cxl/cxlmem.h | 85 +------------
> include/cxl/cxl.h | 226 +++++++++++++++++++++++++++++++++++
> tools/testing/cxl/test/mem.c | 3 +-
> 7 files changed, 276 insertions(+), 194 deletions(-)
> create mode 100644 include/cxl/cxl.h
>

> diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
> new file mode 100644
> index 000000000000..13d448686189
> --- /dev/null
> +++ b/include/cxl/cxl.h
> @@ -0,0 +1,226 @@

> +#define CXL_NR_PARTITIONS_MAX 2
Adds a definition but doesn't remove the one in driver/cxl/cxlmem.h
That seems odd.