On 7/30/25 5:11 AM, Neeraj Kumar wrote:
> CXL LSA v2.1 utilizes the region labels stored in the LSA for interleave
> set configuration instead of interleave-set cookie used in previous LSA
> versions. As interleave-set cookie is not required for CXL LSA v2.1 format
> so skip its usage for CXL LSA 2.1 format
>
> Signed-off-by: Neeraj Kumar <s.nee...@samsung.com>
> ---
> drivers/nvdimm/namespace_devs.c | 3 ++-
> drivers/nvdimm/region_devs.c | 5 +++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
> index bdf1ed6f23d8..5b73119dc8fd 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1692,7 +1692,8 @@ static struct device *create_namespace_pmem(struct
> nd_region *nd_region,
> int rc = 0;
> u16 i;
>
> - if (cookie == 0) {
> + /* CXL labels skip the need for 'interleave-set cookie' */
This comment doesn't make sense to me. If it's a CXL label, we continue to
execute. There's no skipping. Or are you trying to say if it's CXL label, then
checking of cookie value is unnecessary? But the cookie value still is being
used later on. Maybe a bit more comments on what's going on here would be
helpful.
DJ
> + if (!ndd->cxl && cookie == 0) {
> dev_dbg(&nd_region->dev, "invalid interleave-set-cookie\n");
> return ERR_PTR(-ENXIO);
> }
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index de1ee5ebc851..2debe60f8bf0 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -858,6 +858,11 @@ u64 nd_region_interleave_set_cookie(struct nd_region
> *nd_region,
> if (!nd_set)
> return 0;
>
> + /* CXL labels skip the need for 'interleave-set cookie' */
> + if (nsindex && __le16_to_cpu(nsindex->major) == 2
> + && __le16_to_cpu(nsindex->minor) == 1)
> + return 0;
> +
> if (nsindex && __le16_to_cpu(nsindex->major) == 1
> && __le16_to_cpu(nsindex->minor) == 1)
> return nd_set->cookie1;