All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures
@ 2011-12-21 16:29 Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 01/16] lib: move GENERIC_IOMAP to lib/Kconfig Michael S. Tsirkin
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

This reposting combines the latest version of the patches.
As this is just a repost, separate versions was already sent to
maintainers, I cut down the To list to just lkml and linux-arch.

This patchset has been on linux-next for several weeks now.
I intend to send pull request to Linus come 3.3 merge window:
They touch a lot of arches and have interdependencies, so merging
separately seems to make sense.

As Jesse Barnes noted: the PCI changes look nice (pulling
all that duplicated code out looks good), though it would be good to
get a few more arch maintainer acks/tested-bys for this.

The patchset is available from my tree:
git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
or from linux-next.

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.

Tested on x86, build tested on alpha, mips64 and powerpc64.

-- 
1.7.5.53.gc233e


Michael S. Tsirkin (16):
  lib: move GENERIC_IOMAP to lib/Kconfig
  lib: add GENERIC_PCI_IOMAP
  alpha: switch to GENERIC_PCI_IOMAP
  arm: switch to GENERIC_PCI_IOMAP
  microblaze: switch to GENERIC_PCI_IOMAP
  mips: switch to GENERIC_PCI_IOMAP
  parisc: switch to GENERIC_PCI_IOMAP
  powerpc: switch to GENERIC_PCI_IOMAP
  sh: switch to GENERIC_PCI_IOMAP
  sparc: switch to GENERIC_PCI_IOMAP
  tile: don't panic on iomap
  tile: switch to GENERIC_PCI_IOMAP
  frv: switch to GENERIC_PCI_IOMAP
  mn10300: add missing __iomap markers
  mn10300: switch to GENERIC_PCI_IOMAP
  alpha: drop pci_iomap/pci_iounmap from pci-noop.c

 arch/alpha/Kconfig                    |    5 +---
 arch/alpha/kernel/pci-noop.c          |   12 --------
 arch/alpha/kernel/pci.c               |   26 +-----------------
 arch/arm/Kconfig                      |    1 +
 arch/arm/include/asm/io.h             |    2 +-
 arch/arm/mm/iomap.c                   |   21 --------------
 arch/cris/Kconfig                     |    5 +---
 arch/frv/Kconfig                      |    1 +
 arch/frv/include/asm/io.h             |    2 +-
 arch/frv/mb93090-mb00/Makefile        |    2 +-
 arch/frv/mb93090-mb00/pci-iomap.c     |   29 --------------------
 arch/hexagon/Kconfig                  |    4 +--
 arch/ia64/Kconfig                     |    5 +---
 arch/m68k/Kconfig                     |    4 +--
 arch/microblaze/Kconfig               |    1 +
 arch/microblaze/pci/iomap.c           |   19 -------------
 arch/mips/Kconfig                     |    1 +
 arch/mips/lib/iomap-pci.c             |   26 ------------------
 arch/mn10300/Kconfig                  |    1 +
 arch/mn10300/include/asm/io.h         |   17 +++++------
 arch/mn10300/unit-asb2305/Makefile    |    2 +-
 arch/mn10300/unit-asb2305/pci-iomap.c |   31 ---------------------
 arch/openrisc/Kconfig                 |    3 --
 arch/parisc/Kconfig                   |    1 +
 arch/parisc/lib/iomap.c               |   23 ---------------
 arch/powerpc/Kconfig                  |    1 +
 arch/powerpc/kernel/iomap.c           |   19 -------------
 arch/powerpc/platforms/Kconfig        |    3 --
 arch/score/Kconfig                    |    4 +--
 arch/sh/Kconfig                       |    4 +--
 arch/sh/drivers/pci/pci.c             |   23 ---------------
 arch/sparc/Kconfig                    |    1 +
 arch/sparc/include/asm/io_32.h        |    2 +-
 arch/sparc/include/asm/io_64.h        |    2 +-
 arch/sparc/lib/iomap.c                |   23 ---------------
 arch/tile/Kconfig                     |    1 +
 arch/tile/include/asm/io.h            |    3 +-
 arch/tile/include/asm/pci.h           |    2 +-
 arch/tile/kernel/pci.c                |   21 --------------
 arch/unicore32/Kconfig                |    4 +--
 arch/x86/Kconfig                      |    4 +--
 include/asm-generic/io.h              |    4 +-
 include/asm-generic/iomap.h           |    9 ++----
 include/asm-generic/pci_iomap.h       |   25 +++++++++++++++++
 lib/Kconfig                           |    7 +++++
 lib/Makefile                          |    1 +
 lib/iomap.c                           |   38 +------------------------
 lib/pci_iomap.c                       |   48 +++++++++++++++++++++++++++++++++
 48 files changed, 124 insertions(+), 369 deletions(-)
 delete mode 100644 arch/frv/mb93090-mb00/pci-iomap.c
 delete mode 100644 arch/mn10300/unit-asb2305/pci-iomap.c
 create mode 100644 include/asm-generic/pci_iomap.h
 create mode 100644 lib/pci_iomap.c

