devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Mitch Bradley <wmb-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Subject: Re: [PATCH v3 10/10] ARM: tegra: pcie: Add device tree support
Date: Wed, 15 Aug 2012 16:57:08 +0200	[thread overview]
Message-ID: <20120815145708.GA11331@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <CAErSpo7c4L=Ny=CtZwLB_XWTcN8tVWs_quuE_T+XLEGyhWwHkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 6966 bytes --]

On Wed, Aug 15, 2012 at 07:36:24AM -0700, Bjorn Helgaas wrote:
> On Wed, Aug 15, 2012 at 5:30 AM, Thierry Reding
> <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> wrote:
> > On Wed, Aug 15, 2012 at 05:18:04AM -0700, Bjorn Helgaas wrote:
> >> On Tue, Aug 14, 2012 at 11:37 PM, Thierry Reding
> >> <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> wrote:
> >> > On Tue, Aug 14, 2012 at 04:50:26PM -0700, Bjorn Helgaas wrote:
> >> >> On Tue, Aug 14, 2012 at 1:12 PM, Thierry Reding
> >> >> <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> wrote:
> >> >> > On Thu, Jul 26, 2012 at 09:55:12PM +0200, Thierry Reding wrote:
> >> >> >> diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
> >> >> >> index a094c97..c886dff 100644
> >> >> >> --- a/arch/arm/boot/dts/tegra20.dtsi
> >> >> >> +++ b/arch/arm/boot/dts/tegra20.dtsi
> >> >> >> @@ -199,6 +199,68 @@
> >> >> >>               #size-cells = <0>;
> >> >> >>       };
> >> >> >>
> >> >> >> +     pcie-controller {
> >> >> >> +             compatible = "nvidia,tegra20-pcie";
> >> >> >> +             reg = <0x80003000 0x00000800   /* PADS registers */
> >> >> >> +                    0x80003800 0x00000200   /* AFI registers */
> >> >> >> +                    0x81000000 0x01000000   /* configuration space */
> >> >> >> +                    0x90000000 0x10000000>; /* extended configuration space */
> >> >> >> +             interrupts = <0 98 0x04   /* controller interrupt */
> >> >> >> +                           0 99 0x04>; /* MSI interrupt */
> >> >> >> +             status = "disabled";
> >> >> >> +
> >> >> >> +             ranges = <0 0 0  0x80000000 0x00001000   /* root port 0 */
> >> >> >> +                       0 1 0  0x81000000 0x00800000   /* port 0 config space */
> >> >> >> +                       0 2 0  0x90000000 0x08000000   /* port 0 ext config space */
> >> >> >> +                       0 3 0  0x82000000 0x00010000   /* port 0 downstream I/O */
> >> >> >> +                       0 4 0  0xa0000000 0x08000000   /* port 0 non-prefetchable memory */
> >> >> >> +                       0 5 0  0xb0000000 0x08000000   /* port 0 prefetchable memory */
> >> >> >> +
> >> >> >> +                       1 0 0  0x80001000 0x00001000   /* root port 1 */
> >> >> >> +                       1 1 0  0x81800000 0x00800000   /* port 1 config space */
> >> >> >> +                       1 2 0  0x98000000 0x08000000   /* port 1 ext config space */
> >> >> >> +                       1 3 0  0x82010000 0x00010000   /* port 1 downstream I/O */
> >> >> >> +                       1 4 0  0xa8000000 0x08000000   /* port 1 non-prefetchable memory */
> >> >> >> +                       1 5 0  0xb8000000 0x08000000>; /* port 1 prefetchable memory */
> >> >> >
> >> >> > I've been thinking about this some more. The translations for both the
> >> >> > regular and extended configuration spaces are configured in the top-
> >> >> > level PCIe controller. It is therefore wrong how they are passed to the
> >> >> > PCI host bridges via the ranges property.
> >> >> >
> >> >> > I remember Mitch saying that it should be passed down to the children
> >> >> > because it is partitioned among them, but since the layout is compatible
> >> >> > with ECAM, the partitioning isn't as simple as what's in the tree. In
> >> >> > fact the partitions will be dependent on the number of devices attached
> >> >> > to the host bridges.
> >> >>
> >> >> I don't understand this last bit about the number of devices attached
> >> >> to the host bridges.  Logically, the host bridge has a bus number
> >> >> aperture that you can know up front, even before you know anything
> >> >> about what devices are below it.  On x86, for example, the ACPI _CRS
> >> >> method has something like "[bus 00-7f]" in it, which means that any
> >> >> buses in that range are below this bridge.  That doesn't tell us
> >> >> anything about which buses actually have devices on them, of course;
> >> >> it's just analogous to the secondary and subordinate bus number
> >> >> registers in a P2P bridge.
> >> >
> >> > That's one of the issues I still need to take care of. Currently no bus
> >> > resource is attached to the individual bridges (nor the PCI controller
> >> > for that matter), so the PCI core will assign them dynamically.
> >>
> >> So your PCI controller driver knows how to program the controller bus
> >> number aperture?  Sometimes people start by assuming that two host
> >> bridges both have [bus 00-ff] apertures, then they enumerate below the
> >> first and adjust the bus number apertures based on what they found.
> >> For example, if they found buses 00-12 behind the first bridge, they
> >> make the apertures [bus 00-12] for the first bridge and [bus 13-ff]
> >> for the second.  That might be the case, depending on what firmware
> >> set up, but it seems like a dubious way to do it, and of course it
> >> precludes a lot of hot-plug scenarios.
> >
> > No, that's not what I meant. What happens is that no pre-assigned bus
> > range is specified for either of the host bridges, so that the range
> > 0x00-0xff will be assigned by default in pci_scan_root_bus().
> 
> My concern is about making the kernel's idea of the host bridge bus
> number aperture match what the hardware is doing.  I'm pretty sure
> that the default [bus 00-ff] range assigned by pci_scan_root_bus()
> doesn't actually match the hardware in most cases, at least when we
> have multiple host bridges in the same PCI domain.
> 
> For example, if you don't supply a bus number range,
> pci_scan_root_bus() will assume [bus 00-ff] for both host bridges.
> But if you could put an analyzer on each of the root buses and then
> read bus 0 config space, will you see that config transaction on
> *both* buses?  I doubt it.
> 
> You have to know at least the bus number of the root bus up front
> before you can even start enumerating it.  The only way to learn that
> is by reading registers in the host bridge or by some external
> mechanism like ACPI or device tree.  That's the beginning of the bus
> number aperture.  The end of the aperture is similar: we can't
> reliably determine it by enumerating devices below the host bridge, so
> we have to know it up front.  You can enumerate starting with the root
> bus number and assigning new subordinate bus numbers as necessary, but
> unless you know the host bridge aperture to begin with, you could
> inadvertently assign a new bus number that actually belongs to a
> different host bridge.

Yes, that was my understanding as well. So currently I haven't seen any
problems with this because I only use one of the two host bridges. But I
suppose I should add code to initialize the bus number aperture properly
either via platform device resources (for the non-DT case) and the
device tree otherwise.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-08-15 14:57 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 19:55 [PATCH v3 00/10] ARM: tegra: Add PCIe device tree support Thierry Reding
2012-07-26 19:55 ` [PATCH v3 01/10] PCI: Keep pci_fixup_irqs() around after init Thierry Reding
2012-08-14  5:06   ` Bjorn Helgaas
     [not found]     ` <CAErSpo5YDwstHv7B7LEbDQmnHnuVsMA2ibTFNLkiCKmkkeE4Zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-14  5:37       ` Thierry Reding
     [not found]   ` <1343332512-28762-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-08-15 17:06     ` Bjorn Helgaas
2012-08-15 19:28       ` Thierry Reding
2012-08-15 19:42         ` Bjorn Helgaas
     [not found]           ` <CAErSpo6cjOzJegJqXzmk59DChExcbLK1sOhwyAyQL4FZkTN21A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-15 20:01             ` Thierry Reding
2012-09-07 16:19             ` Stephen Warren
     [not found]               ` <504A1EA2.9030008-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-07 17:00                 ` Thierry Reding
2012-09-07 17:22                   ` Bjorn Helgaas
     [not found]                     ` <CAErSpo4Y4QXfahRkBoJ_jmKy6VAYqOzixTmCPkwSATfO+rzVxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-14 18:55                       ` Thierry Reding
     [not found]                         ` <20120914185502.GA14065-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-09-14 19:45                           ` Bjorn Helgaas
2012-07-26 19:55 ` [PATCH v3 02/10] ARM: pci: Keep pci_common_init() " Thierry Reding
2012-07-26 19:55 ` [PATCH v3 05/10] resource: add PCI configuration space support Thierry Reding
     [not found]   ` <1343332512-28762-6-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-08-14  5:00     ` Bjorn Helgaas
     [not found]       ` <CAErSpo4qg45brVRwEbw3=R04VsbnvUowSMWcT+M6VoAxbf3Cqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-14  5:55         ` Thierry Reding
2012-08-14 17:38           ` Bjorn Helgaas
     [not found]             ` <CAErSpo6LYpkC5wop53S1r1z3ov4+w4soqrQARzbbouVs1trzUg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-14 18:01               ` Thierry Reding
2012-08-14 21:44                 ` Bjorn Helgaas
     [not found]                   ` <CAErSpo4Efy-Dt67rktzNiYfZfOTSu=pmYtyGd3tR-zZQ3jDGtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-15  6:49                     ` Thierry Reding
     [not found]                       ` <20120815064902.GB15665-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-16 15:18                         ` Stephen Warren
     [not found]                           ` <502D0F3C.4010308-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-16 18:27                             ` Thierry Reding
2012-07-26 19:55 ` [PATCH v3 06/10] ARM: tegra: Rewrite PCIe support as a driver Thierry Reding
2012-07-26 19:55 ` [PATCH v3 08/10] of/address: Handle #address-cells > 2 specially Thierry Reding
     [not found]   ` <1343332512-28762-9-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-07-31 20:18     ` Rob Herring
2012-08-15 20:06       ` Thierry Reding
     [not found]         ` <20120815200655.GC12870-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-09-07 16:24           ` Stephen Warren
     [not found]             ` <504A1FA4.9040302-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-07 16:32               ` Rob Herring
     [not found] ` <1343332512-28762-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-07-26 19:55   ` [PATCH v3 03/10] ARM: pci: Allow passing per-controller private data Thierry Reding
2012-07-26 19:55   ` [PATCH v3 04/10] ARM: tegra: Move tegra_pcie_xclk_clamp() to PMC Thierry Reding
2012-07-26 19:55   ` [PATCH v3 07/10] ARM: tegra: pcie: Add MSI support Thierry Reding
2012-07-26 19:55   ` [PATCH v3 09/10] of: Add of_pci_parse_ranges() Thierry Reding
2012-07-31 20:07     ` Rob Herring
     [not found]       ` <50183B03.2090809-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-08-01  6:54         ` Thierry Reding
     [not found]           ` <20120801065437.GB26791-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-08-01 16:07             ` Stephen Warren
2012-07-31 16:18   ` [PATCH v3 00/10] ARM: tegra: Add PCIe device tree support Stephen Warren
     [not found]     ` <50180547.9040603-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-01  6:35       ` Thierry Reding
     [not found]         ` <20120801063545.GA26791-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-08-01 17:02           ` Stephen Warren
     [not found]             ` <5019611A.2060804-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-02  6:15               ` Thierry Reding
2012-07-26 19:55 ` [PATCH v3 10/10] ARM: tegra: pcie: Add " Thierry Reding
     [not found]   ` <1343332512-28762-11-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-08-14 20:12     ` Thierry Reding
2012-08-14 23:50       ` Bjorn Helgaas
2012-08-15  6:37         ` Thierry Reding
2012-08-15 12:18           ` Bjorn Helgaas
     [not found]             ` <CAErSpo7Y9ADYHwZMjQjDwd7m8jtwgcxsE-NE_K5X_Z+PuV=C4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-15 12:30               ` Thierry Reding
     [not found]                 ` <20120815123022.GA8678-RM9K5IK7kjIyiCvfTdI0JKcOhU4Rzj621B7CTYaBSLdn68oJJulU0Q@public.gmane.org>
2012-08-15 14:36                   ` Bjorn Helgaas
     [not found]                     ` <CAErSpo7c4L=Ny=CtZwLB_XWTcN8tVWs_quuE_T+XLEGyhWwHkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-15 14:57                       ` Thierry Reding [this message]
     [not found]                         ` <20120815145708.GA11331-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-15 20:25                           ` Arnd Bergmann
     [not found]                             ` <201208152025.25252.arnd-r2nGTMty4D4@public.gmane.org>
2012-08-15 20:48                               ` Bjorn Helgaas
2012-08-16  4:55                               ` Thierry Reding
     [not found]                                 ` <20120816045539.GA17067-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-16  7:03                                   ` Arnd Bergmann
     [not found]                                     ` <201208160703.50364.arnd-r2nGTMty4D4@public.gmane.org>
2012-08-16  7:47                                       ` Thierry Reding
2012-08-16 12:15               ` Thierry Reding
2012-08-06 19:42 ` [PATCH v3 00/10] ARM: tegra: Add PCIe " Stephen Warren
2012-08-07 18:20   ` Thierry Reding
2012-08-13 17:40   ` Thierry Reding
     [not found]     ` <20120813174003.GA2527-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-13 18:47       ` Stephen Warren
     [not found]         ` <50294BCA.1070807-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-13 20:33           ` Thierry Reding
2012-08-13 21:38             ` Rob Herring
2012-08-14  6:14               ` Thierry Reding
2012-08-13 23:18           ` Bjorn Helgaas
2012-08-14  6:29             ` Thierry Reding
2012-08-14 19:39             ` Stephen Warren
     [not found]               ` <502AA96B.2050709-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-14 19:58                 ` Thierry Reding
     [not found]                   ` <20120814195834.GA10431-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-14 21:55                     ` Bjorn Helgaas
     [not found]                       ` <CAErSpo4Bm_Ryx=OK+svjqAwD4N8v0vrheLVdc-N1ijx8i_-N3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-14 22:58                         ` Stephen Warren
     [not found]                           ` <502AD82F.3080702-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-14 23:51                             ` Stephen Warren
     [not found]                               ` <502AE485.8060307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-15 19:04                                 ` Stephen Warren
2012-08-15 20:09                                   ` Thierry Reding
     [not found]                                     ` <20120815200905.GD12870-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-08-15 20:11                                       ` Stephen Warren
     [not found]                                         ` <502C025E.6000009-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-15 20:19                                           ` Thierry Reding
2012-09-07 23:34                               ` Stephen Warren
     [not found]                                 ` <504A848B.1090703-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-08  0:04                                   ` Russell King - ARM Linux
     [not found]                                     ` <20120908000430.GF13739-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-09-08  5:53                                       ` Stephen Warren
2012-09-08 17:51                                       ` Bjorn Helgaas
2012-09-18  6:33                                         ` Thierry Reding
2012-09-18 15:56                                           ` Bjorn Helgaas
2012-08-15  0:08                             ` Bjorn Helgaas

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=20120815145708.GA11331@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=wmb-D5eQfiDGL7eakBO8gow8eQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).