From 8f4b01fcded2dc821349cc0edfa5311c05abe293 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Thu, 31 Oct 2019 16:27:41 +0530 Subject: libnvdimm/namespace: Differentiate between probe mapping and runtime mapping The nvdimm core currently maps the full namespace to an ioremap range while probing the namespace mode. This can result in probe failures on architectures that have limited ioremap space. For example, with a large btt namespace that consumes most of I/O remap range, depending on the sequence of namespace initialization, the user can find a pfn namespace initialization failure due to unavailable I/O remap space which nvdimm core uses for temporary mapping. nvdimm core can avoid this failure by only mapping the reserved info block area to check for pfn superblock type and map the full namespace resource only before using the namespace. Given that personalities like BTT can be layered on top of any namespace type create a generic form of devm_nsio_enable (devm_namespace_enable) and use it inside the per-personality attach routines. Now devm_namespace_enable() is always paired with disable unless the mapping is going to be used for long term runtime access. Signed-off-by: Aneesh Kumar K.V Link: https://lore.kernel.org/r/20191017073308.32645-1-aneesh.kumar@linux.ibm.com [djbw: reworks to move devm_namespace_{en,dis}able into *attach helpers] Reported-by: kbuild test robot Link: https://lore.kernel.org/r/20191031105741.102793-2-aneesh.kumar@linux.ibm.com Signed-off-by: Dan Williams --- drivers/nvdimm/nd-core.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/nvdimm/nd-core.h') diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h index 25fa121104d0..96e8630f451c 100644 --- a/drivers/nvdimm/nd-core.h +++ b/drivers/nvdimm/nd-core.h @@ -171,6 +171,23 @@ ssize_t nd_namespace_store(struct device *dev, struct nd_pfn *to_nd_pfn_safe(struct device *dev); bool is_nvdimm_bus(struct device *dev); +#if IS_ENABLED(CONFIG_ND_CLAIM) +int devm_nsio_enable(struct device *dev, struct nd_namespace_io *nsio, + resource_size_t size); +void devm_nsio_disable(struct device *dev, struct nd_namespace_io *nsio); +#else +static inline int devm_nsio_enable(struct device *dev, + struct nd_namespace_io *nsio, resource_size_t size) +{ + return -ENXIO; +} + +static inline void devm_nsio_disable(struct device *dev, + struct nd_namespace_io *nsio) +{ +} +#endif + #ifdef CONFIG_PROVE_LOCKING extern struct class *nd_class; -- cgit v1.2.3 From cda93d6965a162be87f9d6dc5fb28b99335860fe Mon Sep 17 00:00:00 2001 From: Alastair D'Silva Date: Fri, 25 Oct 2019 15:46:57 +1100 Subject: libnvdimm: Remove prototypes for nonexistent functions These functions don't exist, so remove the prototypes for them. Signed-off-by: Alastair D'Silva Reviewed-by: Andrew Donnellan Reviewed-by: Frederic Barrat Link: https://lore.kernel.org/r/20191025044721.16617-3-alastair@au1.ibm.com Signed-off-by: Dan Williams --- drivers/nvdimm/nd-core.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/nvdimm/nd-core.h') diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h index 96e8630f451c..9b451aafbb08 100644 --- a/drivers/nvdimm/nd-core.h +++ b/drivers/nvdimm/nd-core.h @@ -124,11 +124,7 @@ void nd_region_create_dax_seed(struct nd_region *nd_region); int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus); void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus); void nd_synchronize(void); -int nvdimm_bus_register_dimms(struct nvdimm_bus *nvdimm_bus); -int nvdimm_bus_register_regions(struct nvdimm_bus *nvdimm_bus); -int nvdimm_bus_init_interleave_sets(struct nvdimm_bus *nvdimm_bus); void __nd_device_register(struct device *dev); -int nd_match_dimm(struct device *dev, void *data); struct nd_label_id; char *nd_label_gen_id(struct nd_label_id *label_id, u8 *uuid, u32 flags); bool nd_is_uuid_unique(struct device *dev, u8 *uuid); -- cgit v1.2.3