Re: [patch] pci: revert "PCI: remove transparent bridge sizing"

From: Benjamin Herrenschmidt
Date: Wed Mar 26 2008 - 19:23:01 EST



On Wed, 2008-03-26 at 22:47 +0000, Alan Cox wrote:
> > I dunno. I'm not going to do anything in this area before 2.6.25 is out
> > because this *does* make me a bit nervous, but if somebody wants to think
> > about this and perhaps write patches for testing, that would be good.
>
> One way to kill off some of the assumptions and gunge would be to add
> pci_resource_assigned(resource) [or indeed just resource_assigned()].
> Iomap has similar problems - we have no portable defined "not mapped" at
> the moment, although we use NULL technically mmio maps of 0 end up at 0
> in the implementation today.

There is IORESOURCE_UNSET... We could use that. I use it to some extent
on powerpc but x86 doesn't. Though I remember spotting a code path in
setup-res.c will not clear it when actually assigning the resource to a
bus. I can't remember if that hits in practice tho. I have a patch
anyway :-)

----
[PATCH] pci: Make pci_assign_resource always clear IORESOURCE_UNSET

For bus resources pci_assign_resrouce() needs to also clear
IORESOURCE_UNSET. (For device resources, it's handled by
pci_update_resource).

Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
---

Index: linux-merge/drivers/pci/setup-res.c
===================================================================
--- linux-merge.orig/drivers/pci/setup-res.c 2007-12-13 13:06:27.000000000 +1100
+++ linux-merge/drivers/pci/setup-res.c 2007-12-13 13:06:50.000000000 +1100
@@ -167,7 +167,8 @@ int pci_assign_resource(struct pci_dev *
(unsigned long long)res->start, pci_name(dev));
} else if (resno < PCI_BRIDGE_RESOURCES) {
pci_update_resource(dev, res, resno);
- }
+ } else
+ res->flags &= ~IORESOURCE_UNSET;

return ret;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/