Skip to content

PCI: Resource allocation cleanup for v4.7

Yinghai Lu linux-acpi linux-alpha linux-arch linux-devicetree linux-ia64 linux-iommu linux-pci linux-sh linuxppc-dev lkml sparclinux stable 11 versions – Applied

Status from this message: I applied these first two patches to pci/resource for v4.7.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v11 Latest60 patches 25 repliesApplied
  2. v1059 patches 17 repliesSuperseded
  3. v960 patches 0 repliesSuperseded
Earlier versions · 8
VersionPostedPatchesRepliesStatus
v861 patches8 repliesSuperseded
v760 patches40 repliesSuperseded
v653 patches5 repliesSuperseded
v553 patches2 repliesSuperseded
v452 patches10 repliesSuperseded
v351 patches29 repliesSuperseded
v249 patches2 repliesSuperseded
v136 patches14 repliesSuperseded

Patches in v11 Applied

#Subject and filesSizeRepliesApplied
1/60PCI: Fix iomem_is_exclusive() checking in pci_mmap_resource()drivers/pci/pci-sysfs.c+3 -40 replies
2/60alpha/PCI: Only check iomem_is_exclusive() for IORESOURCE_MEM, not IORESOURCE_IOarch/alpha/kernel/pci-sysfs.c+2 -21 reply
3/60PCI: Add pci_find_bus_resource()drivers/pci/pci.c include/linux/pci.h+18 -110 replies
4/60sparc/PCI: Use correct offset for bus address to resourcearch/sparc/kernel/pci.c arch/sparc/kernel/pci_common.c arch/sparc/kernel/pci_impl.h+54 -3619 replies
5/60sparc/PCI: Reserve legacy mmio after PCI mmioarch/sparc/kernel/pci.c arch/sparc/kernel/pci_common.c arch/sparc/kernel/pci_impl.h+33 -280 replies
6/60sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsingarch/sparc/kernel/of_device_32.c arch/sparc/kernel/of_device_64.c+6 -40 replies
7/60sparc/PCI: Keep resource idx order with bridge register numberarch/sparc/kernel/pci.c+7 -10 replies
8/60PCI: Kill wrong quirk about M7101drivers/pci/quirks.c+0 -180 replies
9/60powerpc/PCI: Keep resource idx order with bridge register numberarch/powerpc/kernel/pci_of_scan.c+7 -10 replies
10/60powerpc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsingarch/powerpc/kernel/pci_of_scan.c+3 -10 replies
11/60OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resourcedrivers/of/address.c+3 -10 replies
12/60PCI: Check pref compatible bit for mem64 resource of PCIe devicearch/sparc/kernel/pci.c arch/sparc/kernel/pci_common.c drivers/pci/pci.c +5 more+67 -100 replies
13/60PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64drivers/pci/setup-bus.c+29 -20 replies
14/60PCI: Add has_mem64 for struct host_bridgedrivers/pci/probe.c include/linux/pci.h+8 -00 replies
15/60PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64drivers/pci/setup-bus.c+1 -10 replies
16/60PCI: Restore pref MMIO allocation logic for host bridge without mmio64drivers/pci/bus.c drivers/pci/setup-bus.c drivers/pci/setup-res.c+18 -80 replies
17/60PCI: Don't release fixed resource for reallocdrivers/pci/setup-bus.c include/linux/ioport.h kernel/resource.c+31 -50 replies
18/60PCI: Claim fixed resource during remove/rescan pathdrivers/pci/quirks.c+17 -00 replies
19/60PCI: Set resource to FIXED for LSI devicesdrivers/pci/pci.h drivers/pci/quirks.c drivers/pci/setup-bus.c+25 -00 replies
20/60PCI: Separate realloc list checking after allocationdrivers/pci/hotplug/acpiphp_glue.c drivers/pci/pci.h drivers/pci/setup-bus.c+11 -30 replies
21/60PCI: Treat optional as required in first try for bridge rescandrivers/pci/setup-bus.c+14 -50 replies
22/60PCI: Get new realloc size for bridge for last trydrivers/pci/setup-bus.c+21 -20 replies
23/60PCI: Don't release sibling bridge resources during hotplugdrivers/pci/setup-bus.c+8 -20 replies
24/60PCI: Cleanup res_to_dev_res() printoutdrivers/pci/setup-bus.c+20 -140 replies
25/60PCI: Reuse res_to_dev_res() in reassign_resources_sorted()drivers/pci/setup-bus.c+1 -100 replies
26/60PCI: Use correct align for optional only resources during sortingdrivers/pci/setup-bus.c+42 -70 replies
27/60PCI: Optimize bus min_align/size calculation during sizingdrivers/pci/setup-bus.c+157 -380 replies
28/60PCI: Optimize bus align/size calculation for optional during sizingdrivers/pci/setup-bus.c+51 -310 replies
29/60PCI: Don't add too much optional size for hotplug bridge MMIOdrivers/pci/setup-bus.c+15 -130 replies
30/60PCI: Reorder resources list for required/optional resourcesdrivers/pci/setup-bus.c+37 -250 replies
31/60PCI: Remove duplicated code for resource sortingdrivers/pci/setup-bus.c+3 -190 replies
32/60PCI: Rename pdev_sort_resources() to pdev_assign_resources_prepare()drivers/pci/setup-bus.c+6 -60 replies
33/60PCI: Treat ROM resource as optional during reallocdrivers/pci/setup-bus.c+20 -170 replies
34/60PCI: Add debug printout during releasing partial assigned resourcesdrivers/pci/setup-bus.c+11 -30 replies
35/60PCI: Simplify res reference using in __assign_resources_sorted()drivers/pci/setup-bus.c+16 -160 replies
36/60PCI: Add __add_to_list()drivers/pci/setup-bus.c+31 -200 replies
37/60PCI: Cache window alignment value during bus sizingdrivers/pci/setup-bus.c+6 -30 replies
38/60PCI: Check if resource is allocated before trying to assign onedrivers/pci/setup-bus.c+1 -10 replies
39/60PCI: Separate out save_resources()/restore_resources()drivers/pci/setup-bus.c+30 -190 replies
40/60PCI: Move comment to pci_need_to_release()drivers/pci/setup-bus.c+15 -120 replies
41/60PCI: Separate required+optional assigning to another functiondrivers/pci/setup-bus.c+27 -200 replies
42/60PCI: Skip required+optional if there is no optionaldrivers/pci/setup-bus.c+29 -30 replies
43/60PCI: Move saved required resource list out of required+optional assigningdrivers/pci/setup-bus.c+16 -140 replies
44/60PCI: Add alt_size ressource allocation supportdrivers/pci/setup-bus.c+191 -123 replies
45/60PCI: Add support for more than two alt_size entries under same bridgedrivers/pci/setup-bus.c+54 -20 replies
46/60PCI: Fix size calculation with old_size on rescan pathdrivers/pci/setup-bus.c+12 -10 replies
47/60PCI: Don't add too much optional size for hotplug bridge iodrivers/pci/setup-bus.c+16 -100 replies
48/60PCI: Move ISA io port align out of calculate_iosize()drivers/pci/setup-bus.c+27 -120 replies
49/60PCI: Don't add too much io port for hotplug bridge with old sizedrivers/pci/setup-bus.c+4 -40 replies
50/60PCI: Unify calculate_size() for io port and MMIOdrivers/pci/setup-bus.c+5 -200 replies
51/60PCI: Allow bridge optional only io port resource required size to be 0drivers/pci/setup-bus.c+4 -30 replies
52/60PCI: Unify skip_ioresource_align()arch/powerpc/kernel/pci-common.c arch/x86/include/asm/pci_x86.h arch/x86/pci/common.c +3 more+15 -230 replies
53/60PCI: Kill macro checking for bus io port sizingdrivers/pci/setup-bus.c+7 -100 replies
54/60resources: Make allocate_resource() return best fit resourcekernel/resource.c+61 -150 replies
55/60PCI, x86: Allocate from high in available window for MMIOarch/x86/pci/i386.c drivers/pci/setup-bus.c include/linux/pci.h+33 -10 replies
56/60PCI: Add debug print out for min_align and alt_sizedrivers/pci/setup-bus.c+56 -200 replies
57/60PCI, x86: Add pci=assign_pref_bars to reallocate pref BARsarch/x86/include/asm/pci_x86.h arch/x86/pci/common.c arch/x86/pci/i386.c+39 -210 replies
58/60PCI: Introduce resource_disabled()arch/alpha/kernel/pci.c arch/ia64/pci/pci.c arch/microblaze/pci/pci-common.c +17 more+53 -450 replies
59/60PCI: Don't set flags to 0 when assign resource faildrivers/pci/bus.c drivers/pci/setup-bus.c drivers/pci/setup-res.c+26 -240 replies
60/60PCI: Only try to assign io port only for root bus that support itdrivers/pci/probe.c drivers/pci/setup-bus.c include/linux/pci.h+16 -00 replies

