On Wed, 30 Jul 2025 17:41:59 +0530
Neeraj Kumar <s.neeraj@xxxxxxxxxxx> 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 <s.neeraj@xxxxxxxxxxx>
See below.
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index 064a945dcdd1..bcac05371f87 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -473,6 +473,47 @@ int nd_label_reserve_dpa(struct nvdimm_drvdata *ndd)
return 0;
}
+int nvdimm_cxl_region_preserve(struct nvdimm_drvdata *ndd)
+{
+ struct nvdimm *nvdimm = to_nvdimm(ndd->dev);
+ struct cxl_pmem_region_params *params = &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) {
+ struct nd_lsa_label *nd_label;
+ struct cxl_region_label *rg_label;
+ uuid_t rg_type, region_type;
+
+ nd_label = to_label(ndd, slot);
+ rg_label = &nd_label->rg_label;
+ uuid_parse(CXL_REGION_UUID, ®ion_type);
+ import_uuid(&rg_type, nd_label->rg_label.type);
+
+ /* REVISIT: Currently preserving only one region */
In practice, is this a significant issue or not? I.e. should we not
merge this series until this has been revisited?