-- 
1.7.8.382.g3daff

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 01/16] lib: move GENERIC_IOMAP to lib/Kconfig
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 02/16] lib: add GENERIC_PCI_IOMAP Michael S. Tsirkin
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

define GENERIC_IOMAP in a central location
instead of all architectures. This will be helpful
for the follow-up patch which makes it select
other configs. Code is also a bit shorter this way.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Richard Kuo <rkuo@codeaurora.org>
Acked-by: Jonas Bonn <jonas@southpole.se>
---
 arch/alpha/Kconfig             |    4 ----
 arch/cris/Kconfig              |    5 +----
 arch/hexagon/Kconfig           |    4 +---
 arch/ia64/Kconfig              |    5 +----
 arch/m68k/Kconfig              |    4 +---
 arch/openrisc/Kconfig          |    3 ---
 arch/powerpc/platforms/Kconfig |    3 ---
 arch/score/Kconfig             |    4 +---
 arch/sh/Kconfig                |    3 ---
 arch/unicore32/Kconfig         |    4 +---
 arch/x86/Kconfig               |    4 +---
 lib/Kconfig                    |    3 +++
 12 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 3d74801..3636b11 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -70,10 +70,6 @@ config GENERIC_ISA_DMA
 	bool
 	default y
 
-config GENERIC_IOMAP
-	bool
-	default n
-
 source "init/Kconfig"
 source "kernel/Kconfig.freezer"
 
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 408b055..b3abfb0 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -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
@@ -52,6 +48,7 @@ config CRIS
 	select HAVE_IDE
 	select HAVE_GENERIC_HARDIRQS
 	select GENERIC_IRQ_SHOW
+	select GENERIC_IOMAP
 
 config HZ
 	int
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 02513c2..9059e39 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -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
@@ -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
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 27489b6..2732e1b 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -29,6 +29,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
@@ -102,10 +103,6 @@ config EFI
 	bool
 	default y
 
-config GENERIC_IOMAP
-	bool
-	default y
-
 config ARCH_CLOCKSOURCE_DATA
 	def_bool y
 
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 361d540..973e686 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -38,9 +38,6 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
-config GENERIC_IOMAP
-	def_bool MMU
-
 config TIME_LOW_RES
 	bool
 	default y
@@ -73,6 +70,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'.
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index e518a5a..081a54f 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -38,9 +38,6 @@ config RWSEM_XCHGADD_ALGORITHM
 config GENERIC_HWEIGHT
 	def_bool y
 
-config GENERIC_IOMAP
-	def_bool y
-
 config NO_IOPORT
 	def_bool y
 
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 3fe6d92..100feed 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -175,9 +175,6 @@ config PPC_INDIRECT_MMIO
 config PPC_IO_WORKAROUNDS
 	bool
 
-config GENERIC_IOMAP
-	bool
-
 source "drivers/cpufreq/Kconfig"
 
 menu "CPU Frequency drivers"
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index df169e8..455ce2d 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -4,6 +4,7 @@ config SCORE
        def_bool y
        select HAVE_GENERIC_HARDIRQS
        select GENERIC_IRQ_SHOW
+       select GENERIC_IOMAP
 
 choice
 	prompt "System type"
@@ -33,9 +34,6 @@ endmenu
 config CPU_SCORE7
 	bool
 
-config GENERIC_IOMAP
-	def_bool y
-
 config NO_DMA
 	bool
 	default y
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5629e20..5aeab58 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -84,9 +84,6 @@ config GENERIC_GPIO
 config GENERIC_CALIBRATE_DELAY
 	bool
 
-config GENERIC_IOMAP
-	bool
-
 config GENERIC_CLOCKEVENTS
 	def_bool y
 
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index 942ed61..eeb8054 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -12,6 +12,7 @@ config UNICORE32
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_SHOW
 	select ARCH_WANT_FRAME_POINTERS
