All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	Graeme Gregory <graeme.gregory@linaro.org>,
	Al Stone <al.stone@linaro.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] acpi: pci: don't ignore function ID of bridge device in _PRT
Date: Fri, 7 Apr 2017 19:06:52 +0100	[thread overview]
Message-ID: <20170407180652.GA12301@red-moon> (raw)
In-Reply-To: <CAKv+Gu_rivjMaQ740LWO1Nm8SPMGuQ1J1TFeD8QXnRch8Lv6bg@mail.gmail.com>

On Fri, Apr 07, 2017 at 06:12:05PM +0100, Ard Biesheuvel wrote:
> On 7 April 2017 at 18:06, Bjorn Helgaas <helgaas@kernel.org> wrote:
> > Hi Ard,
> >
> > On Fri, Apr 07, 2017 at 02:22:22PM +0100, Ard Biesheuvel wrote:
> >> We currently derive legacy interrupt routing by matching _PRT
> >> entries on the PCI device only, presumably under the assumption
> >> that PRT entries always have a value of 0xffff in the function
> >> field, meaning 'match all functions'.
> >
> > The spec (ACPI v6.0, sec 6.2.13) contains a note that:
> >
> >   The PCI function number in the Address field of the _PRT packages
> >   must be 0xFFFF, indicating "any" function number or "all functions".
> >
> > If we need a patch like this, we need to somehow reconcile it with
> > that spec text to make sure firmware and OS folks have a common
> > understanding of how this is supposed to work.
> >
> >> This no longer holds for modern PCIe topologies, where the
> >> legacy interrupts for different slots may be wired to different
> >> functions on the same bridge device. For instance, on AMD Seattle,
> >> we may have something like
> >>
> >> -[0000:00]-+-00.0  Advanced Micro Devices, Inc. [AMD] Device 1a00
> >>            +-02.0  Advanced Micro Devices, Inc. [AMD] Device 1a01
> >>            +-02.2-[01]----00.0  Renesas uPD720202 USB 3.0 Host Controller
> >>            \-02.3-[02]----00.0  Realtek RTL8169 PCIe Gigabit Ethernet
> >>
> >> where the _PRT describes the legacy interrupt routing as
> >>
> >>     Name (_PRT, Package ()  // _PRT: PCI Routing Table
> >>     {
> >>         // slot 1: dev 2 fn 1
> >>         Package () { 0x20001, 0x0, 0x0, 0x140 },
> >>         Package () { 0x20001, 0x1, 0x0, 0x141 },
> >>         Package () { 0x20001, 0x2, 0x0, 0x142 },
> >>         Package () { 0x20001, 0x3, 0x0, 0x143 },
> >>
> >>         // slot 1: dev 2 fn 2
> >>         Package () { 0x20002, 0x0, 0x0, 0x144 },
> >>         Package () { 0x20002, 0x1, 0x0, 0x145 },
> >>         Package () { 0x20002, 0x2, 0x0, 0x146 },
> >>         Package () { 0x20002, 0x3, 0x0, 0x147 },
> >>
> >>         // slot 1: dev 2 fn 3
> >>         Package () { 0x20003, 0x0, 0x0, 0x148 },
> >>         Package () { 0x20003, 0x1, 0x0, 0x149 },
> >>         Package () { 0x20003, 0x2, 0x0, 0x14a },
> >>         Package () { 0x20003, 0x3, 0x0, 0x14b }
> >>     }) // _PRT
> >
> > But I think this _PRT description is incorrect and we should change
> > the _PRT rather than the kernel.  My laptop has a basically identical
> > topology:
> >
> >   -[0000:00]-+-00.0  Intel Corporation Sky Lake Host Bridge/DRAM Registers
> >              +-1c.0-[02]----00.0  Realtek Semiconductor Co., Ltd.  Device 525a
> >              +-1c.2-[04]----00.0  Intel Corporation Wireless 8260
> >
> > and the ASL looks like this (paraphrased):
> >
> >   Device (EXP1) {
> >     Name (_ADR, 0x001C0000)
> >     Name (_PRT) {
> >       Package () { 0xFFFF, 0x00, \_SB.LNKA, 0x00 },
> >       Package () { 0xFFFF, 0x01, \_SB.LNKB, 0x00 },
> >       ...
> >     }
> >   }
> >   Device (EXP3) {
> >     Name (_ADR, 0x001C0002)
> >     Name (_PRT) {
> >       Package () { 0xFFFF, 0x00, \_SB.LNKC, 0x00 },
> >       Package () { 0xFFFF, 0x01, \_SB.LNKD, 0x00 },
> >       ...
> >     }
> >   }
> >
> 
> Thanks for the explanation. But how is this wired up into the PNP0A08
> device then? IOW, how does the ACPI code in Linux discover the
> relation between these devices and my PCI root device?

