[PATCH v2 1/2] PCI: generic: remove dependency on hw_pci
Lorenzo Pieralisi
lorenzo.pieralisi at arm.com
Tue May 12 09:34:12 PDT 2015
On Tue, May 12, 2015 at 02:34:31PM +0100, Bjorn Helgaas wrote:
[...]
> > +void pci_claim_one_bus(struct pci_bus *b)
> > +{
> > + struct pci_dev *pdev;
> > + struct pci_bus *child_bus;
> > +
> > + list_for_each_entry(pdev, &b->devices, bus_list) {
> > + int i;
> > +
> > + for (i = 0; i < PCI_NUM_RESOURCES; i++) {
> > + struct resource *r = &pdev->resource[i];
> > +
> > + if (r->parent || !r->start || !r->flags)
> > + continue;
> > +
> > + if (pci_has_flag(PCI_PROBE_ONLY) ||
> > + (r->flags & IORESOURCE_PCI_FIXED)) {
> > + if (pci_claim_resource(pdev, i) == 0)
> > + continue;
> > +
> > + pci_claim_bridge_resource(pdev, i);
> > + }
> > + }
> > + }
> > +
> > + list_for_each_entry(child_bus, &b->children, node) {
> > + pci_claim_one_bus(child_bus);
> > + }
> > +}
> > +EXPORT_SYMBOL(pci_claim_one_bus);
>
> I'm not a fan of pci_claim_one_bus(), on the philosophical grounds that
> claiming resources is a per-device thing, and I don't want to encourage
> people to do it on a per-bus level.
>
> I'd rather claim them somewhere in the pci_device_add() path, as s390 does
> in pcibios_add_device(). In fact, I'd *like* to do it even earlier, when
> we read each BAR, so we could identify invalid or unassigned BARs
> immediately.
You mean claiming the resources in __pci_read_base (and unset the resource
if claiming it fails ?) regardless of PCI_PROBE_ONLY ?
I will give it a go, I fear it might trigger regressions on other archs
though.
We could claim the resources in pcibios_add_device on arm64, but this
means arm code should be patched too since I am not happy at all to let
arm and arm64 diverge even more.
Lorenzo
More information about the linux-arm-kernel
mailing list