]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
pci: Kill ARCH_GENERIC_PCI_MMAP_RESOURCE pcimmap
authorDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 10 Apr 2017 20:02:09 +0000 (21:02 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 19 Feb 2018 12:40:53 +0000 (12:40 +0000)
Now that every architecture does it, we can kill the #define. This does have
the side-effect that other architectures which previously didn't support
mmap on sysfs resource files now get it.

We have an exemption for !MMU (obviously) and for Alpha (with its bizarre
setup for pre-BWX CPUs).

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
19 files changed:
Documentation/filesystems/sysfs-pci.txt
arch/arm/include/asm/pci.h
arch/arm64/include/asm/pci.h
arch/cris/include/asm/pci.h
arch/ia64/include/asm/pci.h
arch/microblaze/include/asm/pci.h
arch/mips/include/asm/pci.h
arch/mn10300/include/asm/pci.h
arch/parisc/include/asm/pci.h
arch/powerpc/include/asm/pci.h
arch/sh/include/asm/pci.h
arch/sparc/include/asm/pci_64.h
arch/unicore32/include/asm/pci.h
arch/x86/include/asm/pci.h
arch/xtensa/include/asm/pci.h
drivers/pci/Makefile
drivers/pci/mmap.c
drivers/pci/pci-sysfs.c
include/linux/pci.h

index 06f1d64c6f702fa2507b748b6feb5a6bddf20975..0aff2fee009490870aed991b801c6749bc181488 100644 (file)
@@ -112,14 +112,9 @@ to access legacy memory space.
 Supporting PCI access on new platforms
 --------------------------------------
 
-In order to support PCI resource mapping as described above, Linux platform
-code should ideally define ARCH_GENERIC_PCI_MMAP_RESOURCE and use the generic
-implementation of that functionality. To support the historical interface of
-mmap() through files in /proc/bus/pci, platforms may also set HAVE_PCI_MMAP.
-
-Alternatively, platforms which set HAVE_PCI_MMAP may provide their own
-implementation of pci_mmap_page_range() instead of defining
-ARCH_GENERIC_PCI_MMAP_RESOURCE.
+To support the historical interface of mmap() through files in /proc/bus/pci,
+platforms may also set HAVE_PCI_MMAP. The mapping through sysfs is supported
+through generic code.
 
 Platforms which support write-combining maps of PCI resources must define
 arch_can_pci_mmap_wc() which shall evaluate to non-zero at runtime when
index 1f0de808d111e91beb3d9aaf2f07d5a32842f390..f79ebe8b501916b37ffe78e8f9ccd49a97bae6fa 100644 (file)
@@ -27,7 +27,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 #define PCI_DMA_BUS_IS_PHYS     (1)
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
index 8747f7c5e0e75a88b509749f91744fb6f73725e6..1d351939d9ec658214cca91b90061ebdc80e9b71 100644 (file)
@@ -23,8 +23,6 @@
  */
 #define PCI_DMA_BUS_IS_PHYS    (0)
 
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
-
 extern int isa_dma_bridge_buggy;
 
 #ifdef CONFIG_PCI
index dcfef6407ae647df54071435bf31b93f017a0968..ae763c9fc4a66796996710fd6d77bf6948915e12 100644 (file)
@@ -34,7 +34,6 @@
 #define PCI_DMA_BUS_IS_PHYS    (1)
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 #endif /* __KERNEL__ */
 
index b1d04e8bafc86816324b8c6c3eb08bdd607c89c9..2557a2537908d2353ee82f8e96b807d15694077c 100644 (file)
@@ -48,7 +48,6 @@ extern unsigned long ia64_max_iommu_merge_mask;
 #define PCI_DMA_BUS_IS_PHYS    (ia64_max_iommu_merge_mask == ~0UL)
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define arch_can_pci_mmap_wc() 1
 
 #define HAVE_PCI_LEGACY
index 5de871eb4a59176773d1c9fac3b53433a258396a..c2687004642f95febf9d3b7db3e3577caead3432 100644 (file)
@@ -49,7 +49,6 @@ struct vm_area_struct;
 
 /* Tell PCI code what kind of PCI resource mappings we support */
 #define HAVE_PCI_MMAP                  1
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
 #define arch_can_pci_mmap_io()         1
 
 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
index 2339f42f047ac38097682dc9c82acd4da7c17f6f..aa7b8ca5d9cc441541d41e78e1d8fc8d2f11d0f3 100644 (file)
@@ -107,7 +107,6 @@ extern unsigned long PCIBIOS_MIN_MEM;
 #define PCIBIOS_MIN_CARDBUS_IO 0x4000
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define HAVE_ARCH_PCI_RESOURCE_TO_USER
 
 /*
index 5b75a1b2c4f6213bbf3b4a952c89689cb5b1dc8f..99116d4bbba4948fdda9a8bfc1b6347ce8b7cd96 100644 (file)
@@ -70,7 +70,6 @@ static inline int pci_controller_num(struct pci_dev *dev)
 }
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 #endif /* __KERNEL__ */
 
index 96b7deec512d3c26f340bb5ceb16f553330fe299..20965718f2b0c146be05d44fb729c8666fa4a7d0 100644 (file)
@@ -193,6 +193,5 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 }
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 #endif /* __ASM_PARISC_PCI_H */
index 401c62aad5e4ee6d8924cccd277d8e67914cd07f..1ecfb24e17b91a55c6b6f93a1d5e0492aa02d77a 100644 (file)
@@ -78,7 +78,6 @@ struct vm_area_struct;
 
 /* Tell PCI code what kind of PCI resource mappings we support */
 #define HAVE_PCI_MMAP                  1
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
 #define arch_can_pci_mmap_io()         1
 #define arch_can_pci_mmap_wc()         1
 
