Skip to content

PCI resource mmap cleanup

David Woodhouse linux-arch linux-pci lkml 2 versions – Applied

Status from this message: Applied to pci/resource-mmap for v4.12, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest27 patches 11 repliesApplied
  2. v117 patches 19 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/27pci: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platformsdrivers/pci/pci-sysfs.c+7 -30 replies
2/27pci: Fix another sanity check bug in /proc/pci mmapdrivers/pci/proc.c+8 -20 replies
3/27pci: Only allow WC mmap on prefetchable resourcesdrivers/pci/proc.c+8 -50 replies
4/27xtensa: Do not mmap PCI BARs to userspace as write-througharch/xtensa/kernel/pci.c+1 -200 replies
5/27pci: Add arch_can_pci_mmap_wc() macroDocumentation/filesystems/sysfs-pci.txt arch/ia64/include/asm/pci.h arch/powerpc/include/asm/pci.h +4 more+25 -110 replies
6/27pci: Move multiple declarations of pci_mmap_page_range() to <linux/pci.h>arch/arm/include/asm/pci.h arch/cris/include/asm/pci.h arch/ia64/include/asm/pci.h +11 more+8 -380 replies
7/27pci: Add arch_can_pci_mmap_io() on architectures which can mmap() I/O spaceDocumentation/filesystems/sysfs-pci.txt arch/microblaze/include/asm/pci.h arch/powerpc/include/asm/pci.h +5 more+26 -120 replies
8/27pci: Use BAR index in sysfs attr->private instead of resource pointerdrivers/pci/pci-sysfs.c+14 -240 replies
9/27pci: Add BAR index argument to pci_mmap_page_range()arch/arm/kernel/bios32.c arch/cris/arch-v32/drivers/pci/bios.c arch/ia64/pci/pci.c +13 more+30 -180 replies
10/27pci: Add pci_mmap_resource_range() and use it for ARM64Documentation/filesystems/sysfs-pci.txt arch/arm64/include/asm/pci.h drivers/pci/Makefile +4 more+114 -201 reply
11/27arm: Use generic pci_mmap_resource_range()arch/arm/include/asm/pci.h arch/arm/kernel/bios32.c+1 -200 replies
12/27cris: Use generic pci_mmap_resource_range()arch/cris/arch-v32/drivers/pci/bios.c arch/cris/include/asm/pci.h+1 -232 replies
13/27mips: Use generic pci_mmap_resource_range()arch/mips/include/asm/pci.h arch/mips/pci/pci.c+1 -260 replies
14/27mn10300: Use generic pci_mmap_resource_range()arch/mn10300/include/asm/pci.h arch/mn10300/unit-asb2305/pci-asb2305.c+1 -241 reply
15/27parisc: Use generic pci_mmap_resource_range()arch/parisc/include/asm/pci.h arch/parisc/kernel/pci.c+1 -290 replies
16/27sh: Use generic pci_mmap_resource_range()arch/sh/drivers/pci/pci.c arch/sh/include/asm/pci.h+1 -220 replies
17/27unicore: Use generic pci_mmap_resource_range()arch/unicore32/include/asm/pci.h arch/unicore32/kernel/pci.c+1 -240 replies
18/27x86: Use generic pci_mmap_resource_range()arch/x86/include/asm/pci.h arch/x86/pci/i386.c+1 -480 replies
19/27pci: Add I/O BAR support to generic pci_mmap_resource_range()drivers/pci/mmap.c include/linux/pci.h+11 -40 replies
20/27powerpc: Use generic pci_mmap_resource_range()arch/powerpc/include/asm/pci.h arch/powerpc/kernel/pci-common.c+15 -1000 replies
21/27microblaze: Use generic pci_mmap_resource_range()arch/microblaze/include/asm/pci.h arch/microblaze/pci/pci-common.c+13 -930 replies
22/27xtensa: Use generic pci_mmap_resource_range()arch/xtensa/include/asm/pci.h arch/xtensa/kernel/pci.c+12 -890 replies
23/27ia64: Remove redundant valid_mmap_phys_addr_range() from pci_mmap_page_range()arch/ia64/pci/pci.c+0 -30 replies
24/27ia64: Remove redundant checks for WC in pci_mmap_page_range()arch/ia64/pci/pci.c+2 -160 replies
25/27ia64: Use generic pci_mmap_resource_range()arch/ia64/include/asm/pci.h arch/ia64/pci/pci.c+1 -303 replies
26/27sparc: Use generic pci_mmap_resource_range()arch/sparc/include/asm/pci_64.h arch/sparc/kernel/pci.c+1 -1550 replies
27/27pci: Kill ARCH_GENERIC_PCI_MMAP_RESOURCEDocumentation/filesystems/sysfs-pci.txt arch/arm/include/asm/pci.h arch/arm64/include/asm/pci.h +15 more+6 -450 replies

Reviews trailers per patch

2 of 27 patches have a Reviewed-by or Acked-by.

PatchTony LuckJesper NilssonDavid Howells
1/27
2/27
3/27
4/27
5/27
6/27
7/27
8/27
9/27
10/27
11/27
12/27A-b
13/27
14/27R-b
15/27
16/27
17/27
18/27
19/27
20/27
21/27
22/27
23/27
24/27
25/27T-b
26/27
27/27

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/27] PCI resource mmap cleanup

This pursues my previous patch set all the way to its logical conclusion.

