libnvdimm, pfn: kill ND_PFN_ALIGN
authorDan Williams <dan.j.williams@intel.com>
Thu, 10 Dec 2015 23:14:20 +0000 (15:14 -0800)
committerDan Williams <dan.j.williams@intel.com>
Thu, 10 Dec 2015 23:14:20 +0000 (15:14 -0800)
The alignment constraint isn't necessary now that devm_memremap_pages()
allows for unaligned mappings.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/nd.h
drivers/nvdimm/pfn_devs.c
drivers/nvdimm/pmem.c

index 417e521d299cb4645f5739f7608cc2d0d84a701c..2ce428e9b5849f42cba0f44a64d75c01ef1c8637 100644 (file)
@@ -29,13 +29,6 @@ enum {
        ND_MAX_LANES = 256,
        SECTOR_SHIFT = 9,
        INT_LBASIZE_ALIGNMENT = 64,
-#if IS_ENABLED(CONFIG_NVDIMM_PFN)
-       ND_PFN_ALIGN = PAGES_PER_SECTION * PAGE_SIZE,
-       ND_PFN_MASK = ND_PFN_ALIGN - 1,
-#else
-       ND_PFN_ALIGN = 0,
-       ND_PFN_MASK = 0,
-#endif
 };
 
 struct nvdimm_drvdata {
index 71805a1aa0f3e5f002ee5d26339c53d49aadf951..96c122918ee1013e736d7dd2b888fc4f9f5a6557 100644 (file)
@@ -241,10 +241,6 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn)
        if (!is_nd_pmem(nd_pfn->dev.parent))
                return -ENODEV;
 
-       /* section alignment for simple hotplug */
-       if (nvdimm_namespace_capacity(ndns) < ND_PFN_ALIGN)
-               return -ENODEV;
-
        if (nvdimm_read_bytes(ndns, SZ_4K, pfn_sb, sizeof(*pfn_sb)))
                return -ENXIO;
 
@@ -286,12 +282,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn)
         */
        offset = le64_to_cpu(pfn_sb->dataoff);
        nsio = to_nd_namespace_io(&ndns->dev);
-       if (nsio->res.start & ND_PFN_MASK) {
-               dev_err(&nd_pfn->dev,
-                               "init failed: %s not section aligned\n",
-                               dev_name(&ndns->dev));
-               return -EBUSY;
-       } else if (offset >= resource_size(&nsio->res)) {
+       if (offset >= resource_size(&nsio->res)) {
                dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n",
                                dev_name(&ndns->dev));
                return -EBUSY;
index 8ee79893d2f5f6f5165558baa22f236738b99c45..520c00321dadd033686fac58d06e27008c9e7b96 100644 (file)
@@ -241,11 +241,6 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
        if (rc == 0 || rc == -EBUSY)
                return rc;
 
-       /* section alignment for simple hotplug */
-       if (nvdimm_namespace_capacity(ndns) < ND_PFN_ALIGN
-                       || pmem->phys_addr & ND_PFN_MASK)
-               return -ENODEV;
-
        nd_region = to_nd_region(nd_pfn->dev.parent);
        if (nd_region->ro) {
                dev_info(&nd_pfn->dev,
@@ -326,16 +321,6 @@ static int nvdimm_namespace_attach_pfn(struct nd_namespace_common *ndns)
        if (rc)
                return rc;
 
-       if (PAGE_SIZE != SZ_4K) {
-               dev_err(dev, "only supported on systems with 4K PAGE_SIZE\n");
-               return -ENXIO;
-       }
-       if (nsio->res.start & ND_PFN_MASK) {
-               dev_err(dev, "%s not memory hotplug section aligned\n",
-                               dev_name(&ndns->dev));
-               return -ENXIO;
-       }
-
        pfn_sb = nd_pfn->pfn_sb;
        offset = le64_to_cpu(pfn_sb->dataoff);
        nd_pfn->mode = le32_to_cpu(nd_pfn->pfn_sb->mode);