[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8510060.F9ia068vGL@wuerfel>
Date: Mon, 02 May 2016 10:04:56 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Tomasz Nowicki <tn@...ihalf.com>
Cc: Bjorn Helgaas <helgaas@...nel.org>, catalin.marinas@....com,
linux-pci@...r.kernel.org, will.deacon@....com,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
ddaney@...iumnetworks.com, robert.richter@...iumnetworks.com,
msalter@...hat.com, Liviu.Dudau@....com, jchandra@...adcom.com,
linux-kernel@...r.kernel.org, hanjun.guo@...aro.org,
Suravee.Suthikulpanit@....com,
Thierry Reding <thierry.reding@...il.com>
Subject: Re: [PATCH 1/3] [RFC] pci: add new method for register PCI hosts
On Monday 02 May 2016 09:35:41 Tomasz Nowicki wrote:
> > +int pci_register_host(struct pci_host_bridge *bridge)
> > {
> > int error;
> > - struct pci_host_bridge *bridge;
> > struct pci_bus *b, *b2;
> > struct resource_entry *window, *n;
> > + LIST_HEAD(resources);
> > struct resource *res;
> > resource_size_t offset;
> > char bus_addr[64];
> > char *fmt;
> > + struct device *parent = bridge->dev.parent;
> >
> > b = pci_alloc_bus(NULL);
> > if (!b)
> > - return NULL;
> > + return -ENOMEM;
> > + bridge->bus = b;
> >
> > - b->sysdata = sysdata;
> > - b->ops = ops;
> > - b->number = b->busn_res.start = bus;
> > + /* temporarily move resources off the list */
> > + list_splice_init(&bridge->windows, &resources);
> > + b->sysdata = bridge->sysdata;
> > + b->msi = bridge->msi;
> > + b->ops = bridge->ops;
> > + b->number = b->busn_res.start = bridge->busnr;
> > pci_bus_assign_domain_nr(b, parent);
>
> Have you considered to move domain assigning out of here? Domain is
> common for every bus under host bridge, hence it could go into the
> pci_host_bridge structure. Then I would vote for extra host bridge
> allocation call which would assign standard things like this.
>
I had not thought of it, but it sounds like a good idea, thanks!
The other members of struct bus that we assign here (sysdata,
msi, and ops) are probably also constant for the bridge (need
to verify this), so ideally we'd move all four out of the
bus and replace them with a pointer to the pci_host_bridge
to avoid walking up the bus hierarchy every time we want to
access them.
Arnd
Powered by blists - more mailing lists