[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1279309678.121750165204255.JavaMail.epsvc@epcpadp1new>
Date: Tue, 17 Jun 2025 18:09:27 +0530
From: Neeraj Kumar <s.neeraj@...sung.com>
To: dan.j.williams@...el.com, dave@...olabs.net,
jonathan.cameron@...wei.com, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com, ira.weiny@...el.com
Cc: a.manzanares@...sung.com, nifan.cxl@...il.com, anisa.su@...sung.com,
vishak.g@...sung.com, krish.reddy@...sung.com, arun.george@...sung.com,
alok.rathore@...sung.com, s.neeraj@...sung.com, neeraj.kernel@...il.com,
linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org,
nvdimm@...ts.linux.dev, gost.dev@...sung.com, cpgs@...sung.com
Subject: [RFC PATCH 03/20] nvdimm/namespace_label: Add namespace label
changes as per CXL LSA v2.1
CXL 3.2 Spec mentions CXL LSA 2.1 Namespace Labels at section 9.13.2.5
Modified __pmem_label_update function using setter functions to update
namespace label as per CXL LSA 2.1
Signed-off-by: Neeraj Kumar <s.neeraj@...sung.com>
---
drivers/nvdimm/label.c | 3 +++
drivers/nvdimm/nd.h | 27 +++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index 30bccad98939..d5cfaa99f976 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -923,6 +923,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
memset(nd_label, 0, sizeof_namespace_label(ndd));
ns_label = &nd_label->ns_label;
+ nsl_set_type(ndd, ns_label);
nsl_set_uuid(ndd, ns_label, nspm->uuid);
nsl_set_name(ndd, ns_label, nspm->alt_name);
nsl_set_flags(ndd, ns_label, flags);
@@ -934,7 +935,9 @@ static int __pmem_label_update(struct nd_region *nd_region,
nsl_set_lbasize(ndd, ns_label, nspm->lbasize);
nsl_set_dpa(ndd, ns_label, res->start);
nsl_set_slot(ndd, ns_label, slot);
+ nsl_set_alignment(ndd, ns_label, 0);
nsl_set_type_guid(ndd, ns_label, &nd_set->type_guid);
+ nsl_set_region_uuid(ndd, ns_label, NULL);
nsl_set_claim_class(ndd, ns_label, ndns->claim_class);
nsl_calculate_checksum(ndd, ns_label);
nd_dbg_dpa(nd_region, ndd, res, "\n");
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
index 2ead96ac598b..07d665f18bf6 100644
--- a/drivers/nvdimm/nd.h
+++ b/drivers/nvdimm/nd.h
@@ -295,6 +295,33 @@ static inline const u8 *nsl_uuid_raw(struct nvdimm_drvdata *ndd,
return nd_label->efi.uuid;
}
+static inline void nsl_set_type(struct nvdimm_drvdata *ndd,
+ struct nd_namespace_label *ns_label)
+{
+ uuid_t tmp;
+
+ if (ndd->cxl) {
+ uuid_parse(CXL_NAMESPACE_UUID, &tmp);
+ export_uuid(ns_label->cxl.type, &tmp);
+ }
+}
+
+static inline void nsl_set_alignment(struct nvdimm_drvdata *ndd,
+ struct nd_namespace_label *ns_label,
+ u32 align)
+{
+ if (ndd->cxl)
+ ns_label->cxl.align = __cpu_to_le16(align);
+}
+
+static inline void nsl_set_region_uuid(struct nvdimm_drvdata *ndd,
+ struct nd_namespace_label *ns_label,
+ const uuid_t *uuid)
+{
+ if (ndd->cxl)
+ export_uuid(ns_label->cxl.region_uuid, uuid);
+}
+
bool nsl_validate_type_guid(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label, guid_t *guid);
enum nvdimm_claim_class nsl_get_claim_class(struct nvdimm_drvdata *ndd,
--
2.34.1
Powered by blists - more mailing lists