Reviews trailers per patch

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

PatchKhalid AzizYijing WangThomas GleixnerMichael EllermanTJDavid Ahern
1/60
2/60
3/60
4/60T-b
5/60T-b
6/60T-b
7/60T-b
8/60T-b
9/60
10/60
11/60T-b
12/60T-b T-b T-b
13/60T-b
14/60T-b
15/60T-b
16/60T-b
17/60
18/60
19/60
20/60
21/60
22/60T-b
23/60
24/60
25/60
26/60
27/60
28/60
29/60
30/60
31/60
32/60
33/60
34/60
35/60
36/60
37/60
38/60
39/60
40/60
41/60
42/60
43/60
44/60T-b
45/60T-b
46/60
47/60
48/60
49/60
50/60
51/60
52/60R-b A-b
53/60
54/60
55/60
56/60
57/60
58/60A-b
59/60
60/60

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

Read the v11 thread

Cover letter [PATCH v11 00/60] PCI: Resource allocation cleanup for v4.7

Hi Bjorn,

After 5b28541552ef (PCI: Restrict 64-bit prefetchable bridge windows to 64-bit resources), we have several reports on resource allocation failure, and we try to fix the problem with resource clip, and find more problems.

One is realloc fail with two graphics cards above 4G. One is from sparc that have problem with clip as we don't parse mem64 for it.