index 0033f0df2b3b239454312a1fc791c2f73655b486..5802cd7e523f2e09657492b9cf274ef20723ba77 100644 (file)
@@ -65,7 +65,6 @@ extern int pci_is_66mhz_capable(struct pci_channel *hose,
 extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM;
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 /* Dynamic DMA mapping stuff.
  * SuperH has everything mapped statically like x86.
index 95d41c827391fecf419a549a59b1a43d9652bb4f..671274e36cfad050c3b10cfabaa02ddbcf962235 100644 (file)
@@ -43,7 +43,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 /* Platform support for /proc/bus/pci/X/Y mmap()s. */
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 #define arch_can_pci_mmap_io() 1
 #define HAVE_ARCH_PCI_GET_UNMAPPED_AREA
 #define get_pci_unmapped_area get_fb_unmapped_area
index ac5acdf4c4d01d35c49adcdd3142df513feaf48f..a51290862acdd5303677d8cb14dcf45f6a507c27 100644 (file)
@@ -17,7 +17,6 @@
 #include <mach/hardware.h> /* for PCIBIOS_MIN_* */
 
 #define HAVE_PCI_MMAP
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 #endif /* __KERNEL__ */
 #endif
index d32175e302593f62be02481505b0db4c1edf5ab9..f71c0d119756a4548fbbfcfd3f8a9f5e7497a85a 100644 (file)
@@ -97,7 +97,6 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 
 #define HAVE_PCI_MMAP
 #define arch_can_pci_mmap_wc() pat_enabled()
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE
 
 #ifdef CONFIG_PCI
 extern void early_quirks(void);
index d5a82153a7c5d87b4ad6e02085956eb486393e39..c312ee3929b3b5115f08138c1a431db7ed8750a0 100644 (file)
@@ -46,7 +46,6 @@ extern struct pci_controller* pcibios_alloc_controller(void);
 
 /* Tell PCI code what kind of PCI resource mappings we support */
 #define HAVE_PCI_MMAP                  1
-#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1
 #define arch_can_pci_mmap_io()         1
 
 #endif /* __KERNEL__ */
index 941970936840eadc9c14abcb41fd4627907ff8ba..915acda945baf0962b8c6f34bac29e2c7cfed303 100644 (file)
@@ -5,9 +5,10 @@
 
 obj-$(CONFIG_PCI)      += access.o bus.o probe.o host-bridge.o remove.o pci.o \
                        pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \
-                       irq.o vpd.o setup-bus.o vc.o mmap.o setup-irq.o
+                       irq.o vpd.o setup-bus.o vc.o setup-irq.o
 
 ifdef CONFIG_PCI
+obj-$(CONFIG_MMU) += mmap.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_SYSFS) += slot.o
 obj-$(CONFIG_OF) += of.o
