Re: [PATCH 2/12] pci: add pci_bridge_release_unused_res andpci_bus_release_unused_bridge_res -v2

From: Bjorn Helgaas
Date: Sun Dec 20 2009 - 19:06:59 EST


On Fri, 2009-12-18 at 13:24 -0800, Linus Torvalds wrote:
>
> On Fri, 18 Dec 2009, Yinghai Lu wrote:
> >
> > so later we could use it to release small resource before pci assign unassign res
>
> However, I think this one is wrong.
>
> > +static void release_child_resources(struct resource *r)
> > +{
> > + struct resource *p;
> > + resource_size_t size;
> > +
> > + p = r->child;
> > + while (p) {
> > + release_child_resources(p);
> > + release_resource(p);
>
> So not only is this releasing resources that aren't necessarily PCI
> devices, it's releasing the whole tree - regardless of how they were
> allocated and initialized. ...

Help me fill in my mental picture of these resources ... This function
just takes a struct resource, so it doesn't know whether it's a PCI,
ACPI, or other resource. But in Yinghai's usage, I think we do know
that we're starting with a PCI resource. In that case, is it possible
that some child is a non-PCI resource?

The picture in my mind is that once we are downstream of a PCI host
bridge, all child resources must be PCI, and they must all conform to
the forwarding rules for PCI bridges and so on. I know there are PCI
devices with BARs at non-standard places, so Linux wouldn't know about
those resources (and that worries me a bit when we're talking about
reprogramming a bridge window that might be upstream of such a device).
But if Linux *did* learn about those non-standard resources via a quirk
or something, I would still think of those as PCI resources, not ACPI or
something else.

Anyway, I'd like to correct my mental picture if it's mistaken.

Bjorn


--
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/