libnvdimm: allow a platform to force enable label support
authorDan Williams <dan.j.williams@intel.com>
Sat, 15 Oct 2016 22:33:52 +0000 (15:33 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 19 Oct 2016 15:57:33 +0000 (08:57 -0700)
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>
drivers/nvdimm/dimm.c
drivers/nvdimm/dimm_devs.c
drivers/nvdimm/nd.h

index 619834e144d1e65e2314cde9356c86cff44d5053..ee0b412827bfb43fc739d5e03e873f12254517fa 100644 (file)
@@ -64,6 +64,8 @@ static int nvdimm_probe(struct device *dev)
        nd_label_copy(ndd, to_next_namespace_index(ndd),
                        to_current_namespace_index(ndd));
        rc = nd_label_reserve_dpa(ndd);
+       if (ndd->ns_current >= 0)
+               nvdimm_set_aliasing(dev);
        nvdimm_bus_unlock(dev);
 
        if (rc)
index d614493ad5acb849037d22bcc44fd78c0e80e1a3..0eedc49e0d473ed36b5ef9832760aa8498b9f146 100644 (file)
@@ -184,6 +184,13 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
        return rc;
 }
 
+void nvdimm_set_aliasing(struct device *dev)
+{
+       struct nvdimm *nvdimm = to_nvdimm(dev);
+
+       nvdimm->flags |= NDD_ALIASING;
+}
+
 static void nvdimm_release(struct device *dev)
 {
        struct nvdimm *nvdimm = to_nvdimm(dev);
index 065abf1b8f32d0c2681bdbe1e1e8601135cb07e1..35dd75057e1697f2e03de12c62cf3f6cabb69aec 100644 (file)
@@ -238,6 +238,7 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
                void *buf, size_t len);
 long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
                unsigned int len);
+void nvdimm_set_aliasing(struct device *dev);
 struct nd_btt *to_nd_btt(struct device *dev);
 
 struct nd_gen_sb {