Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1487351

Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific register range for ACPI case

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific register range for ACPI case
Date 2016-09-20 15:50 +0200
Message-ID <sjtAR-3Al-11@gated-at.bofh.it> (permalink)
References <sfzER-6Yg-5@gated-at.bofh.it> <sfzES-6Yg-23@gated-at.bofh.it> <sjbaV-lY-19@gated-at.bofh.it> <sjnF7-8kJ-5@gated-at.bofh.it> <sjtrc-3wU-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 20 September 2016 at 14:33, Bjorn Helgaas <helgaas@kernel.org> wrote:
> [+cc Rafael (maybe already cc'd; I didn't recognize rafael@kernel.org, Duc]
>
> On Tue, Sep 20, 2016 at 09:23:21AM +0200, Tomasz Nowicki wrote:
>> On 19.09.2016 20:09, Bjorn Helgaas wrote:
>> >On Fri, Sep 09, 2016 at 09:24:05PM +0200, Tomasz Nowicki wrote:
>> >>thunder-pem driver stands for being ACPI based PCI host controller.
>> >>However, there is no standard way to describe its PEM-specific register
>> >>ranges in ACPI tables. Thus we add thunder_pem_init() ACPI extension
>> >>to obtain hardcoded addresses from static resource array.
>> >>Although it is not pretty, it prevents from creating standard mechanism to
>> >>handle similar cases in future.
>> >>
>> >>Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
>> >>---
>> >> drivers/pci/host/pci-thunder-pem.c | 61 ++++++++++++++++++++++++++++++--------
>> >> 1 file changed, 48 insertions(+), 13 deletions(-)
>> >>
>> >>diff --git a/drivers/pci/host/pci-thunder-pem.c b/drivers/pci/host/pci-thunder-pem.c
>> >>index 6abaf80..b048761 100644
>> >>--- a/drivers/pci/host/pci-thunder-pem.c
>> >>+++ b/drivers/pci/host/pci-thunder-pem.c
>> >>@@ -18,6 +18,7 @@
>> >> #include <linux/init.h>
>> >> #include <linux/of_address.h>
>> >> #include <linux/of_pci.h>
>> >>+#include <linux/pci-acpi.h>
>> >> #include <linux/pci-ecam.h>
>> >> #include <linux/platform_device.h>
>> >>
>> >>@@ -284,6 +285,40 @@ static int thunder_pem_config_write(struct pci_bus *bus, unsigned int devfn,
>> >>    return pci_generic_config_write(bus, devfn, where, size, val);
>> >> }
>> >>
>> >>+#ifdef CONFIG_ACPI
>> >>+static struct resource thunder_pem_reg_res[] = {
>> >>+   [4] = DEFINE_RES_MEM(0x87e0c0000000UL, SZ_16M),
>> >>+   [5] = DEFINE_RES_MEM(0x87e0c1000000UL, SZ_16M),
>> >>+   [6] = DEFINE_RES_MEM(0x87e0c2000000UL, SZ_16M),
>> >>+   [7] = DEFINE_RES_MEM(0x87e0c3000000UL, SZ_16M),
>> >>+   [8] = DEFINE_RES_MEM(0x87e0c4000000UL, SZ_16M),
>> >>+   [9] = DEFINE_RES_MEM(0x87e0c5000000UL, SZ_16M),
>> >>+   [14] = DEFINE_RES_MEM(0x97e0c0000000UL, SZ_16M),
>> >>+   [15] = DEFINE_RES_MEM(0x97e0c1000000UL, SZ_16M),
>> >>+   [16] = DEFINE_RES_MEM(0x97e0c2000000UL, SZ_16M),
>> >>+   [17] = DEFINE_RES_MEM(0x97e0c3000000UL, SZ_16M),
>> >>+   [18] = DEFINE_RES_MEM(0x97e0c4000000UL, SZ_16M),
>> >>+   [19] = DEFINE_RES_MEM(0x97e0c5000000UL, SZ_16M),
>> >
>> >1) The "correct" way to discover the resources consumed by an ACPI
>> >   device is to use the _CRS method.  I know there are some issues
>> >   there for bridges (not the fault of ThunderX!) because there's not
>> >   a good way to distinguish windows from resources consumed directly
>> >   by the bridge.
>> >
>> >   But we should either do this correctly, or include a comment about
>> >   why we're doing it wrong, so we don't give the impression that this
>> >   is the right way to do it.
>> >
>> >   I seem to recall some discussion about why we're doing it this way,
>> >   but I don't remember the details.  It'd be nice to include a
>> >   summary here.
>>
>> OK I will. The reason why we cannot use _CRS for this case is that
>> CONSUMER flag was not use consistently for the bridge so far.
>
> Yes, I'm aware of that problem, but hard-coding resources into drivers
> is just a disaster.  The PCI and ACPI cores need generic ways to learn
> what resources are consumed by devices.  For PCI devices, that's done
> with BARs.  For ACPI devices, it's done with _CRS.  Without generic
> resource discovery, we can't manage resources reliably at the system
> level [1].
>
> You have a PNP0A03/PNP0A08 device for the PCI host bridge.  Because of
> the BIOS bugs in CONSUMER flag usage, we assume everything in its _CRS
> is a window and not consumed by the bridge itself.  What if you added
> a companion ACPI device with a _CRS that contained the bridge
> resources?  Then you'd have some driver ugliness to find that device,
> but at least the ACPI core could tell what resources were in use.
>
> Maybe Rafael has a better idea?
>

In the discussions leading up to this, we tried very hard to make this
arm64/acpi quirks mechanism just as flexible as we need it to be to
cover the current crop of incompatible hardware, but not more so.
Going forward, we intend to require all arm64/acpi hardware to be spec
compliant, and so any parametrization beyond what is required for the
currently known broken hardware is only going to make it easier for
others to ship with tweaked ACPI descriptions so that an existing
quirk is triggered for hardware that it was not intended for. It also
implies that we have to deal with the ACPI descriptions as they were
shipped with the current hardware.

That does not mean, of course, that we should use bare constants
rather than symbolic ones, but anything beyond that exceeds the
desired scope of quirks handling.

-- 
Ard.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Tomasz Nowicki <tn@semihalf.com> - 2016-09-09 21:30 +0200
  [PATCH V6 4/5] PCI: thunder: Enable ACPI PCI controller for ThunderX pass2.x silicon version Tomasz Nowicki <tn@semihalf.com> - 2016-09-09 21:30 +0200
    Re: [PATCH V6 4/5] PCI: thunder: Enable ACPI PCI controller for  ThunderX pass2.x silicon version Bjorn Helgaas <helgaas@kernel.org> - 2016-09-19 17:50 +0200
      Re: [PATCH V6 4/5] PCI: thunder: Enable ACPI PCI controller for  ThunderX pass2.x silicon version Tomasz Nowicki <tn@semihalf.com> - 2016-09-20 09:10 +0200
        Re: [PATCH V6 4/5] PCI: thunder: Enable ACPI PCI controller for  ThunderX pass2.x silicon version Bjorn Helgaas <helgaas@kernel.org> - 2016-09-20 15:20 +0200
          Re: [PATCH V6 4/5] PCI: thunder: Enable ACPI PCI controller for  ThunderX pass2.x silicon version Tomasz Nowicki <tn@semihalf.com> - 2016-09-21 10:10 +0200
  [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific register range for ACPI case Tomasz Nowicki <tn@semihalf.com> - 2016-09-09 21:30 +0200
    Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-19 20:10 +0200
      Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Tomasz Nowicki <tn@semihalf.com> - 2016-09-20 09:30 +0200
        Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-20 15:40 +0200
          Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-20 15:50 +0200
            Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-20 16:10 +0200
              Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-09-20 17:10 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-20 21:20 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-09-21 16:10 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-21 20:10 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Duc Dang <dhdang@apm.com> - 2016-09-21 21:10 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-21 21:20 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Tomasz Nowicki <tn@semihalf.com> - 2016-09-23 13:00 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-09-22 11:50 +0200
                RE: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Gabriele Paoloni <gabriele.paoloni@huawei.com> - 2016-09-22 13:20 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-09-22 14:50 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-22 20:40 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-23 00:20 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-09-23 12:20 +0200
                RE: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Gabriele Paoloni <gabriele.paoloni@huawei.com> - 2016-09-23 13:00 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Christopher Covington <cov@codeaurora.org> - 2016-09-22 16:30 +0200
                RE: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Gabriele Paoloni <gabriele.paoloni@huawei.com> - 2016-09-21 16:20 +0200
                Re: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Bjorn Helgaas <helgaas@kernel.org> - 2016-09-21 21:00 +0200
                RE: [PATCH V6 3/5] PCI: thunder-pem: Allow to probe PEM-specific  register range for ACPI case Gabriele Paoloni <gabriele.paoloni@huawei.com> - 2016-09-22 13:20 +0200
  [PATCH V6 1/5] PCI/ACPI: Extend pci_mcfg_lookup() responsibilities Tomasz Nowicki <tn@semihalf.com> - 2016-09-09 21:30 +0200
  Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Tomasz Nowicki <tn@semihalf.com> - 2016-09-09 21:40 +0200
  Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Bjorn Helgaas <helgaas@kernel.org> - 2016-09-20 21:30 +0200
    Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms cov@codeaurora.org - 2016-09-21 03:20 +0200
      Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Bjorn Helgaas <helgaas@kernel.org> - 2016-09-21 15:20 +0200
        Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Sinan Kaya <okaya@codeaurora.org> - 2016-09-21 16:10 +0200
          Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Sinan Kaya <okaya@codeaurora.org> - 2016-09-21 19:40 +0200
          Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Bjorn Helgaas <helgaas@kernel.org> - 2016-09-21 19:40 +0200
            [PATCHv2] PCI: QDF2432 32 bit config space accessors Christopher Covington <cov@codeaurora.org> - 2016-09-22 00:40 +0200
        Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Christopher Covington <cov@codeaurora.org> - 2016-09-22 00:50 +0200
          Re: [PATCH V6 0/5] ECAM quirks handling for ARM64 platforms Bjorn Helgaas <helgaas@kernel.org> - 2016-09-23 01:10 +0200

csiph-web