Skip to content

PCI & resource: Make coalescing host bridge windows safer

Ilpo Järvinen linux-pci linux-renesas-soc lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3PCI: Refactor host bridge window coalescing loop to use prevdrivers/pci/probe.c+12 -120 replies
2/3PCI: Do not coalesce host bridge resource structs in placedrivers/pci/probe.c include/linux/resource_ext.h kernel/resource.c+140 -65 replies
3/3resource, kunit: add test case for resource_coalesce()include/linux/ioport.h kernel/resource.c kernel/resource_kunit.c+132 -20 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/3] PCI & resource: Make coalescing host bridge windows safer

Hi,

Here's a series for Geert to test if this fixes the improper coalescing of resources as was experienced with the pci_add_resource() change (I know the breaking change was pulled before 6.18 main PR but I'd want to retry it later once the known issues have been addressed). The expected result is there'll be two adjacent host bridge resources in the resource tree as the different name should disallow coalescing them together, and therefore BAR0 has a window into which it belongs to.

Generic info for the series:

PCI host bridge windows were coalesced in place into one of the structs on the resources list. The host bridge window coalescing code does not know who holds references and still needs the struct resource it's coalescing from/to so it is safer to perform coalescing into entirely a new struct resource instead and leave the old resource addresses as they were.

The checks when coalescing is allowed are also made stricter so that only resources that have identical the metadata can be coalesced.

As a bonus, there's also a bit of framework to easily create kunit tests for resource tree functions (beyond just resource_coalesce()).

Ilpo Järvinen (3):
PCI: Refactor host bridge window coalescing loop to use prev
PCI: Do not coalesce host bridge resource structs in place resource, kunit: add test case for resource_coalesce()

 drivers/pci/probe.c          |  26 +++----
 include/linux/ioport.h       |   5 ++
 include/linux/resource_ext.h |   3 +
 kernel/resource.c            | 139 ++++++++++++++++++++++++++++++++++-
 kernel/resource_kunit.c      | 121 ++++++++++++++++++++++++++++++
 5 files changed, 279 insertions(+), 15 deletions(-)

base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585

Signature · 1 line
2.39.5