+	select GENERIC_IOMAP
 	help
 	  UniCore-32 is 32-bit Instruction Set Architecture,
 	  including a series of low-power-consumption RISC chip
@@ -30,9 +31,6 @@ config GENERIC_CLOCKEVENTS
 config GENERIC_CSUM
 	def_bool y
 
-config GENERIC_IOMAP
-	def_bool y
-
 config NO_IOPORT
 	bool
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index efb4294..1b90fc4 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -75,6 +75,7 @@ config X86
 	select HAVE_BPF_JIT if (X86_64 && NET)
 	select CLKEVT_I8253
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
+	select GENERIC_IOMAP
 
 config INSTRUCTION_DECODER
 	def_bool (KPROBES || PERF_EVENTS)
@@ -140,9 +141,6 @@ config NEED_SG_DMA_LENGTH
 config GENERIC_ISA_DMA
 	def_bool ISA_DMA_API
 
-config GENERIC_IOMAP
-	def_bool y
-
 config GENERIC_BUG
 	def_bool y
 	depends on BUG
diff --git a/lib/Kconfig b/lib/Kconfig
index 32f3e5a..0058927 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -19,6 +19,9 @@ config RATIONAL
 config GENERIC_FIND_FIRST_BIT
 	bool
 
+config GENERIC_IOMAP
+	bool
+
 config CRC_CCITT
 	tristate "CRC-CCITT functions"
 	help
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 02/16] lib: add GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 01/16] lib: move GENERIC_IOMAP to lib/Kconfig Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 03/16] alpha: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

Many architectures want a generic pci_iomap but
not the rest of iomap.c. Split that to a separate .c
file and add a new config symbol. select automatically
by GENERIC_IOMAP.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 include/asm-generic/io.h        |    4 +-
 include/asm-generic/iomap.h     |    9 ++-----
 include/asm-generic/pci_iomap.h |   25 ++++++++++++++++++++
 lib/Kconfig                     |    4 +++
 lib/Makefile                    |    1 +
 lib/iomap.c                     |   38 +-----------------------------
 lib/pci_iomap.c                 |   48 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 85 insertions(+), 44 deletions(-)
 create mode 100644 include/asm-generic/pci_iomap.h
 create mode 100644 lib/pci_iomap.c

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 9120887..dddc61d 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -19,6 +19,8 @@
 #include <asm-generic/iomap.h>
 #endif
 
+#include <asm-generic/pci_iomap.h>
+
 #ifndef mmiowb
 #define mmiowb() do {} while (0)
 #endif
@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
 #define __io_virt(x) ((void __force *) (x))
 
 #ifndef CONFIG_GENERIC_IOMAP
-/* 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)
 {
 }
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 98dcd76..8a3d4fd 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *);
 #endif
 
 #ifdef CONFIG_PCI
-/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+/* Destroy 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);
 extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #else
 struct pci_dev;
-static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
-{
-	return NULL;
-}
 static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 { }
 #endif
 
+#include <asm-generic/pci_iomap.h>
+
 #endif
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
new file mode 100644
index 0000000..8de4b73
--- /dev/null
+++ b/include/asm-generic/pci_iomap.h
@@ -0,0 +1,25 @@
+/* Generic I/O port emulation, based on MN10300 code
+ *
+ * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+#ifndef __ASM_GENERIC_PCI_IOMAP_H
+#define __ASM_GENERIC_PCI_IOMAP_H
+
+struct pci_dev;
+#ifdef CONFIG_PCI
+/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
+#else
+static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
+{
+	return NULL;
+}
+#endif
+
+#endif /* __ASM_GENERIC_IO_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 0058927..36884b4 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -19,8 +19,12 @@ config RATIONAL
 config GENERIC_FIND_FIRST_BIT
 	bool
 
+config GENERIC_PCI_IOMAP
+	bool
+
 config GENERIC_IOMAP
 	bool
+	select GENERIC_PCI_IOMAP
 
 config CRC_CCITT
 	tristate "CRC-CCITT functions"
diff --git a/lib/Makefile b/lib/Makefile
index a4da283..609b2adc 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -33,6 +33,7 @@ endif
 
 lib-$(CONFIG_HOTPLUG) += kobject_uevent.o
 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
+obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
 obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
 obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
 obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
diff --git a/lib/iomap.c b/lib/iomap.c
index 5dbcb4b..ada922a 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -242,45 +242,11 @@ EXPORT_SYMBOL(ioport_unmap);
 #endif /* CONFIG_HAS_IOPORT */
 
 #ifdef CONFIG_PCI
