Skip to content

Commit

Permalink
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/mst/vhost

lib: use generic pci_iomap on all architectures

Many architectures don't want to pull in iomap.c,
so they ended up duplicating pci_iomap from that file.
That function isn't trivial, and we are going to modify it
https://lkml.org/lkml/2011/11/14/183
so the duplication hurts.

This reduces the scope of the problem significantly,
by moving pci_iomap to a separate file and
referencing that from all architectures.

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  alpha: drop pci_iomap/pci_iounmap from pci-noop.c
  mn10300: switch to GENERIC_PCI_IOMAP
  mn10300: add missing __iomap markers
  frv: switch to GENERIC_PCI_IOMAP
  tile: switch to GENERIC_PCI_IOMAP
  tile: don't panic on iomap
  sparc: switch to GENERIC_PCI_IOMAP
  sh: switch to GENERIC_PCI_IOMAP
  powerpc: switch to GENERIC_PCI_IOMAP
  parisc: switch to GENERIC_PCI_IOMAP
  mips: switch to GENERIC_PCI_IOMAP
  microblaze: switch to GENERIC_PCI_IOMAP
  arm: switch to GENERIC_PCI_IOMAP
  alpha: switch to GENERIC_PCI_IOMAP
  lib: add GENERIC_PCI_IOMAP
  lib: move GENERIC_IOMAP to lib/Kconfig

Fix up trivial conflicts due to changes nearby in arch/{m68k,score}/Kconfig
  • Loading branch information
torvalds committed Jan 11, 2012
2 parents 06792c4 + 193a667 commit e343a89
Show file tree
Hide file tree
Showing 48 changed files with 124 additions and 369 deletions.
5 changes: 1 addition & 4 deletions arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ config GENERIC_ISA_DMA
bool
default y

config GENERIC_IOMAP
bool
default n

source "init/Kconfig"
source "kernel/Kconfig.freezer"

Expand Down Expand Up @@ -319,6 +315,7 @@ config ISA_DMA_API
config PCI
bool
depends on !ALPHA_JENSEN
select GENERIC_PCI_IOMAP
default y
help
Find out whether you have a PCI motherboard. PCI is the name of a
Expand Down
12 changes: 0 additions & 12 deletions arch/alpha/kernel/pci-noop.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,3 @@ struct dma_map_ops alpha_noop_ops = {

struct dma_map_ops *dma_ops = &alpha_noop_ops;
EXPORT_SYMBOL(dma_ops);

void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
return NULL;
}

void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{
}

EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap);
26 changes: 1 addition & 25 deletions arch/alpha/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,38 +508,14 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
return -EOPNOTSUPP;
}

/* Create an __iomem token from a PCI BAR. Copied from lib/iomap.c with
no changes, since we don't want the other things in that object file. */

void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);

if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
/* Not checking IORESOURCE_CACHEABLE because alpha does
not distinguish between ioremap and ioremap_nocache. */
return ioremap(start, len);
}
return NULL;
}

/* Destroy that token. Not copied from lib/iomap.c. */
/* Destroy an __iomem token. Not copied from lib/iomap.c. */

void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{
if (__is_mmio(addr))
iounmap(addr);
}

EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap);

/* FIXME: Some boxes have multiple ISA bridges! */
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ config ARM
select HAVE_SPARSE_IRQ
select GENERIC_IRQ_SHOW
select CPU_PM if (SUSPEND || CPU_IDLE)
select GENERIC_PCI_IOMAP
help
The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <asm/byteorder.h>
#include <asm/memory.h>
#include <asm/system.h>
#include <asm-generic/pci_iomap.h>

