From: Arnd Bergmann <arnd@arndb.de>
To: Tomasz Nowicki <tn@semihalf.com>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
catalin.marinas@arm.com, linux-pci@vger.kernel.org,
will.deacon@arm.com,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
ddaney@caviumnetworks.com, robert.richter@caviumnetworks.com,
msalter@redhat.com, Liviu.Dudau@arm.com, jchandra@broadcom.com,
linux-kernel@vger.kernel.org, hanjun.guo@linaro.org,
Suravee.Suthikulpanit@amd.com,
Thierry Reding <thierry.reding@gmail.com>
Subject: Re: [PATCH 1/3] [RFC] pci: add new method for register PCI hosts
Date: Mon, 02 May 2016 10:04:56 +0200 [thread overview]
Message-ID: <8510060.F9ia068vGL@wuerfel> (raw)
In-Reply-To: <5727034D.4000204@semihalf.com>
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
next prev parent reply other threads:[~2016-05-02 8:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 23:01 [RFC] experimental pci_register_host API Arnd Bergmann
2016-04-29 23:01 ` [PATCH 1/3] [RFC] pci: add new method for register PCI hosts Arnd Bergmann
2016-05-02 7:09 ` Thierry Reding
2016-05-03 10:04 ` Liviu.Dudau
2016-05-03 12:12 ` Arnd Bergmann
2016-05-02 7:35 ` Tomasz Nowicki
2016-05-02 8:04 ` Arnd Bergmann [this message]
2016-04-29 23:01 ` [PATCH 2/3] [RFC] pci: host-common: use new pci_register_host interface Arnd Bergmann
2016-05-04 23:14 ` Bjorn Helgaas
2016-05-04 23:35 ` Arnd Bergmann
2016-04-29 23:01 ` [PATCH 3/3] [RFC] pci: tegra: " Arnd Bergmann
2016-05-02 7:19 ` Thierry Reding
2016-05-02 6:47 ` [RFC] experimental pci_register_host API Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8510060.F9ia068vGL@wuerfel \
--to=arnd@arndb.de \
--cc=Liviu.Dudau@arm.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=catalin.marinas@arm.com \
--cc=ddaney@caviumnetworks.com \
--cc=hanjun.guo@linaro.org \
--cc=helgaas@kernel.org \
--cc=jchandra@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=msalter@redhat.com \
--cc=robert.richter@caviumnetworks.com \
--cc=thierry.reding@gmail.com \
--cc=tn@semihalf.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).