index 814a3ce341fcd116a93a5fa6fa4a12dfdfc0fbce..c4dc4eaf739c5d5fb04c699f9922e3a12dbf218e 100644 (file)
@@ -11,8 +11,6 @@
 #include <linux/mm.h>
 #include <linux/pci.h>
 
-#ifdef ARCH_GENERIC_PCI_MMAP_RESOURCE
-
 /*
  * Modern setup: generic pci_mmap_resource_range(), and implement the legacy
  * pci_mmap_page_range() (if needed) as a wrapper round it.
@@ -69,28 +67,3 @@ int pci_mmap_resource_range(struct pci_dev *pdev, int bar,
                                  vma->vm_end - vma->vm_start,
                                  vma->vm_page_prot);
 }
-
-#elif defined(HAVE_PCI_MMAP) /* && !ARCH_GENERIC_PCI_MMAP_RESOURCE */
-
-/*
- * Legacy setup: Impement pci_mmap_resource_range() as a wrapper around
- * the architecture's pci_mmap_page_range(), converting to "user visible"
- * addresses as necessary.
- */
-
-int pci_mmap_resource_range(struct pci_dev *pdev, int bar,
-                           struct vm_area_struct *vma,
-                           enum pci_mmap_state mmap_state, int write_combine)
-{
-       resource_size_t start, end;
-
-       /*
-        * pci_mmap_page_range() expects the same kind of entry as coming
-        * from /proc/bus/pci/ which is a "user visible" value. If this is
-        * different from the resource itself, arch will do necessary fixup.
-        */
-       pci_resource_to_user(pdev, bar, &pdev->resource[bar], &start, &end);
-       vma->vm_pgoff += start >> PAGE_SHIFT;
-       return pci_mmap_page_range(pdev, bar, vma, mmap_state, write_combine);
-}
-#endif
index eb6bee8724cc1c9243213ab446666bac6c9395eb..1a8cb40902d8a3f60a6bd6bfc9bbd31ad817663b 100644 (file)
@@ -1183,7 +1183,7 @@ void pci_remove_legacy_files(struct pci_bus *b)
 }
 #endif /* HAVE_PCI_LEGACY */
 
-#if defined(HAVE_PCI_MMAP) || defined(ARCH_GENERIC_PCI_MMAP_RESOURCE)
+#if defined(CONFIG_MMU) && !defined(__alpha__)
 
 int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma,
                  enum pci_mmap_api mmap_api)
index 024a1beda008c69d21bd65fe8d1a36cc92a6021a..09d9dcf1f2ea820dcbd4de2abcac2b4c627bb322 100644 (file)
@@ -1689,17 +1689,14 @@ static inline int pci_irqd_intx_xlate(struct irq_domain *d,
 
 #include <asm/pci.h>
 
-/* These two functions provide almost identical functionality. Depennding
- * on the architecture, one will be implemented as a wrapper around the
- * other (in drivers/pci/mmap.c).
+/* These two functions provide almost identical functionality.
  *
  * pci_mmap_resource_range() maps a specific BAR, and vm->vm_pgoff
  * is expected to be an offset within that region.
  *
- * pci_mmap_page_range() is the legacy architecture-specific interface,
- * which accepts a "user visible" resource address converted by
- * pci_resource_to_user(), as used in the legacy mmap() interface in
- * /proc/bus/pci/.
+ * pci_mmap_page_range() is the legacy interface which accepts a "user
+ * visible" resource address converted by pci_resource_to_user(), as
+ * used in the legacy mmap() interface in /proc/bus/pci/.
  */
 int pci_mmap_resource_range(struct pci_dev *dev, int bar,
                            struct vm_area_struct *vma,