Other report is about pci remove/rescan does not work on some setup when BIOS tend to allocate small bus size.

This patchset enhance resource allocation to address those problems.

patch 1-11: parse MEM64 for sparc and other system with OF

patch 12-16: MMIO64 allocation enhancement
treat non-pref mmio64 if parent bridges are all pcie. restore old pref allocation logic if hostbridge does not support mmio64.

patch 17-19: FIXED resource handling during realloc
don't realloc resource if device firmware does not support bar change.

patch 20-23: bridge MMIO allocation with hotplug and last try.
treat optional as required on first try when hotplug. MMIO size set to 0 for last try during realloc

patch 24-56: enhancement for mmio resource allocation:
optimize bus mmio alignment calculation.
optimize bus mmio optional alignment calculation.
add support for alt size to prefer small bus size to small bus alignment. treat ROM bar as optional resource.
during allocation, will pick up best fit resource, and allocate near end.

patch 57: add pci=assign_pref_bars to clear and assign pref bars.

patch 58-59: don't clear resource when allocation fails

patch 60: don't try io port allocation if root bus does not have io port.

I put latest copy at:
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-pci-v4.7-next

That is rebased on v4.6-rc2+.

Yijing and Wei Yang both tested the branch, and the patchset fixs rescan problem, and is working well on powerpc setup.

Khalid Aziz tested on some sparc platforms that have different offset to mem space start or support 64bit mmio.

-v11: replace pci_find_root_bus_resource with pci_find_bus_resource
add two patches from Bjorn for checking with pci_mmap. refreshed to current linus tree v4.6-rc2+

Hope at least patch 1-16 could get into v4.7.
Patch 3-16 has been Oracle UEK4 for a while to boot on some sparc platforms as them have 64bt mmio above 4G.

Thanks

Yinghai

Bjorn Helgaas (2):
PCI: Fix iomem_is_exclusive() checking in pci_mmap_resource() alpha/PCI: Only check iomem_is_exclusive() for IORESOURCE_MEM, not IORESOURCE_IO

