On Wed, Aug 11, 2021 at 11:42 AM Jonathan Cameron
<[email protected]> wrote:
>
> On Mon, 9 Aug 2021 15:28:46 -0700
> 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.
> >
> > Signed-off-by: Dan Williams <[email protected]>
>
> A few trivial things inline. Nothing that actually 'needs' changing though.
> Reviewed-by: Jonathan Cameron <[email protected]>
>
> > index e6e77691dbec..71ffde56fac0 100644
> > --- a/drivers/nvdimm/label.h
> > +++ b/drivers/nvdimm/label.h
> > @@ -64,40 +64,77 @@ struct nd_namespace_index {
> > u8 free[];
> > };
> >
> > -/**
> > - * 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 {
> > + union {
> Cross reference might be a nice thing to include?
> Table 212 I think...
> > + struct nvdimm_cxl_label {
> > + uuid_t type;
> > + uuid_t uuid;
> > + u8 name[NSLABEL_NAME_LEN];
> > + __le32 flags;
> > + __le16 nlabel;
>
> Perhaps call out nlabel is nrange in the spec?
Actually, this is a bug, because nlabel in EFI labels is the width of
the interleave set. In CXL labels that property is moved to the region
and this field is only for discontiguous namespace support. Good
indirect catch!
>
> > + __le16 position;
> > + __le64 dpa;
> > + __le64 rawsize;
> > + __le32 slot;
> > + __le32 align;
> > + uuid_t region_uuid;
> > + uuid_t abstraction_uuid;
> > + __le16 lbasize;
> > + u8 reserved[0x56];
> > + __le64 checksum;
> > + } cxl;
> > + /**
> > + * struct nvdimm_efi_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 nvdimm_efi_label {
> > + uuid_t uuid;
> > + 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 efi_namespace_label_has() check.
> > + */
> > + u8 align;
> > + u8 reserved[3];
> > + guid_t type_guid;
> > + guid_t abstraction_guid;
> > + u8 reserved2[88];
> > + __le64 checksum;
> > + } efi;
> > + };
> > +};
> > +
> > +struct cxl_region_label {
>
> Perhaps separate this out to another patch so the diff ends up less confusing?
I'll take a look.