On 17/12/25 03:09PM, Jonathan Cameron wrote:
On Wed, 19 Nov 2025 13:22:46 +0530
Neeraj Kumar <[email protected]> wrote:

Preserve region information from region label during nvdimm_probe. This
preserved region information is used for creating cxl region to achieve
region persistency across reboot.

Signed-off-by: Neeraj Kumar <[email protected]>
Trivial comments inline.  As Dave asked, what's the plan for multiple?

Multi-interleave support will require some more efforts on top of this change
So will take it in another series.
Yes, I will prepare in next patch series


Add some brief notes to the patch description on this.

Yes, I have updated it in commit description


Thanks,

Jonathan

---
 drivers/nvdimm/dimm.c     |  4 ++++
 drivers/nvdimm/label.c    | 40 +++++++++++++++++++++++++++++++++++++++
 drivers/nvdimm/nd-core.h  |  2 ++
 drivers/nvdimm/nd.h       |  1 +
 include/linux/libnvdimm.h | 14 ++++++++++++++
 5 files changed, 61 insertions(+)



<snip>

+int nvdimm_cxl_region_preserve(struct nvdimm_drvdata *ndd)
+{
+       struct nvdimm *nvdimm = to_nvdimm(ndd->dev);
+       struct cxl_pmem_region_params *p = &nvdimm->cxl_region_params;
+       struct nd_namespace_index *nsindex;
+       unsigned long *free;
+       u32 nslot, slot;
+
+       if (!preamble_current(ndd, &nsindex, &free, &nslot))
+               return 0; /* no label, nothing to preserve */
+
+       for_each_clear_bit_le(slot, free, nslot) {
+               union nd_lsa_label *lsa_label;
+               struct cxl_region_label *region_label;
+               uuid_t *region_uuid;
+
+               lsa_label = to_lsa_label(ndd, slot);
+               region_label = &lsa_label->region_label;
+               region_uuid = (uuid_t *) &region_label->type;
+
                union nd_lsa_label *lsa_label = to_lsa_label(ndd, slot);
                struct cxl_region_label *region_label = 
&lsa_label->region_label;
//I'd go long on thi sone as only just over 80 and helps readability.
                uuid_t *region_uuid = (uuid_t *)&region_label->type;

Saves a fine lines and there doesn't seem to be an obvious reason
not to do so.

I have fixed in V5, Will be sending it soon.


Regards,
Neeraj


Reply via email to