From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] PCI: ARM: add support for generic PCI host controller
Date: Wed, 19 Feb 2014 14:26:10 +0100 [thread overview]
Message-ID: <2734695.F6QKszum67@wuerfel> (raw)
In-Reply-To: <20140219113755.GD5394@bart.dudau.co.uk>
On Wednesday 19 February 2014 11:37:55 Liviu Dudau wrote:
>
> > Right, this needs to be changed when moving the domain into pci_host_bridge.
>
> Yes, if only I understood what the intent was here. Unfortunately, the history
> of the file stops (for my git tree) at Linus' first commit from v2.6.0, so
> I need to dig deeper. What I am looking to understand is the answer to this
> question: "When you want to create a new bus and you want to make sure it
> is not duplicated, do you go across all domains or pick the current domain
> and allow for same bus number in different domains?"
I suspect this is for some large IA64 machines where you can see the same
domain at different addresses, depending on which CPU you are on, or
something similarly fancy.
Another explanation would be that you can have different ways to describe
the same hardware: On a PC you can assume that the PCI bus is discoverable
on I/O port 0x0cf8. At the same time, you may see it in ACPI with an
mmconfig method.
In any case, you definitely need to allow the same bus numbers on each domain,
since the most important use case of domains is to get around the 256 bus
limit.
> To give some context: I'm looking at drivers/pci/probe.c, pci_create_root_bus().
> Specifically, this code:
>
> b = pci_alloc_bus();
> if (!b)
> return NULL;
>
> b->sysdata = sysdata;
> b->ops = ops;
> b->number = b->busn_res.start = bus;
> b2 = pci_find_bus(pci_domain_nr(b), bus);
> if (b2) {
> /* If we already got to this bus through a different bridge, ignore it */
> dev_dbg(&b2->dev, "bus already known\n");
> goto err_out;
> }
>
> bridge = pci_alloc_host_bridge(b);
> if (!bridge)
> goto err_out;
>
>
> If you look at the comment after pci_find_bus, you can see that the intent was
> to try to find duplicate busses covered by different bridges (but in the same
> domain? maybe, because there used to be only one domain at the beginning, but
> then why use pci_domain_nr() here?). Problems I see here:
Definitely duplicate buses in the same domain, as mentioned above.
> - code is trying to get the domain number of a bus that it just created but not
> plugged yet in the hierarchy
The sysdata is already assigned, and all architectures either assume there is
only one domain, or they get the domain number out of the sysdata that is
filled out prior to calling pci_create_root_bus.
> - pci_find_bus tries to find a bus in the global list of busses that has the
> same domain number and bus number as the parameters of the function. But
> the domain number was plucked out of thin air and all architectures seem to
> actually give you the current active domain number, not the one that actually
> covers the bus (and host_bridge) that you are trying to create.
Not sure what you mean with 'current active domain number': They clearly look at
b->sysdata here, which is a local structure describing what we are currently
probing.
Arnd
next prev parent reply other threads:[~2014-02-19 13:26 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-12 20:16 [PATCH v2 0/3] ARM: PCI: implement generic PCI host controller Will Deacon
2014-02-12 20:16 ` [PATCH v2 1/3] ARM: mach-virt: allow PCI support to be selected Will Deacon
2014-02-12 20:16 ` [PATCH v2 2/3] ARM: bios32: use pci_enable_resource to enable PCI resources Will Deacon
2014-02-12 22:28 ` Jason Gunthorpe
2014-02-13 10:06 ` Will Deacon
2014-02-13 12:22 ` Jingoo Han
2014-02-12 20:16 ` [PATCH v2 3/3] PCI: ARM: add support for generic PCI host controller Will Deacon
2014-02-12 20:59 ` Arnd Bergmann
2014-02-13 11:04 ` Will Deacon
2014-02-13 11:47 ` Arnd Bergmann
2014-02-13 12:00 ` Will Deacon
2014-02-13 12:21 ` Arnd Bergmann
2014-02-12 21:51 ` Kumar Gala
2014-02-13 11:07 ` Will Deacon
2014-02-13 16:22 ` Kumar Gala
2014-02-13 16:25 ` Will Deacon
2014-02-13 16:28 ` Arnd Bergmann
2014-02-13 18:11 ` Mark Rutland
2014-02-13 18:26 ` Jason Gunthorpe
2014-02-13 19:53 ` Will Deacon
2014-02-13 20:20 ` Jason Gunthorpe
2014-02-14 9:59 ` Arnd Bergmann
2014-02-14 22:00 ` Liviu Dudau
2014-02-15 13:03 ` Arnd Bergmann
2014-02-18 17:41 ` Jason Gunthorpe
2014-02-18 18:25 ` Arnd Bergmann
2014-02-18 18:45 ` Jason Gunthorpe
2014-02-18 19:13 ` Arnd Bergmann
2014-02-19 2:44 ` Liviu Dudau
2014-02-19 6:48 ` Jason Gunthorpe
2014-02-19 10:24 ` Arnd Bergmann
2014-02-19 11:37 ` Liviu Dudau
2014-02-19 13:26 ` Arnd Bergmann [this message]
2014-02-19 15:30 ` Liviu Dudau
2014-02-19 19:47 ` Arnd Bergmann
2014-02-19 0:28 ` Bjorn Helgaas
2014-02-19 9:58 ` Arnd Bergmann
2014-02-19 18:20 ` Bjorn Helgaas
2014-02-19 19:06 ` Arnd Bergmann
2014-02-19 20:18 ` Bjorn Helgaas
2014-02-19 20:48 ` Arnd Bergmann
2014-02-19 21:10 ` Jason Gunthorpe
2014-02-19 21:33 ` Bjorn Helgaas
2014-02-19 22:12 ` Arnd Bergmann
2014-02-19 22:18 ` Bjorn Helgaas
2014-02-13 19:52 ` Rob Herring
2014-02-13 18:06 ` Jason Gunthorpe
2014-02-13 19:51 ` Will Deacon
2014-02-13 18:26 ` [PATCH v2 0/3] ARM: PCI: implement " Jason Gunthorpe
2014-02-14 11:05 ` Arnd Bergmann
2014-02-18 18:00 ` Jason Gunthorpe
2014-02-18 18:40 ` Arnd Bergmann
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=2734695.F6QKszum67@wuerfel \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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