-/**
- * pci_iomap - create a virtual mapping cookie for a PCI BAR
- * @dev: PCI device that owns the BAR
- * @bar: BAR number
- * @maxlen: length of the memory to map
- *
- * Using this function you will get a __iomem address to your device BAR.
- * You can access it using ioread*() and iowrite*(). These functions hide
- * the details if this is a MMIO or PIO address space and will just do what
- * you expect from them in the correct way.
- *
- * @maxlen specifies the maximum length to map. If you want to get access to
- * the complete BAR without checking for its length first, pass %0 here.
- * */
-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);
-	}
-	/* What? */
-	return NULL;
-}
-
+/* Hide the details if this is a MMIO or PIO address space and just do what
+ * you expect in the correct way. */
 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
 {
 	IO_COND(addr, /* nothing */, iounmap(addr));
 }
-EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
 #endif /* CONFIG_PCI */
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c
new file mode 100644
index 0000000..4b0fdc2
--- /dev/null
+++ b/lib/pci_iomap.c
@@ -0,0 +1,48 @@
+/*
+ * Implement the default iomap interfaces
+ *
+ * (C) Copyright 2004 Linus Torvalds
+ */
+#include <linux/pci.h>
+#include <linux/io.h>
+
+#include <linux/export.h>
+
+#ifdef CONFIG_PCI
+/**
+ * pci_iomap - create a virtual mapping cookie for a PCI BAR
+ * @dev: PCI device that owns the BAR
+ * @bar: BAR number
+ * @maxlen: length of the memory to map
+ *
+ * Using this function you will get a __iomem address to your device BAR.
+ * You can access it using ioread*() and iowrite*(). These functions hide
+ * the details if this is a MMIO or PIO address space and will just do what
+ * you expect from them in the correct way.
+ *
+ * @maxlen specifies the maximum length to map. If you want to get access to
+ * the complete BAR without checking for its length first, pass %0 here.
+ * */
+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);
+	}
+	/* What? */
+	return NULL;
+}
+
+EXPORT_SYMBOL(pci_iomap);
+#endif /* CONFIG_PCI */
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 03/16] alpha: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 01/16] lib: move GENERIC_IOMAP to lib/Kconfig Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 02/16] lib: add GENERIC_PCI_IOMAP Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 04/16] arm: " Michael S. Tsirkin
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

alpha copied pci_iomap from generic code to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

The only difference is handling of nocache flag,
that turns out to be done correctly by the
generic code since arch/alpha/include/asm/io.h
defines ioremap_nocache same as ioremap.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Raúl Porcel <armin76@gentoo.org>
---
 arch/alpha/Kconfig      |    1 +
 arch/alpha/kernel/pci.c |   26 +-------------------------
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 3636b11..56a4df9 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -315,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
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index c9ab94e..f3cae27 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -508,30 +508,7 @@ 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)
 {
@@ -539,7 +516,6 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
 		iounmap(addr);
 }
 
-EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
 
 /* FIXME: Some boxes have multiple ISA bridges! */
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 04/16] arm: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 03/16] alpha: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 05/16] microblaze: " Michael S. Tsirkin
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

