aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/namespace_devs.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2019-01-24 20:33:06 -0500
committerDan Williams <dan.j.williams@intel.com>2019-02-12 13:48:14 -0500
commitfa7d2e639cd90442d868dfc6ca1d4cc9d8bf206e (patch)
tree0328b374c2d676b6756d4ae834841f094ab26c6b /drivers/nvdimm/namespace_devs.c
parent11a358109e0c48fa74f27e750dde4d25de4d5fc3 (diff)
libnvdimm/pmem: Honor force_raw for legacy pmem regions
For recovery, where non-dax access is needed to a given physical address range, and testing, allow the 'force_raw' attribute to override the default establishment of a dev_pagemap. Otherwise without this capability it is possible to end up with a namespace that can not be activated due to corrupted info-block, and one that can not be repaired due to a section collision. Cc: <stable@vger.kernel.org> Fixes: 004f1afbe199 ("libnvdimm, pmem: direct map legacy pmem by default") Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r--drivers/nvdimm/namespace_devs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 4b077555ac70..33a3b23b3db7 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -138,6 +138,7 @@ bool nd_is_uuid_unique(struct device *dev, u8 *uuid)
138bool pmem_should_map_pages(struct device *dev) 138bool pmem_should_map_pages(struct device *dev)
139{ 139{
140 struct nd_region *nd_region = to_nd_region(dev->parent); 140 struct nd_region *nd_region = to_nd_region(dev->parent);
141 struct nd_namespace_common *ndns = to_ndns(dev);
141 struct nd_namespace_io *nsio; 142 struct nd_namespace_io *nsio;
142 143
143 if (!IS_ENABLED(CONFIG_ZONE_DEVICE)) 144 if (!IS_ENABLED(CONFIG_ZONE_DEVICE))
@@ -149,6 +150,9 @@ bool pmem_should_map_pages(struct device *dev)
149 if (is_nd_pfn(dev) || is_nd_btt(dev)) 150 if (is_nd_pfn(dev) || is_nd_btt(dev))
150 return false; 151 return false;
151 152
153 if (ndns->force_raw)
154 return false;
155
152 nsio = to_nd_namespace_io(dev); 156 nsio = to_nd_namespace_io(dev);
153 if (region_intersects(nsio->res.start, resource_size(&nsio->res), 157 if (region_intersects(nsio->res.start, resource_size(&nsio->res),
154 IORESOURCE_SYSTEM_RAM, 158 IORESOURCE_SYSTEM_RAM,