linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Release coalesced resource
@ 2023-05-25 15:32 Ross Lagerwall
  2023-06-05  8:44 ` Ross Lagerwall
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ross Lagerwall @ 2023-05-25 15:32 UTC (permalink / raw)
  To: linux-pci; +Cc: Bjorn Helgaas, Kai-Heng Feng, linux-kernel, Ross Lagerwall

When contiguous windows are coalesced, the resource is invalidated and
consequently not added to the bus. However, it remains in the resource
hierarchy:

...
  ef2fff00-ef2fffff : 0000:00:13.2
    ef2fff00-ef2fffff : ehci_hcd
00000000-00000000 : PCI Bus 0000:00
f0000000-f3ffffff : PCI MMCONFIG 0000 [bus 00-3f]
  f0000000-f3ffffff : Reserved
...

In some cases (e.g. the Xen scratch region), this causes future calls to
allocate_resource() to choose an inappropriate location which the caller
cannot handle. Fix by releasing the resource and removing from the
hierarchy.

Fixes: 7c3855c423b1 ("PCI: Coalesce host bridge contiguous apertures")
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 drivers/pci/probe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0b2826c4a832..00ed20ac0dd6 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -997,8 +997,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
 	resource_list_for_each_entry_safe(window, n, &resources) {
 		offset = window->offset;
 		res = window->res;
-		if (!res->flags && !res->start && !res->end)
+		if (!res->flags && !res->start && !res->end) {
+			release_resource(res);
 			continue;
+		}
 
 		list_move_tail(&window->node, &bridge->windows);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-09 21:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-25 15:32 [PATCH] PCI: Release coalesced resource Ross Lagerwall
2023-06-05  8:44 ` Ross Lagerwall
2023-06-06 22:36 ` Bjorn Helgaas
2023-06-09 15:39   ` Ross Lagerwall
2023-06-09 21:45 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).