Re: [PATCH v1 02/14] cxl/port: Add dynamic capacity options to endpoint decoder mode

From: Alison Schofield

Date: Tue Nov 24 2026 - 13:36:40 EST


On Thu, Nov 05, 2026 at 08:02:26AM +0900, Anisa Su wrote:
> Endpoints can now carry a dynamic ram partition following the
> persistent memory partition. A DC partition is further described by
> two properties reported in its CDAT DSMAS entry: shareable and
> read-only.
>
> Expand the decoder mode to accept 'dynamic_ram', 'dynamic_ram_shared',
> 'dynamic_ram_ro' and 'dynamic_ram_shared_ro'. cxl_dpa_set_part()
> selects the first dynamic ram partition whose properties match exactly.
>
> DCD may be disabled during validation after the DC partition(s) were
> added to the DPA layout, so a decoder may only be assigned to a DC
> partition while DCD is enabled for its memdev. Add a helper,
> cxled_dcd_enabled(), to check cxl_dcd_supported().
>
> Signed-off-by: Anisa Su <anisa.su@xxxxxxxxxxx>
> Tested-by: Wonjae Lee <wj28.lee@xxxxxxxxxxx>
> Tested-by: Junhee Park <jh9934.park@xxxxxxxxxxx>
> Tested-by: Heesoo Kim <habil.kim@xxxxxxxxxxx>
> ---
> Documentation/ABI/testing/sysfs-bus-cxl | 25 +++++++----
> drivers/cxl/core/core.h | 23 ++++++++++-
> drivers/cxl/core/hdm.c | 21 ++++++++--
> drivers/cxl/core/port.c | 55 ++++++++++++++++++++++---
> 4 files changed, 105 insertions(+), 19 deletions(-)
>

snip

> diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
> index 8a81be004d00..24fbb5718abc 100644
> --- a/drivers/cxl/core/core.h
> +++ b/drivers/cxl/core/core.h
> @@ -6,6 +6,7 @@
>
> #include <cxl/mailbox.h>
> #include <linux/rwsem.h>
> +#include <cxlmem.h>
>
> extern const struct device_type cxl_nvdimm_bridge_type;
> extern const struct device_type cxl_nvdimm_type;
> @@ -18,6 +19,25 @@ enum cxl_detach_mode {
> DETACH_INVALIDATE,
> };
>
> +static inline struct cxl_memdev_state *
> +cxled_to_mds(struct cxl_endpoint_decoder *cxled)
> +{
> + struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> +
> + return to_cxl_memdev_state(cxlmd->cxlds);
> +}
> +
> +/* Type-2 devices have no memdev state; nothing else leaves @cxlds NULL here */
> +static inline bool cxled_dcd_enabled(struct cxl_endpoint_decoder *cxled)
> +{
> + struct cxl_memdev_state *mds = cxled_to_mds(cxled);
> +
> + return mds && cxl_dcd_supported(mds);

Same as Jonathan here. It is mds, not cxlds, that is NULL for a Type-2
device, so maybe:

/* Type-2 devices have no memdev state, so @mds is NULL for them */


> +}
> +
> +const char *cxl_dc_mode_name(bool shareable, bool read_only);
> +int cxl_dc_mode_parse(const char *buf, bool *shareable, bool *read_only);

cxl_dc_mode_parse() is only called from mode_store() in port.c, here and
for the rest of the series. Can it be static in port.c, with no
core.h declaration?

snip to end

-- Alison