On Tue, Aug 24, 2021 at 9:06 AM Dan Williams <[email protected]> wrote:
>
> Now that all of use sites of label data have been converted to nsl_*
> helpers, introduce the CXL label format. The ->cxl flag in
> nvdimm_drvdata indicates the label format the device expects. A
> follow-on patch allows a bus provider to select the label style.
>
> Reviewed-by: Jonathan Cameron <[email protected]>
> Signed-off-by: Dan Williams <[email protected]>
> ---
> drivers/nvdimm/label.c | 54 +++++++++++++------
> drivers/nvdimm/label.h | 108 ++++++++++++++++++++++++++------------
> drivers/nvdimm/nd.h | 135
> +++++++++++++++++++++++++++++++++++++-----------
> 3 files changed, 216 insertions(+), 81 deletions(-)
[..]
> diff --git a/drivers/nvdimm/label.h b/drivers/nvdimm/label.h
> index 76ecd0347dc2..0ef2e20fce57 100644
> --- a/drivers/nvdimm/label.h
> +++ b/drivers/nvdimm/label.h
> @@ -95,41 +95,78 @@ struct cxl_region_label {
> __le64 checksum;
> };
>
> -/**
> - * struct nd_namespace_label - namespace superblock
> - * @uuid: UUID per RFC 4122
> - * @name: optional name (NULL-terminated)
> - * @flags: see NSLABEL_FLAG_*
> - * @nlabel: num labels to describe this ns
> - * @position: labels position in set
> - * @isetcookie: interleave set cookie
> - * @lbasize: LBA size in bytes or 0 for pmem
> - * @dpa: DPA of NVM range on this DIMM
> - * @rawsize: size of namespace
> - * @slot: slot of this label in label area
> - * @unused: must be zero
> - */
> struct nd_namespace_label {
> - u8 uuid[NSLABEL_UUID_LEN];
> - u8 name[NSLABEL_NAME_LEN];
> - __le32 flags;
> - __le16 nlabel;
> - __le16 position;
> - __le64 isetcookie;
> - __le64 lbasize;
> - __le64 dpa;
> - __le64 rawsize;
> - __le32 slot;
> - /*
> - * Accessing fields past this point should be gated by a
> - * namespace_label_has() check.
> - */
> - u8 align;
> - u8 reserved[3];
> - guid_t type_guid;
> - guid_t abstraction_guid;
> - u8 reserved2[88];
> - __le64 checksum;
> + union {
> + /**
> + * struct nvdimm_cxl_label - CXL 2.0 Table 212
> + * @type: uuid identifying this label format (namespace)
> + * @uuid: uuid for the namespace this label describes
> + * @name: friendly name for the namespace
> + * @flags: NSLABEL_FLAG_UPDATING (all other flags reserved)
> + * @nrange: discontiguous namespace support
> + * @position: this label's position in the set
> + * @dpa: start address in device-local capacity for this label
> + * @rawsize: size of this label's contribution to namespace
> + * @slot: slot id of this label in label area
> + * @align: alignment in SZ_256M blocks
> + * @region_uuid: host interleave set identifier
> + * @abstraction_uuid: personality driver for this namespace
> + * @lbasize: address geometry for disk-like personalities
> + * @checksum: fletcher64 sum of this label
> + */
It turns out that scripts/kernel-doc does not accept indented
kernel-doc within a union. So, I rewrote this hunk like this:
@@ -117,7 +117,7 @@ struct cxl_region_label {
* @reserved2: reserved
* @checksum: fletcher64 sum of this object
*/
-struct nd_namespace_label {
+struct nvdimm_efi_label {
u8 uuid[NSLABEL_UUID_LEN];
u8 name[NSLABEL_NAME_LEN];
__le32 flags;
@@ -130,7 +130,7 @@ struct nd_namespace_label {
__le32 slot;
/*
* Accessing fields past this point should be gated by a
- * namespace_label_has() check.
+ * efi_namespace_label_has() check.
*/
u8 align;
u8 reserved[3];
@@ -140,11 +140,57 @@ struct nd_namespace_label {
__le64 checksum;
};
+/**
+ * struct nvdimm_cxl_label - CXL 2.0 Table 212
+ * @type: uuid identifying this label format (namespace)
+ * @uuid: uuid for the namespace this label describes
+ * @name: friendly name for the namespace
+ * @flags: NSLABEL_FLAG_UPDATING (all other flags reserved)
+ * @nrange: discontiguous namespace support
+ * @position: this label's position in the set
+ * @dpa: start address in device-local capacity for this label
+ * @rawsize: size of this label's contribution to namespace
+ * @slot: slot id of this label in label area
+ * @align: alignment in SZ_256M blocks
+ * @region_uuid: host interleave set identifier
+ * @abstraction_uuid: personality driver for this namespace
+ * @lbasize: address geometry for disk-like personalities
+ * @reserved: reserved
+ * @checksum: fletcher64 sum of this label
+ */
+struct nvdimm_cxl_label {
+ u8 type[NSLABEL_UUID_LEN];
+ u8 uuid[NSLABEL_UUID_LEN];
+ u8 name[NSLABEL_NAME_LEN];
+ __le32 flags;
+ __le16 nrange;
+ __le16 position;
+ __le64 dpa;
+ __le64 rawsize;
+ __le32 slot;
+ __le32 align;
+ u8 region_uuid[16];
+ u8 abstraction_uuid[16];
+ __le16 lbasize;
+ u8 reserved[0x56];
+ __le64 checksum;
+};
+
+struct nd_namespace_label {
+ union {
+ struct nvdimm_cxl_label cxl;
+ struct nvdimm_efi_label efi;
+ };
+};
+