/*
* ISA I/O bus memory addresses are 1:1 with the physical address.
Expand Down Expand Up @@ -306,7 +307,6 @@ extern void ioport_unmap(void __iomem *addr);

struct pci_dev;

extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);

/*
Expand Down
21 changes: 0 additions & 21 deletions arch/arm/mm/iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,6 @@ EXPORT_SYMBOL(pcibios_min_mem);
unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
EXPORT_SYMBOL(pci_flags);

void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);

if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
return NULL;
}
EXPORT_SYMBOL(pci_iomap);

void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{
if ((unsigned long)addr >= VMALLOC_START &&
Expand Down
5 changes: 1 addition & 4 deletions arch/cris/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ config GENERIC_CMOS_UPDATE
config ARCH_USES_GETTIMEOFFSET
def_bool n

config GENERIC_IOMAP
bool
default y

config ARCH_HAS_ILOG2_U32
bool
default n
Expand Down Expand Up @@ -52,6 +48,7 @@ config CRIS
select HAVE_IDE
select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP

config HZ
int
Expand Down
1 change: 1 addition & 0 deletions arch/frv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ config PCI
bool "Use PCI"
depends on MB93090_MB00
default y
select GENERIC_PCI_IOMAP
help
Some FR-V systems (such as the MB93090-MB00 VDK) have PCI
onboard. If you have one of these boards and you wish to use the PCI
Expand Down
2 changes: 1 addition & 1 deletion arch/frv/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <asm/virtconvert.h>
#include <asm/string.h>
#include <asm/mb-regs.h>
#include <asm-generic/pci_iomap.h>
#include <linux/delay.h>

/*
Expand Down Expand Up @@ -370,7 +371,6 @@ static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long

/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{
}
Expand Down
2 changes: 1 addition & 1 deletion arch/frv/mb93090-mb00/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

ifeq "$(CONFIG_PCI)" "y"
obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o
obj-y := pci-frv.o pci-irq.o pci-vdk.o

ifeq "$(CONFIG_MMU)" "y"
obj-y += pci-dma.o
Expand Down
29 changes: 0 additions & 29 deletions arch/frv/mb93090-mb00/pci-iomap.c

This file was deleted.

4 changes: 1 addition & 3 deletions arch/hexagon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config HEXAGON
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select NO_IOPORT
select GENERIC_IOMAP
# mostly generic routines, with some accelerated ones
---help---
Qualcomm Hexagon is a processor architecture designed for high
Expand Down Expand Up @@ -73,9 +74,6 @@ config GENERIC_CSUM
config GENERIC_IRQ_PROBE
def_bool y

config GENERIC_IOMAP
def_bool y

#config ZONE_DMA
# bool
# default y
Expand Down
5 changes: 1 addition & 4 deletions arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ config IA64
select GENERIC_IRQ_SHOW
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_IOMAP
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
Expand Down Expand Up @@ -105,10 +106,6 @@ config EFI
bool
default y

config GENERIC_IOMAP
bool
default y

config ARCH_CLOCKSOURCE_DATA
def_bool y

Expand Down
4 changes: 1 addition & 3 deletions arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ config GENERIC_CALIBRATE_DELAY
bool
default y

config GENERIC_IOMAP
def_bool MMU

config GENERIC_CSUM
bool

Expand Down Expand Up @@ -81,6 +78,7 @@ source "kernel/Kconfig.freezer"
config MMU
bool "MMU-based Paged Memory Management Support"
default y
select GENERIC_IOMAP
help
Select if you want MMU-based virtualised addressing space
support by paged memory management. If unsure, say 'Y'.
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ config MICROBLAZE
select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW
select GENERIC_PCI_IOMAP

config SWAP
def_bool n
Expand Down
19 changes: 0 additions & 19 deletions arch/microblaze/pci/iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@
#include <asm/io.h>
#include <asm/pci-bridge.h>

void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);

if (!len)
return NULL;
if (max && len > max)
len = max;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM)
return ioremap(start, len);
/* What? */
return NULL;
}
EXPORT_SYMBOL(pci_iomap);

void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{
if (isa_vaddr_is_ioport(addr))
Expand Down
1 change: 1 addition & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,7 @@ config PCI
bool "Support for PCI controller"
depends on HW_HAS_PCI
select PCI_DOMAINS
select GENERIC_PCI_IOMAP
help
Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside
Expand Down
26 changes: 0 additions & 26 deletions arch/mips/lib/iomap-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
return (void __iomem *) (ctrl->io_map_base + port);
}

/*
* Create a virtual mapping cookie for a PCI BAR (memory or IO)
*/
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);

if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map_pci(dev, start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}

EXPORT_SYMBOL(pci_iomap);

void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{
iounmap(addr);
Expand Down
1 change: 1 addition & 0 deletions arch/mn10300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ config PCI
bool "Use PCI"
depends on MN10300_UNIT_ASB2305
default y
select GENERIC_PCI_IOMAP
help
Some systems (such as the ASB2305) have PCI onboard. If you have one
of these boards and you wish to use the PCI facilities, say Y here.
Expand Down
17 changes: 8 additions & 9 deletions arch/mn10300/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)

/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{
}
Expand All @@ -251,30 +250,30 @@ static inline void *phys_to_virt(unsigned long address)
/*
* Change "struct page" to physical address.
*/
static inline void *__ioremap(unsigned long offset, unsigned long size,
unsigned long flags)
static inline void __iomem *__ioremap(unsigned long offset, unsigned long size,
unsigned long flags)
{
return (void *) offset;
return (void __iomem *) offset;
}

static inline void *ioremap(unsigned long offset, unsigned long size)
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
return (void *) offset;
return (void __iomem *) offset;
}

/*
* This one maps high address device memory and turns off caching for that
* area. it's useful if some control registers are in such an area and write
* combining or read caching is not desirable:
*/
static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size)
{
return (void *) (offset | 0x20000000);
return (void __iomem *) (offset | 0x20000000);
}

#define ioremap_wc ioremap_nocache

static inline void iounmap(void *addr)
static inline void iounmap(void __iomem *addr)
{
}

Expand Down
2 changes: 1 addition & 1 deletion arch/mn10300/unit-asb2305/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
###############################################################################
obj-y := unit-init.o leds.o

obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o pci-iomap.o
obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o
Loading

0 comments on commit e343a89

Please sign in to comment.