[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250813161151.00006d59@huawei.com>
Date: Wed, 13 Aug 2025 16:11:51 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Neeraj Kumar <s.neeraj@...sung.com>
CC: <linux-cxl@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
<linux-kernel@...r.kernel.org>, <gost.dev@...sung.com>,
<a.manzanares@...sung.com>, <vishak.g@...sung.com>, <neeraj.kernel@...il.com>
Subject: Re: [PATCH V2 10/20] nvdimm/region_label: Preserve cxl region
information from region label
On Wed, 30 Jul 2025 17:41:59 +0530
Neeraj Kumar <s.neeraj@...sung.com> 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@...sung.com>
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?
> + if (uuid_equal(®ion_type, &rg_type)) {
> + nvdimm->is_region_label = true;
> + import_uuid(¶ms->uuid, rg_label->uuid);
> + params->flags = __le32_to_cpu(rg_label->flags);
> + params->nlabel = __le16_to_cpu(rg_label->nlabel);
> + params->position = __le16_to_cpu(rg_label->position);
> + params->dpa = __le64_to_cpu(rg_label->dpa);
> + params->rawsize = __le64_to_cpu(rg_label->rawsize);
> + params->hpa = __le64_to_cpu(rg_label->hpa);
> + params->slot = __le32_to_cpu(rg_label->slot);
> + params->ig = __le32_to_cpu(rg_label->ig);
> + params->align = __le32_to_cpu(rg_label->align);
> + break;
> + }
> + }
> +
> + return 0;
> +}
Powered by blists - more mailing lists