It kills off the legacy arch-provided pci_mmap_page_range() completely, along with its vile 'address converted by pci_resource_to_user()' API and the various bugs and other strange behaviour that various architectures had.

In some cases like IA64 I've killed off the odd behaviour *first* in separately reviewable patches, before the final switch over to the generic code which should then basically have no functional effect.

To accommodate the ARM64 maintainers' desire *not* to support mmap through /proc/bus/pci I have separated HAVE_PCI_MMAP from the sysfs implementation, which (as of the last patch in the series) ends up present on *all* platforms with an MMU. I still don't think that's a *good* idea though; it's a generic part of /proc, and nobody ever did answer my question about what *else* we can delete from /proc on ARM64 "because it's a new platform"...

I would very much like the interesting parts of this to go through the arch maintainers' trees. I'd suggest that we can pull everything up to and including patch 19 ("pci: Add I/O BAR support to generic pci_mmap_resource_range()") through the PCI tree, which includes the relatively trivial architectures. Then the others can go through the appropriate arch tree with more careful review and testing.

Once everything's done, then we can apply something like the final patch ("pci: Kill ARCH_GENERIC_PCI_MMAP_RESOURCE"). But that's mostly just there for now as a demonstration of the intended end point.

This is in
git://git.infradead.org/users/dwmw2/random-2.6.git pcimmap
http://git.infradead.org/users/dwmw2/random-2.6.git/shortlog/refs/heads/pcimmap

David Woodhouse (27):
pci: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms
pci: Fix another sanity check bug in /proc/pci mmap
pci: Only allow WC mmap on prefetchable resources
xtensa: Do not mmap PCI BARs to userspace as write-through
pci: Add arch_can_pci_mmap_wc() macro
pci: Move multiple declarations of pci_mmap_page_range() to

    <linux/pci.h>

pci: Add arch_can_pci_mmap_io() on architectures which can mmap() I/O
space
pci: Use BAR index in sysfs attr->private instead of resource pointer
pci: Add BAR index argument to pci_mmap_page_range()
pci: Add pci_mmap_resource_range() and use it for ARM64
arm: Use generic pci_mmap_resource_range()
cris: Use generic pci_mmap_resource_range()
mips: Use generic pci_mmap_resource_range()
mn10300: Use generic pci_mmap_resource_range()
parisc: Use generic pci_mmap_resource_range()
sh: Use generic pci_mmap_resource_range()
unicore: Use generic pci_mmap_resource_range()
x86: Use generic pci_mmap_resource_range()
pci: Add I/O BAR support to generic pci_mmap_resource_range()
powerpc: Use generic pci_mmap_resource_range()
microblaze: Use generic pci_mmap_resource_range()
xtensa: Use generic pci_mmap_resource_range()
ia64: Remove redundant valid_mmap_phys_addr_range() from
pci_mmap_page_range()
ia64: Remove redundant checks for WC in pci_mmap_page_range()
ia64: Use generic pci_mmap_resource_range()
sparc: Use generic pci_mmap_resource_range()
pci: Kill ARCH_GENERIC_PCI_MMAP_RESOURCE

 Documentation/filesystems/sysfs-pci.txt |  12 ++-
 arch/arm/include/asm/pci.h              |   2 -
 arch/arm/kernel/bios32.c                |  19 ----
 arch/cris/arch-v32/drivers/pci/bios.c   |  22 -----
 arch/cris/include/asm/pci.h             |   3 -
 arch/ia64/include/asm/pci.h             |   4 +-
 arch/ia64/pci/pci.c                     |  46 ----------
 arch/microblaze/include/asm/pci.h       |   8 +-
 arch/microblaze/pci/pci-common.c        |  99 ++------------------
 arch/mips/include/asm/pci.h             |   4 -
 arch/mips/pci/pci.c                     |  24 -----
 arch/mn10300/include/asm/pci.h          |   3 -
 arch/mn10300/unit-asb2305/pci-asb2305.c |  23 -----
 arch/parisc/include/asm/pci.h           |   3 -
 arch/parisc/kernel/pci.c                |  28 ------
 arch/powerpc/include/asm/pci.h          |   9 +-
 arch/powerpc/kernel/pci-common.c        | 105 +++-------------------
 arch/sh/drivers/pci/pci.c               |  21 -----
 arch/sh/include/asm/pci.h               |   3 +-
 arch/sparc/include/asm/pci_64.h         |   5 +-
 arch/sparc/kernel/pci.c                 | 155 --------------------------------
 arch/unicore32/include/asm/pci.h        |   2 -
 arch/unicore32/kernel/pci.c             |  23 -----
 arch/x86/include/asm/pci.h              |   6 +-
 arch/x86/pci/i386.c                     |  47 ----------
 arch/xtensa/include/asm/pci.h           |   9 +-
 arch/xtensa/kernel/pci.c                | 112 ++---------------------
 drivers/pci/Makefile                    |   1 +
 drivers/pci/mmap.c                      |  67 ++++++++++++++
 drivers/pci/pci-sysfs.c                 |  76 +++++++---------
 drivers/pci/pci.h                       |   4 +-
 drivers/pci/proc.c                      |  41 ++++++---
 include/linux/pci.h                     |  30 +++++++
 33 files changed, 211 insertions(+), 805 deletions(-)
 create mode 100644 drivers/pci/mmap.c
Signature · 1 line
2.9.3