arm copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/Kconfig          |    1 +
 arch/arm/include/asm/io.h |    2 +-
 arch/arm/mm/iomap.c       |   21 ---------------------
 3 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 776d76b..c875a8e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -30,6 +30,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
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 065d100..9275828 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -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.
@@ -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);
 
 /*
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index 430df1a..e62956e 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -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 &&
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 05/16] microblaze: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (3 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 04/16] arm: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 08/16] powerpc: " Michael S. Tsirkin
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

microblaze copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

The only difference is handling of nocache flag,
that turns out to be done correctly by the
generic code since arch/microblaze/include/asm/io.h
defines ioremap_nocache same as ioremap.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/microblaze/Kconfig     |    1 +
 arch/microblaze/pci/iomap.c |   19 -------------------
 2 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index e446bab..f0eead7 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -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
diff --git a/arch/microblaze/pci/iomap.c b/arch/microblaze/pci/iomap.c
index 57acda8..b07abba 100644
--- a/arch/microblaze/pci/iomap.c
+++ b/arch/microblaze/pci/iomap.c
@@ -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))
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 08/16] powerpc: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (4 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 05/16] microblaze: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 06/16] mips: " Michael S. Tsirkin
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

powerpc copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

The only difference is handling of nocache flag,
that turns out to be done correctly by the
generic code since arch/powerpc/include/asm/io.h
defines ioremap_nocache same as ioremap.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/powerpc/Kconfig        |    1 +
 arch/powerpc/kernel/iomap.c |   19 -------------------
 2 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 951e18f..6ffe3df 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -710,6 +710,7 @@ config PCI
 	default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
 	default PCI_QSPAN if !4xx && !CPM2 && 8xx
 	select ARCH_SUPPORTS_MSI
+	select GENERIC_PCI_IOMAP
 	help
 	  Find out whether your system includes a PCI bus. PCI is the name of
 	  a bus system, i.e. the way the CPU talks to the other stuff inside
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index 2627918..97a3715 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -119,24 +119,6 @@ EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
 #ifdef CONFIG_PCI
-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;
-}
-
 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 {
 	if (isa_vaddr_is_ioport(addr))
@@ -146,6 +128,5 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 	iounmap(addr);
 }
 
-EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
 #endif /* CONFIG_PCI */
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 06/16] mips: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (5 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 08/16] powerpc: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 09/16] sh: " Michael S. Tsirkin
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

mips copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/mips/Kconfig         |    1 +
 arch/mips/lib/iomap-pci.c |   26 --------------------------
 2 files changed, 1 insertions(+), 26 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d46f1da..b70c96f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -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
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c
index 2ab899c..2635b1a 100644
--- a/arch/mips/lib/iomap-pci.c
+++ b/arch/mips/lib/iomap-pci.c
@@ -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);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 09/16] sh: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (6 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 06/16] mips: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 10/16] sparc: " Michael S. Tsirkin
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

sh copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/Kconfig           |    1 +
 arch/sh/drivers/pci/pci.c |   23 -----------------------
 2 files changed, 1 insertions(+), 23 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 5aeab58..ead1640 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -857,6 +857,7 @@ config PCI
 	bool "PCI support"
 	depends on SYS_SUPPORTS_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
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index c2691af..11aaf2f 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -393,29 +393,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
 	return (void __iomem *)(chan->io_map_base + port);
 }
 
