Re: [PATCH V4 12/17] cxl/pmem: Preserve region information into nd_set

2025-11-19 Thread Dave Jiang



On 11/19/25 12:52 AM, Neeraj Kumar wrote:
> Save region information stored in cxlr to nd_set during
> cxl_pmem_region_probe in nd_set. This saved region information is being
> stored into LSA, which will be used for cxl region persistence
> 
> Signed-off-by: Neeraj Kumar 

Reviewed-by: Dave Jiang 

> ---
>  drivers/cxl/pmem.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> index e197883690ef..a6eba3572090 100644
> --- a/drivers/cxl/pmem.c
> +++ b/drivers/cxl/pmem.c
> @@ -377,6 +377,7 @@ static int cxl_pmem_region_probe(struct device *dev)
>   struct nd_mapping_desc mappings[CXL_DECODER_MAX_INTERLEAVE];
>   struct cxl_pmem_region *cxlr_pmem = to_cxl_pmem_region(dev);
>   struct cxl_region *cxlr = cxlr_pmem->cxlr;
> + struct cxl_region_params *p = &cxlr->params;
>   struct cxl_nvdimm_bridge *cxl_nvb = cxlr->cxl_nvb;
>   struct cxl_pmem_region_info *info = NULL;
>   struct nd_interleave_set *nd_set;
> @@ -465,12 +466,12 @@ static int cxl_pmem_region_probe(struct device *dev)
>   ndr_desc.num_mappings = cxlr_pmem->nr_mappings;
>   ndr_desc.mapping = mappings;
>  
> - /*
> -  * TODO enable CXL labels which skip the need for 'interleave-set 
> cookie'
> -  */
> - nd_set->cookie1 =
> - nd_fletcher64(info, sizeof(*info) * cxlr_pmem->nr_mappings, 0);
> - nd_set->cookie2 = nd_set->cookie1;
> + nd_set->uuid = p->uuid;
> + nd_set->interleave_ways = p->interleave_ways;
> + nd_set->interleave_granularity = p->interleave_granularity;
> + nd_set->res = p->res;
> + nd_set->nr_targets = p->nr_targets;
> +
>   ndr_desc.nd_set = nd_set;
>  
>   cxlr_pmem->nd_region =




[PATCH V4 12/17] cxl/pmem: Preserve region information into nd_set

2025-11-19 Thread Neeraj Kumar
Save region information stored in cxlr to nd_set during
cxl_pmem_region_probe in nd_set. This saved region information is being
stored into LSA, which will be used for cxl region persistence

Signed-off-by: Neeraj Kumar 
---
 drivers/cxl/pmem.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
index e197883690ef..a6eba3572090 100644
--- a/drivers/cxl/pmem.c
+++ b/drivers/cxl/pmem.c
@@ -377,6 +377,7 @@ static int cxl_pmem_region_probe(struct device *dev)
struct nd_mapping_desc mappings[CXL_DECODER_MAX_INTERLEAVE];
struct cxl_pmem_region *cxlr_pmem = to_cxl_pmem_region(dev);
struct cxl_region *cxlr = cxlr_pmem->cxlr;
+   struct cxl_region_params *p = &cxlr->params;
struct cxl_nvdimm_bridge *cxl_nvb = cxlr->cxl_nvb;
struct cxl_pmem_region_info *info = NULL;
struct nd_interleave_set *nd_set;
@@ -465,12 +466,12 @@ static int cxl_pmem_region_probe(struct device *dev)
ndr_desc.num_mappings = cxlr_pmem->nr_mappings;
ndr_desc.mapping = mappings;
 
-   /*
-* TODO enable CXL labels which skip the need for 'interleave-set 
cookie'
-*/
-   nd_set->cookie1 =
-   nd_fletcher64(info, sizeof(*info) * cxlr_pmem->nr_mappings, 0);
-   nd_set->cookie2 = nd_set->cookie1;
+   nd_set->uuid = p->uuid;
+   nd_set->interleave_ways = p->interleave_ways;
+   nd_set->interleave_granularity = p->interleave_granularity;
+   nd_set->res = p->res;
+   nd_set->nr_targets = p->nr_targets;
+
ndr_desc.nd_set = nd_set;
 
cxlr_pmem->nd_region =
-- 
2.34.1