Skip to content

PCI: pci_resource_alignment() improvement + cleanups

Ilpo Järvinen linux-pci linuxppc-dev lkml 1 version Applied

Status from this message: Applied to pci/resource for v7.2, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 3 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/11PCI: Log all resource claimsdrivers/pci/setup-res.c+2 -00 replies
2/11PCI: Rename added to add_listdrivers/pci/pci.h drivers/pci/setup-bus.c+14 -140 replies
3/11PCI: Consolidate add_list (aka realloc_head) empty sanity checksdrivers/pci/setup-bus.c+17 -120 replies
4/11PCI: Remove const removal castdrivers/pci/setup-bus.c+2 -30 replies
5/11resource: Make resource_alignment() input const resourceinclude/linux/ioport.h kernel/resource.c+2 -20 replies
6/11powerpc/pseries: Make pseries_get_iov_fw_value() & pnv_iov_get() pci_dev constarch/powerpc/platforms/powernv/pci.h arch/powerpc/platforms/pseries/setup.c+3 -20 replies
7/11PCI: Make pci_sriov_resource_alignment() pci_dev constarch/powerpc/include/asm/machdep.h arch/powerpc/kernel/pci-common.c arch/powerpc/platforms/powernv/pci-sriov.c +5 more+19 -140 replies
8/11PCI: Convert pci_resource_alignment() input parameters to constdrivers/pci/pci.h drivers/pci/setup-cardbus.c+5 -50 replies
9/11PCI: Move pci_resource_alignment() to setup-res.c filedrivers/pci/pci.h drivers/pci/setup-res.c+14 -110 replies
10/11PCI: Lower bound bridge window alignmentdrivers/pci/setup-res.c+11 -12 replies
11/11PCI: Return valid alignment for assigned resourcesdrivers/pci/setup-res.c+13 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] PCI: pci_resource_alignment() improvement + cleanups

pci_resource_alignment() returns 0 when resource is already assigned and in case of disabled bridge windows. This has caused problems to calculations relying on pci_resource_alignment():

https://lore.kernel.org/linux-pci/LV8P221MB1472A24B9975F7C8E8D6BF929947A@LV8P221MB1472.NAMP221.PROD.OUTLOOK.COM/

This series reworks pci_resource_alignment() interface to return always non-zero alignment if the resource exists. For assigned bridge windows, the calculation is using heuristic based on size and start address alignment as calculating the alignment again is costly (would require sizing the entire sub-hierarchy).

As pci_resource_alignment() is becoming more complicated, it's also moved to setup-res.c. While moving pci_resource_alignment()'s arguments are converted into const to tell compiler it can rely on resource remaining the same across the call.

This was intended to be part of a larger series that addresses some shortcomings in pci=realloc. The pci=realloc changes will recalculate bridge window sizes considering also assigned resources which required making these changes to pci_resource_alignment().

As this also relates to the issue linked above, I'm sending it already now without pci=realloc changes that are still incomplete. The first patches originate from the large pci=realloc work but seem generally useful even if independent of the alignment improvements so I've included them here without reorganizing the series to contain only alignment related changes.

Ilpo Järvinen (11):
PCI: Log all resource claims
PCI: Rename added to add_list
PCI: Consolidate add_list (aka realloc_head) empty sanity checks
PCI: Remove const removal cast
resource: Make resource_alignment() input const resource powerpc/pseries: Make pseries_get_iov_fw_value() & pnv_iov_get()
pci_dev const
PCI: Make pci_sriov_resource_alignment() pci_dev const
PCI: Convert pci_resource_alignment() input parameters to const
PCI: Move pci_resource_alignment() to setup-res.c file
PCI: Lower bound bridge windown alignment
PCI: Return valid alignment for assigned resources

 arch/powerpc/include/asm/machdep.h         |  2 +-
 arch/powerpc/kernel/pci-common.c           |  2 +-
 arch/powerpc/platforms/powernv/pci-sriov.c |  4 +-
 arch/powerpc/platforms/powernv/pci.h       |  5 ++-
 arch/powerpc/platforms/pseries/setup.c     |  5 ++-
 drivers/pci/iov.c                          |  7 +--
 drivers/pci/pci.h                          | 24 ++++-------
 drivers/pci/setup-bus.c                    | 50 ++++++++++++----------
 drivers/pci/setup-cardbus.c                |  2 +-
 drivers/pci/setup-res.c                    | 37 ++++++++++++++++
 include/linux/ioport.h                     |  2 +-
 include/linux/pci.h                        |  8 ++--
 kernel/resource.c                          |  2 +-
 13 files changed, 94 insertions(+), 56 deletions(-)

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

Signature · 1 line
2.39.5