-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 (unlikely(!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);
-	}
-
-	return NULL;
-}
-EXPORT_SYMBOL(pci_iomap);
-
 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 {
 	iounmap(addr);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 10/16] sparc: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (7 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 09/16] sh: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 20:39   ` David Miller
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 07/16] parisc: " Michael S. Tsirkin
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

sparc copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc/Kconfig             |    1 +
 arch/sparc/include/asm/io_32.h |    2 +-
 arch/sparc/include/asm/io_64.h |    2 +-
 arch/sparc/lib/iomap.c         |   23 -----------------------
 4 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index f92602e..a4644f5 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -28,6 +28,7 @@ config SPARC
 	select HAVE_GENERIC_HARDIRQS
 	select GENERIC_IRQ_SHOW
 	select USE_GENERIC_SMP_HELPERS if SMP
+	select GENERIC_PCI_IOMAP
 
 config SPARC32
 	def_bool !64BIT
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index c2ced21..2006e5d 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -7,6 +7,7 @@
 
 #include <asm/page.h>      /* IO address mapping routines need this */
 #include <asm/system.h>
+#include <asm-generic/pci_iomap.h>
 
 #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
 
@@ -324,7 +325,6 @@ extern void ioport_unmap(void __iomem *);
 
 /* 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);
 extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 
 /*
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 9c89654..9481e5a 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -8,6 +8,7 @@
 #include <asm/page.h>      /* IO address mapping routines need this */
 #include <asm/system.h>
 #include <asm/asi.h>
+#include <asm-generic/pci_iomap.h>
 
 /* PC crapola... */
 #define __SLOW_DOWN_IO	do { } while (0)
@@ -514,7 +515,6 @@ extern void ioport_unmap(void __iomem *);
 
 /* 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);
 extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 
 static inline int sbus_can_dma_64bit(void)
diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c
index 9ef37e1..c4d42a5 100644
--- a/arch/sparc/lib/iomap.c
+++ b/arch/sparc/lib/iomap.c
@@ -18,31 +18,8 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
-/* 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(start, len);
-	if (flags & IORESOURCE_MEM) {
-		if (flags & IORESOURCE_CACHEABLE)
-			return ioremap(start, len);
-		return ioremap_nocache(start, len);
-	}
-	/* What? */
-	return NULL;
-}
-
 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
 {
 	/* nothing to do */
 }
-EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 07/16] parisc: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (8 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 10/16] sparc: " Michael S. Tsirkin
@ 2011-12-21 16:29 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 11/16] tile: don't panic on iomap Michael S. Tsirkin
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:29 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

parisc copied pci_iomap from generic code, probably to avoid
pulling the rest of iomap.c in.  Since that's in
a separate file now, we can reuse the common implementation.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/parisc/Kconfig     |    1 +
 arch/parisc/lib/iomap.c |   23 -----------------------
 2 files changed, 1 insertions(+), 23 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index fdfd8be..242a1b7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -14,6 +14,7 @@ config PARISC
 	select GENERIC_ATOMIC64 if !64BIT
 	select HAVE_GENERIC_HARDIRQS
 	select GENERIC_IRQ_PROBE
+	select GENERIC_PCI_IOMAP
 	select IRQ_PER_CPU
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 
diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c
index 8f470c9..fb8e10a 100644
--- a/arch/parisc/lib/iomap.c
+++ b/arch/parisc/lib/iomap.c
@@ -436,28 +436,6 @@ void ioport_unmap(void __iomem *addr)
 	}
 }
 
-/* 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(start, len);
-	if (flags & IORESOURCE_MEM) {
-		if (flags & IORESOURCE_CACHEABLE)
-			return ioremap(start, len);
-		return ioremap_nocache(start, len);
-	}
-	/* What? */
-	return NULL;
-}
-
 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
 {
 	if (!INDIRECT_ADDR(addr)) {
@@ -483,5 +461,4 @@ EXPORT_SYMBOL(iowrite16_rep);
 EXPORT_SYMBOL(iowrite32_rep);
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
-EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 11/16] tile: don't panic on iomap
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (9 preceding siblings ...)
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 07/16] parisc: " Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 12/16] tile: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

I think panic on iomap is there just for debugging.
If we return NULL instead, the generic pci_iomap will
DTRT so we don't need to roll our own.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
---
 arch/tile/include/asm/io.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h
index c9ea165..d2152de 100644
--- a/arch/tile/include/asm/io.h
+++ b/arch/tile/include/asm/io.h
@@ -204,7 +204,8 @@ static inline long ioport_panic(void)
 
 static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
 {
-	return (void __iomem *) ioport_panic();
+	pr_info("ioport_map: mapping IO resources is unsupported on tile.\n");
+	return NULL;
 }
 
 static inline void ioport_unmap(void __iomem *addr)
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 12/16] tile: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (10 preceding siblings ...)
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 11/16] tile: don't panic on iomap Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 13/16] frv: " Michael S. Tsirkin
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

tile now has working stubs for ioport_map and ioremap
such that the generic pci_iomap will DTRT: cast to
pointer on memory and return NULL and log message on IO map.

Switch it over to GENERIC_PCI_IOMAP.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
---
 arch/tile/Kconfig           |    1 +
 arch/tile/include/asm/pci.h |    2 +-
 arch/tile/kernel/pci.c      |   21 ---------------------
 3 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 70a0de4..11270ca 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -321,6 +321,7 @@ config PCI
 	bool "PCI support"
 	default y
 	select PCI_DOMAINS
+	select GENERIC_PCI_IOMAP
 	---help---
 	  Enable PCI root complex support, so PCIe endpoint devices can
 	  be attached to the Tile chip.  Many, but not all, PCI devices
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index 7f03cef..1d25fea 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -16,6 +16,7 @@
 #define _ASM_TILE_PCI_H
 
 #include <linux/pci.h>
+#include <asm-generic/pci_iomap.h>
 
 /*
  * Structure of a PCI controller (host bridge)
@@ -49,7 +50,6 @@ struct pci_controller {
 int __devinit tile_pci_init(void);
 int __devinit pcibios_init(void);
 
-void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
 static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
 
 void __devinit pcibios_fixup_bus(struct pci_bus *bus);
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 9d610d3..2556793 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -466,27 +466,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 	return 0;
 }
 
-void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
-{
-	unsigned long start = pci_resource_start(dev, bar);
-	unsigned long 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_MEM)) {
-		pr_info("PCI: Trying to map invalid resource %#lx\n", flags);
-		start = 0;
-	}
-
-	return (void __iomem *)start;
-}
-EXPORT_SYMBOL(pci_iomap);
-
-
 /****************************************************************
  *
  * Tile PCI config space read/write routines
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 13/16] frv: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (11 preceding siblings ...)
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 12/16] tile: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 15/16] mn10300: " Michael S. Tsirkin
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

frv uses a version of pci_iomap that simply
casts and returns back the start address.
Looking closely, both ioremap and ioport_map seem to
do this on this platform, so the generic pci_iomap
will DTRT automatically.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/frv/Kconfig                  |    1 +
 arch/frv/include/asm/io.h         |    2 +-
 arch/frv/mb93090-mb00/Makefile    |    2 +-
 arch/frv/mb93090-mb00/pci-iomap.c |   29 -----------------------------
 4 files changed, 3 insertions(+), 31 deletions(-)
 delete mode 100644 arch/frv/mb93090-mb00/pci-iomap.c

diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index bad27a6..dfde78b 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -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
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h
index ca7475e..8cb50a2 100644
--- a/arch/frv/include/asm/io.h
+++ b/arch/frv/include/asm/io.h
@@ -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>
 
 /*
@@ -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)
 {
 }
diff --git a/arch/frv/mb93090-mb00/Makefile b/arch/frv/mb93090-mb00/Makefile
index b73b542..21f1df1 100644
--- a/arch/frv/mb93090-mb00/Makefile
+++ b/arch/frv/mb93090-mb00/Makefile
@@ -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
diff --git a/arch/frv/mb93090-mb00/pci-iomap.c b/arch/frv/mb93090-mb00/pci-iomap.c
deleted file mode 100644
index 35f6df2..0000000
--- a/arch/frv/mb93090-mb00/pci-iomap.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* pci-iomap.c: description
- *
- * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowells@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#include <linux/pci.h>
-#include <linux/module.h>
-
-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 ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
-		return (void __iomem *) start;
-
-	return NULL;
-}
-
-EXPORT_SYMBOL(pci_iomap);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 15/16] mn10300: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (12 preceding siblings ...)
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 13/16] frv: " Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 14/16] mn10300: add missing __iomap markers Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 16/16] alpha: drop pci_iomap/pci_iounmap from pci-noop.c Michael S. Tsirkin
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

The pci_iomap variant that arch/mn10300/unit-asb2305/pci-iomap.c
uses differs from the generic one in that it does
not use ioremap_nocache for PCI addresses.
However, it turns out that PCI addresses are
automatically noncached, so switching to ioremap_nocache
and to the generic implementation is safe.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/mn10300/Kconfig                  |    1 +
 arch/mn10300/include/asm/io.h         |    1 -
 arch/mn10300/unit-asb2305/Makefile    |    2 +-
 arch/mn10300/unit-asb2305/pci-iomap.c |   31 -------------------------------
 4 files changed, 2 insertions(+), 33 deletions(-)
 delete mode 100644 arch/mn10300/unit-asb2305/pci-iomap.c

diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 438db84..8f1c40d 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -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.
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index 0d6d54f..139df8c 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -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)
 {
 }
diff --git a/arch/mn10300/unit-asb2305/Makefile b/arch/mn10300/unit-asb2305/Makefile
index 0551022..cbc5aba 100644
--- a/arch/mn10300/unit-asb2305/Makefile
+++ b/arch/mn10300/unit-asb2305/Makefile
@@ -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
diff --git a/arch/mn10300/unit-asb2305/pci-iomap.c b/arch/mn10300/unit-asb2305/pci-iomap.c
deleted file mode 100644
index c1a8d8f..0000000
--- a/arch/mn10300/unit-asb2305/pci-iomap.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ASB2305 PCI I/O mapping handler
- *
- * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
- * Written by David Howells (dhowells@redhat.com)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licence
- * as published by the Free Software Foundation; either version
- * 2 of the Licence, or (at your option) any later version.
- */
-#include <linux/pci.h>
-#include <linux/module.h>
-
-/*
- * 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 ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
-		return (void __iomem *) start;
-
-	return NULL;
-}
-EXPORT_SYMBOL(pci_iomap);
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 14/16] mn10300: add missing __iomap markers
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (13 preceding siblings ...)
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 15/16] mn10300: " Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 16/16] alpha: drop pci_iomap/pci_iounmap from pci-noop.c Michael S. Tsirkin
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

MN10300's *ioremap*() collection lacks __iomem markers.
Fix that.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/mn10300/include/asm/io.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h
index 787255d..0d6d54f 100644
--- a/arch/mn10300/include/asm/io.h
+++ b/arch/mn10300/include/asm/io.h
@@ -251,15 +251,15 @@ 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;
 }
 
 /*
@@ -267,14 +267,14 @@ static inline void *ioremap(unsigned long offset, unsigned long size)
  * 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)
 {
 }
 
-- 
1.7.8.382.g3daff


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCHv2 RFC (repost) 16/16] alpha: drop pci_iomap/pci_iounmap from pci-noop.c
  2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
                   ` (14 preceding siblings ...)
  2011-12-21 16:30 ` [PATCHv2 RFC (repost) 14/16] mn10300: add missing __iomap markers Michael S. Tsirkin
@ 2011-12-21 16:30 ` Michael S. Tsirkin
  15 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-21 16:30 UTC (permalink / raw)
  To: linux-alpha, linux-kernel

