Skip to content

Commit

Permalink
libnvdimm/labels: Introduce the concept of multi-range namespace labels
Browse files Browse the repository at this point in the history
The CXL specification defines a mechanism for namespaces to be comprised
of multiple dis-contiguous ranges. Introduce that concept to the legacy
NVDIMM namespace implementation with a new nsl_set_nrange() helper, that
sets the number of ranges to 1. Once the NVDIMM subsystem supports CXL
labels and updates its namespace capacity provisioning for
dis-contiguous support nsl_set_nrange() can be updated, but in the
meantime CXL label validation requires nrange be non-zero.

Reported-by: Jonathan Cameron <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Link: https://lore.kernel.org/r/163116430804.2460985.5482188351381597529.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
djbw committed Sep 21, 2021
1 parent 8172db9 commit 42e192a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/nvdimm/label.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
nsl_set_name(ndd, nd_label, nspm->alt_name);
nsl_set_flags(ndd, nd_label, flags);
nsl_set_nlabel(ndd, nd_label, nd_region->ndr_mappings);
nsl_set_nrange(ndd, nd_label, 1);
nsl_set_position(ndd, nd_label, pos);
nsl_set_isetcookie(ndd, nd_label, cookie);
nsl_set_rawsize(ndd, nd_label, resource_size(res));
Expand Down
13 changes: 13 additions & 0 deletions drivers/nvdimm/nd.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,19 @@ static inline void nsl_set_nlabel(struct nvdimm_drvdata *ndd,
nd_label->nlabel = __cpu_to_le16(nlabel);
}

static inline u16 nsl_get_nrange(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
/* EFI labels do not have an nrange field */
return 1;
}

static inline void nsl_set_nrange(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label,
u16 nrange)
{
}

static inline u64 nsl_get_lbasize(struct nvdimm_drvdata *ndd,
struct nd_namespace_label *nd_label)
{
Expand Down

0 comments on commit 42e192a

Please sign in to comment.