Skip to content

Commit 42237e3

Browse files
committed
libnvdimm: allow a platform to force enable label support
Platforms like QEMU-KVM implement an NFIT table and label DSMs. However, since that environment does not define an aliased configuration, the labels are currently ignored and the kernel registers a single full-sized pmem-namespace per region. Now that the kernel supports sub-divisions of pmem regions the labels have a purpose. Arrange for the labels to be honored when we find an existing / valid namespace index block. Cc: <qemu-devel@nongnu.org> Cc: Haozhong Zhang <haozhong.zhang@intel.com> Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 8d7c22a commit 42237e3

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

drivers/nvdimm/dimm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ static int nvdimm_probe(struct device *dev)
6464
nd_label_copy(ndd, to_next_namespace_index(ndd),
6565
to_current_namespace_index(ndd));
6666
rc = nd_label_reserve_dpa(ndd);
67+
if (ndd->ns_current >= 0)
68+
nvdimm_set_aliasing(dev);
6769
nvdimm_bus_unlock(dev);
6870

6971
if (rc)

drivers/nvdimm/dimm_devs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
184184
return rc;
185185
}
186186

187+
void nvdimm_set_aliasing(struct device *dev)
188+
{
189+
struct nvdimm *nvdimm = to_nvdimm(dev);
190+
191+
nvdimm->flags |= NDD_ALIASING;
192+
}
193+
187194
static void nvdimm_release(struct device *dev)
188195
{
189196
struct nvdimm *nvdimm = to_nvdimm(dev);

drivers/nvdimm/nd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
238238
void *buf, size_t len);
239239
long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
240240
unsigned int len);
241+
void nvdimm_set_aliasing(struct device *dev);
241242
struct nd_btt *to_nd_btt(struct device *dev);
242243

243244
struct nd_gen_sb {

0 commit comments

Comments
 (0)