You describe the PCI hierarchy starting from PNP0A08 at root and the
kernel assigns the ACPI companion through _ADR matching (see
acpi_pci_find_companion()) which is what is used by _PRT parsing
code to route IRQs IIUC.

Lorenzo

WARNING: multiple messages have this Message-ID (diff)
From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] acpi: pci: don't ignore function ID of bridge device in _PRT
Date: Fri, 7 Apr 2017 19:06:52 +0100	[thread overview]
Message-ID: <20170407180652.GA12301@red-moon> (raw)
In-Reply-To: <CAKv+Gu_rivjMaQ740LWO1Nm8SPMGuQ1J1TFeD8QXnRch8Lv6bg@mail.gmail.com>

On Fri, Apr 07, 2017 at 06:12:05PM +0100, Ard Biesheuvel wrote:
> On 7 April 2017 at 18:06, Bjorn Helgaas <helgaas@kernel.org> wrote:
> > Hi Ard,
> >
> > On Fri, Apr 07, 2017 at 02:22:22PM +0100, Ard Biesheuvel wrote:
> >> We currently derive legacy interrupt routing by matching _PRT
> >> entries on the PCI device only, presumably under the assumption
> >> that PRT entries always have a value of 0xffff in the function
> >> field, meaning 'match all functions'.
> >
> > The spec (ACPI v6.0, sec 6.2.13) contains a note that:
> >
> >   The PCI function number in the Address field of the _PRT packages
> >   must be 0xFFFF, indicating "any" function number or "all functions".
> >
> > If we need a patch like this, we need to somehow reconcile it with
> > that spec text to make sure firmware and OS folks have a common
> > understanding of how this is supposed to work.
> >
> >> This no longer holds for modern PCIe topologies, where the
> >> legacy interrupts for different slots may be wired to different
> >> functions on the same bridge device. For instance, on AMD Seattle,
> >> we may have something like
> >>
> >> -[0000:00]-+-00.0  Advanced Micro Devices, Inc. [AMD] Device 1a00
> >>            +-02.0  Advanced Micro Devices, Inc. [AMD] Device 1a01
> >>            +-02.2-[01]----00.0  Renesas uPD720202 USB 3.0 Host Controller
> >>            \-02.3-[02]----00.0  Realtek RTL8169 PCIe Gigabit Ethernet
> >>
> >> where the _PRT describes the legacy interrupt routing as
> >>
> >>     Name (_PRT, Package ()  // _PRT: PCI Routing Table
> >>     {
> >>         // slot 1: dev 2 fn 1
> >>         Package () { 0x20001, 0x0, 0x0, 0x140 },
> >>         Package () { 0x20001, 0x1, 0x0, 0x141 },
> >>         Package () { 0x20001, 0x2, 0x0, 0x142 },
> >>         Package () { 0x20001, 0x3, 0x0, 0x143 },
> >>
> >>         // slot 1: dev 2 fn 2
> >>         Package () { 0x20002, 0x0, 0x0, 0x144 },
> >>         Package () { 0x20002, 0x1, 0x0, 0x145 },
> >>         Package () { 0x20002, 0x2, 0x0, 0x146 },
> >>         Package () { 0x20002, 0x3, 0x0, 0x147 },
> >>
> >>         // slot 1: dev 2 fn 3
> >>         Package () { 0x20003, 0x0, 0x0, 0x148 },
> >>         Package () { 0x20003, 0x1, 0x0, 0x149 },
> >>         Package () { 0x20003, 0x2, 0x0, 0x14a },
> >>         Package () { 0x20003, 0x3, 0x0, 0x14b }
> >>     }) // _PRT
> >
> > But I think this _PRT description is incorrect and we should change
> > the _PRT rather than the kernel.  My laptop has a basically identical
> > topology:
> >
> >   -[0000:00]-+-00.0  Intel Corporation Sky Lake Host Bridge/DRAM Registers
> >              +-1c.0-[02]----00.0  Realtek Semiconductor Co., Ltd.  Device 525a
> >              +-1c.2-[04]----00.0  Intel Corporation Wireless 8260
> >
> > and the ASL looks like this (paraphrased):
> >
> >   Device (EXP1) {
> >     Name (_ADR, 0x001C0000)
> >     Name (_PRT) {
> >       Package () { 0xFFFF, 0x00, \_SB.LNKA, 0x00 },
> >       Package () { 0xFFFF, 0x01, \_SB.LNKB, 0x00 },
> >       ...
> >     }
> >   }
> >   Device (EXP3) {
> >     Name (_ADR, 0x001C0002)
> >     Name (_PRT) {
> >       Package () { 0xFFFF, 0x00, \_SB.LNKC, 0x00 },
> >       Package () { 0xFFFF, 0x01, \_SB.LNKD, 0x00 },
> >       ...
> >     }
> >   }
> >
> 
> Thanks for the explanation. But how is this wired up into the PNP0A08
> device then? IOW, how does the ACPI code in Linux discover the
> relation between these devices and my PCI root device?