Jenkins disables PCI so asm-generic provides inline
stubs for these, we don't need offline stubs as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 arch/alpha/kernel/pci-noop.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index 246100e..04eea48 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -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);
-- 
1.7.8.382.g3daff

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCHv2 RFC (repost) 10/16] sparc: switch to GENERIC_PCI_IOMAP
  2011-12-21 16:29 ` [PATCHv2 RFC (repost) 10/16] sparc: " Michael S. Tsirkin
@ 2011-12-21 20:39   ` David Miller
  2011-12-22  8:26     ` Michael S. Tsirkin
  0 siblings, 1 reply; 19+ messages in thread
From: David Miller @ 2011-12-21 20:39 UTC (permalink / raw)
  To: mst; +Cc: linux-alpha, linux-kernel

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 21 Dec 2011 18:29:51 +0200

> sparc copied pci_iomap from generic code, probably to avoid
> pulling the rest of iomap.c in.  Since that's in
> a separate file now, we can reuse the common implementation.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Acked-by: David S. Miller <davem@davemloft.net>

FWIW, I just tested this as well and it works fine.

BTW, must be a thinko that you're CC:'ing linux-alpha for this
patch :-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCHv2 RFC (repost) 10/16] sparc: switch to GENERIC_PCI_IOMAP
  2011-12-21 20:39   ` David Miller
