In case if any architecture selects CONFIG_GENERIC_PCI_IOMAP and not
CONFIG_GENERIC_IOMAP, then the pci_iounmap function is reduced to a NULL
function. Due to this the managed release variants or even the explicit
pci_iounmap calls doesn't really remove the mappings.
This issue is seen on an arm64 based system. arm64 by default selects
only CONFIG_GENERIC_PCI_IOMAP and not CONFIG_GENERIC_IOMAP from this
'commit cb61f6769b88 ("ARM64: use GENERIC_PCI_IOMAP")'
Simple bind/unbind test of any pci driver using pcim_iomap/pci_iomap,
would lead to the following error message after long hour tests
"allocation failed: out of vmalloc space - use vmalloc=<size> to
increase size."
Signed-off-by: George Cherian <[email protected]>
---
include/asm-generic/io.h | 4 ++++
lib/pci_iomap.c | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index dabf8cb7203b..5986b37226b7 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -915,12 +915,16 @@ static inline void iowrite64_rep(volatile void __iomem *addr,
struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
+#ifdef CONFIG_GENERIC_PCI_IOMAP
+extern void pci_iounmap(struct pci_dev *dev, void __iomem *p);
+#else
#ifndef pci_iounmap
#define pci_iounmap pci_iounmap
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{
}
#endif
+#endif /* CONFIG_GENERIC_PCI_IOMAP */
#endif /* CONFIG_GENERIC_IOMAP */
/*
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c
index 2d3eb1cb73b8..36128af05e1c 100644
--- a/lib/pci_iomap.c
+++ b/lib/pci_iomap.c
@@ -134,4 +134,13 @@ void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen)
return pci_iomap_wc_range(dev, bar, 0, maxlen);
}
EXPORT_SYMBOL_GPL(pci_iomap_wc);
+
+#ifndef CONFIG_GENERIC_IOMAP
+#define pci_iounmap pci_iounmap
+void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
+{
+ iounmap(addr);
+}
+EXPORT_SYMBOL(pci_iounmap);
+#endif
#endif /* CONFIG_PCI */
--
2.25.1
Hi George,
I love your patch! Yet something to improve:
[auto build test ERROR on pci/next]
[also build test ERROR on linux/master linus/master asm-generic/master v5.9-rc1 next-20200819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/George-Cherian/PCI-Add-pci_iounmap/20200820-002342
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: microblaze-randconfig-r021-20200818 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
microblaze-linux-ld: lib/pci_iomap.o: in function `pci_iounmap':
>> lib/pci_iomap.c:143: multiple definition of `pci_iounmap'; arch/microblaze/pci/iomap.o:arch/microblaze/pci/iomap.c:15: first defined here
# https://github.com/0day-ci/linux/commit/2bb1d10d9162a34cc1e6abb29f57489525bae30f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review George-Cherian/PCI-Add-pci_iounmap/20200820-002342
git checkout 2bb1d10d9162a34cc1e6abb29f57489525bae30f
vim +143 lib/pci_iomap.c
137
138 #ifndef CONFIG_GENERIC_IOMAP
139 #define pci_iounmap pci_iounmap
140 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
141 {
142 iounmap(addr);
> 143 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi George,
I love your patch! Yet something to improve:
[auto build test ERROR on pci/next]
[also build test ERROR on linux/master linus/master asm-generic/master v5.9-rc1 next-20200819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/George-Cherian/PCI-Add-pci_iounmap/20200820-002342
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-mvebu_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
arm-linux-gnueabi-ld: lib/pci_iomap.o: in function `pci_iounmap':
>> pci_iomap.c:(.text+0xe0): multiple definition of `pci_iounmap'; arch/arm/mm/iomap.o:iomap.c:(.text+0x10): first defined here
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]