Yinghai Lu (58):
PCI: Add pci_find_bus_resource()
sparc/PCI: Use correct offset for bus address to resource sparc/PCI: Reserve legacy mmio after PCI mmio
sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing sparc/PCI: Keep resource idx order with bridge register number
PCI: Kill wrong quirk about M7101
powerpc/PCI: Keep resource idx order with bridge register number powerpc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource
PCI: Check pref compatible bit for mem64 resource of PCIe device
PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64
PCI: Add has_mem64 for struct host_bridge
PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64
PCI: Restore pref MMIO allocation logic for host bridge without mmio64
PCI: Don't release fixed resource for realloc
PCI: Claim fixed resource during remove/rescan path
PCI: Set resource to FIXED for LSI devices
PCI: Separate realloc list checking after allocation
PCI: Treat optional as required in first try for bridge rescan
PCI: Get new realloc size for bridge for last try
PCI: Don't release sibling bridge resources during hotplug
PCI: Cleanup res_to_dev_res() printout
PCI: Reuse res_to_dev_res() in reassign_resources_sorted()
PCI: Use correct align for optional only resources during sorting
PCI: Optimize bus min_align/size calculation during sizing
PCI: Optimize bus align/size calculation for optional during sizing
PCI: Don't add too much optional size for hotplug bridge MMIO
PCI: Reorder resources list for required/optional resources
PCI: Remove duplicated code for resource sorting
PCI: Rename pdev_sort_resources() to pdev_assign_resources_prepare()
PCI: Treat ROM resource as optional during realloc
PCI: Add debug printout during releasing partial assigned resources
PCI: Simplify res reference using in __assign_resources_sorted()
PCI: Add __add_to_list()
PCI: Cache window alignment value during bus sizing
PCI: Check if resource is allocated before trying to assign one
PCI: Separate out save_resources()/restore_resources()
PCI: Move comment to pci_need_to_release()
PCI: Separate required+optional assigning to another function
PCI: Skip required+optional if there is no optional
PCI: Move saved required resource list out of required+optional assigning
PCI: Add alt_size ressource allocation support
PCI: Add support for more than two alt_size entries under same bridge
PCI: Fix size calculation with old_size on rescan path
PCI: Don't add too much optional size for hotplug bridge io
PCI: Move ISA io port align out of calculate_iosize()
PCI: Don't add too much io port for hotplug bridge with old size
PCI: Unify calculate_size() for io port and MMIO
PCI: Allow bridge optional only io port resource required size to be 0
PCI: Unify skip_ioresource_align()
PCI: Kill macro checking for bus io port sizing
resources: Make allocate_resource() return best fit resource PCI, x86: Allocate from high in available window for MMIO
PCI: Add debug print out for min_align and alt_size
PCI, x86: Add pci=assign_pref_bars to reallocate pref BARs
PCI: Introduce resource_disabled()
PCI: Don't set flags to 0 when assign resource fail
PCI: Only try to assign io port only for root bus that support it

 arch/alpha/kernel/pci-sysfs.c             |    4 +-
 arch/alpha/kernel/pci.c                   |    2 +-
 arch/ia64/pci/pci.c                       |    4 +-
 arch/microblaze/pci/pci-common.c          |   15 +-
 arch/mn10300/unit-asb2305/pci-asb2305.c   |    4 +-
 arch/mn10300/unit-asb2305/pci.c           |    4 +-
 arch/powerpc/kernel/pci-common.c          |   27 +-
 arch/powerpc/kernel/pci_of_scan.c         |   12 +-
 arch/powerpc/platforms/powernv/pci-ioda.c |   12 +-
 arch/s390/pci/pci.c                       |    2 +-
 arch/sparc/kernel/of_device_32.c          |    5 +-
 arch/sparc/kernel/of_device_64.c          |    5 +-
 arch/sparc/kernel/pci.c                   |   65 +-
 arch/sparc/kernel/pci_common.c            |   91 +-
 arch/sparc/kernel/pci_impl.h              |    5 +
 arch/x86/include/asm/pci_x86.h            |    2 +-
 arch/x86/pci/common.c                     |    7 +-
 arch/x86/pci/i386.c                       |   85 +-
 arch/xtensa/kernel/pci.c                  |    4 +-
 drivers/iommu/intel-iommu.c               |    3 +-
 drivers/of/address.c                      |    4 +-
 drivers/pci/bus.c                         |    6 +-
 drivers/pci/host/pcie-rcar.c              |    2 +-
 drivers/pci/hotplug/acpiphp_glue.c        |    1 +
 drivers/pci/iov.c                         |    2 +-
 drivers/pci/pci-sysfs.c                   |    7 +-
 drivers/pci/pci.c                         |   31 +-
 drivers/pci/pci.h                         |    4 +
 drivers/pci/probe.c                       |   48 +-
 drivers/pci/quirks.c                      |   55 +-
 drivers/pci/rom.c                         |    2 +-
 drivers/pci/setup-bus.c                   | 1316 +++++++++++++++++++++--------
 drivers/pci/setup-res.c                   |   18 +-
 include/linux/ioport.h                    |    6 +-
 include/linux/pci.h                       |   10 +
 kernel/resource.c                         |  104 ++-
 36 files changed, 1427 insertions(+), 547 deletions(-)
Signature · 1 line
1.8.4.5