@ 2011-12-22  8:26     ` Michael S. Tsirkin
  0 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2011-12-22  8:26 UTC (permalink / raw)
  To: David Miller; +Cc: linux-alpha, linux-kernel

On Wed, Dec 21, 2011 at 03:39:42PM -0500, David Miller wrote:
> From: "Michael S. Tsirkin" <mst@redhat.com>
> Date: Wed, 21 Dec 2011 18:29:51 +0200
> 
> > sparc copied pci_iomap from generic code, probably to avoid
> > pulling the rest of iomap.c in.  Since that's in
> > a separate file now, we can reuse the common implementation.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Acked-by: David S. Miller <davem@davemloft.net>
> 
> FWIW, I just tested this as well and it works fine.

Thanks very much.

> BTW, must be a thinko that you're CC:'ing linux-alpha for this
> patch :-)

Ugh. Thanks for pointing this out: I really intended linux-arch.
I guess I won't repost this yet another time, made enough noise already.
At least linux-kernel was spelled correctly :)

Will try to Cc the pull request correctly.
Thanks,

-- 
MST

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-12-22  8:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 16:29 [PATCHv2 RFC (repost) 00/16] pci: use generic pci_iomap on all architectures Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 01/16] lib: move GENERIC_IOMAP to lib/Kconfig Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 02/16] lib: add GENERIC_PCI_IOMAP Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 03/16] alpha: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 04/16] arm: " Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 05/16] microblaze: " Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 08/16] powerpc: " Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 06/16] mips: " Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 09/16] sh: " Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 10/16] sparc: " Michael S. Tsirkin
2011-12-21 20:39   ` David Miller
2011-12-22  8:26     ` Michael S. Tsirkin
2011-12-21 16:29 ` [PATCHv2 RFC (repost) 07/16] parisc: " Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 11/16] tile: don't panic on iomap Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 12/16] tile: switch to GENERIC_PCI_IOMAP Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 13/16] frv: " Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 15/16] mn10300: " Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 14/16] mn10300: add missing __iomap markers Michael S. Tsirkin
2011-12-21 16:30 ` [PATCHv2 RFC (repost) 16/16] alpha: drop pci_iomap/pci_iounmap from pci-noop.c Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.