Commit 95025d6b27721ae8bbce592403fdc06e982204c8

Authored by Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

arch: fix ioport mapping on mips,sh

Kevin Cernekee reported that recent cleanup that replaced pci_iomap with
a generic function failed to take into account the differences in io
port handling on mips and sh architectures.

Rather than revert the changes reintroducing the code duplication, this
patchset fixes this by adding ability for architectures to override
ioport mapping for pci devices.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  sh: use the the PCI channels's io_map_base
  mips: use the the PCI controller's io_map_base
  lib: add NO_GENERIC_PCI_IOPORT_MAP

Showing 7 changed files Side-by-side Diff

... ... @@ -2356,6 +2356,7 @@
2356 2356 depends on HW_HAS_PCI
2357 2357 select PCI_DOMAINS
2358 2358 select GENERIC_PCI_IOMAP
  2359 + select NO_GENERIC_PCI_IOPORT_MAP
2359 2360 help
2360 2361 Find out whether you have a PCI motherboard. PCI is the name of a
2361 2362 bus system, i.e. the way the CPU talks to the other stuff inside
arch/mips/lib/iomap-pci.c
... ... @@ -10,8 +10,8 @@
10 10 #include <linux/module.h>
11 11 #include <asm/io.h>
12 12  
13   -static void __iomem *ioport_map_pci(struct pci_dev *dev,
14   - unsigned long port, unsigned int nr)
  13 +void __iomem *__pci_ioport_map(struct pci_dev *dev,
  14 + unsigned long port, unsigned int nr)
15 15 {
16 16 struct pci_controller *ctrl = dev->bus->sysdata;
17 17 unsigned long base = ctrl->io_map_base;
... ... @@ -859,6 +859,7 @@
859 859 depends on SYS_SUPPORTS_PCI
860 860 select PCI_DOMAINS
861 861 select GENERIC_PCI_IOMAP
  862 + select NO_GENERIC_PCI_IOPORT_MAP
862 863 help
863 864 Find out whether you have a PCI motherboard. PCI is the name of a
864 865 bus system, i.e. the way the CPU talks to the other stuff inside
arch/sh/drivers/pci/pci.c
... ... @@ -356,8 +356,8 @@
356 356  
357 357 #ifndef CONFIG_GENERIC_IOMAP
358 358  
359   -static void __iomem *ioport_map_pci(struct pci_dev *dev,
360   - unsigned long port, unsigned int nr)
  359 +void __iomem *__pci_ioport_map(struct pci_dev *dev,
  360 + unsigned long port, unsigned int nr)
361 361 {
362 362 struct pci_channel *chan = dev->sysdata;
363 363  
include/asm-generic/pci_iomap.h
... ... @@ -15,6 +15,16 @@
15 15 #ifdef CONFIG_PCI
16 16 /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
17 17 extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
  18 +/* Create a virtual mapping cookie for a port on a given PCI device.
  19 + * Do not call this directly, it exists to make it easier for architectures
  20 + * to override */
  21 +#ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
  22 +extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
  23 + unsigned int nr);
  24 +#else
  25 +#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
  26 +#endif
  27 +
18 28 #else
19 29 static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
20 30 {
... ... @@ -19,6 +19,9 @@
19 19 config GENERIC_FIND_FIRST_BIT
20 20 bool
21 21  
  22 +config NO_GENERIC_PCI_IOPORT_MAP
  23 + bool
  24 +
22 25 config GENERIC_PCI_IOMAP
23 26 bool
24 27  
... ... @@ -34,7 +34,7 @@
34 34 if (maxlen && len > maxlen)
35 35 len = maxlen;
36 36 if (flags & IORESOURCE_IO)
37   - return ioport_map(start, len);
  37 + return __pci_ioport_map(dev, start, len);
38 38 if (flags & IORESOURCE_MEM) {
39 39 if (flags & IORESOURCE_CACHEABLE)
40 40 return ioremap(start, len);