Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f1e8cee authored by Dan Williams's avatar Dan Williams
Browse files

libnvdimm, pfn: kill ND_PFN_ALIGN



The alignment constraint isn't necessary now that devm_memremap_pages()
allows for unaligned mappings.

Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 6bb691ac
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -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 {
+1 −10
Original line number Diff line number Diff line
@@ -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;
+0 −15
Original line number Diff line number Diff line
@@ -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);