diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-03-03 12:38:00 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-03-05 15:25:45 -0500 |
commit | cfe30b872058f211630eda7f65fb19d83beaaa3c (patch) | |
tree | 44dd4131a1dd92ef45babff885cb6add604746a9 /drivers/nvdimm/namespace_devs.c | |
parent | d9cbe09d39aa13f6924dc5fb88325de7ef01a72e (diff) |
libnvdimm, pmem: adjust for section collisions with 'System RAM'
On a platform where 'Persistent Memory' and 'System RAM' are mixed
within a given sparsemem section, trim the namespace and notify about the
sub-optimal alignment.
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
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.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 9edf7eb7d17c..f5cb88601359 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
@@ -133,6 +133,7 @@ bool nd_is_uuid_unique(struct device *dev, u8 *uuid) | |||
133 | bool pmem_should_map_pages(struct device *dev) | 133 | bool pmem_should_map_pages(struct device *dev) |
134 | { | 134 | { |
135 | struct nd_region *nd_region = to_nd_region(dev->parent); | 135 | struct nd_region *nd_region = to_nd_region(dev->parent); |
136 | struct nd_namespace_io *nsio; | ||
136 | 137 | ||
137 | if (!IS_ENABLED(CONFIG_ZONE_DEVICE)) | 138 | if (!IS_ENABLED(CONFIG_ZONE_DEVICE)) |
138 | return false; | 139 | return false; |
@@ -143,6 +144,12 @@ bool pmem_should_map_pages(struct device *dev) | |||
143 | if (is_nd_pfn(dev) || is_nd_btt(dev)) | 144 | if (is_nd_pfn(dev) || is_nd_btt(dev)) |
144 | return false; | 145 | return false; |
145 | 146 | ||
147 | nsio = to_nd_namespace_io(dev); | ||
148 | if (region_intersects(nsio->res.start, resource_size(&nsio->res), | ||
149 | IORESOURCE_SYSTEM_RAM, | ||
150 | IORES_DESC_NONE) == REGION_MIXED) | ||
151 | return false; | ||
152 | |||
146 | #ifdef ARCH_MEMREMAP_PMEM | 153 | #ifdef ARCH_MEMREMAP_PMEM |
147 | return ARCH_MEMREMAP_PMEM == MEMREMAP_WB; | 154 | return ARCH_MEMREMAP_PMEM == MEMREMAP_WB; |
148 | #else | 155 | #else |