You describe the PCI hierarchy starting from PNP0A08 at root and the
kernel assigns the ACPI companion through _ADR matching (see
acpi_pci_find_companion()) which is what is used by _PRT parsing
code to route IRQs IIUC.

Lorenzo

  parent reply	other threads:[~2017-04-07 18:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 13:22 [PATCH] acpi: pci: don't ignore function ID of bridge device in _PRT Ard Biesheuvel
2017-04-07 13:22 ` Ard Biesheuvel
2017-04-07 17:06 ` Bjorn Helgaas
2017-04-07 17:06   ` Bjorn Helgaas
2017-04-07 17:12   ` Ard Biesheuvel
2017-04-07 17:12     ` Ard Biesheuvel
2017-04-07 17:49     ` Bjorn Helgaas
2017-04-07 17:49       ` Bjorn Helgaas
2017-04-07 18:06     ` Lorenzo Pieralisi [this message]
2017-04-07 18:06       ` Lorenzo Pieralisi
2017-04-07 18:35       ` Ard Biesheuvel
2017-04-07 18:35         ` Ard Biesheuvel
2017-04-07 21:36         ` Lorenzo Pieralisi
2017-04-07 21:36           ` Lorenzo Pieralisi
2017-04-08  7:04           ` Ard Biesheuvel
2017-04-08  7:04             ` Ard Biesheuvel
2017-04-08 11:22         ` Ard Biesheuvel
2017-04-08 11:22           ` Ard Biesheuvel
2017-04-08 13:22           ` Lorenzo Pieralisi
2017-04-08 13:22             ` Lorenzo Pieralisi
2017-04-08 14:02             ` Ard Biesheuvel
2017-04-08 14:02               ` Ard Biesheuvel
2017-04-07 17:07 ` Ard Biesheuvel
2017-04-07 17:07   ` Ard Biesheuvel

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=20170407180652.GA12301@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=al.stone@linaro.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=bhelgaas@google.com \
    --cc=graeme.gregory@linaro.org \
    --cc=helgaas@kernel.org \
    --cc=leif.lindholm@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=rjw@rjwysocki.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.