Commit Graph

29 Commits

Author SHA1 Message Date
Myron Stowe 731f98d0ae PCI: Rename CRS Completion Status to RRS
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: 87f10faf166a9114aa0d4132298cad379de16fdd

commit 87f10faf166a9114aa0d4132298cad379de16fdd
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Tue Aug 27 18:48:48 2024 -0500

    PCI: Rename CRS Completion Status to RRS

    PCIe r6.0 changed the abbreviation for "Configuration Request Retry Status"
    Completion Status from "CRS" to "RRS" and uses the terminology of
    "Configuration RRS Software Visibility" instead of "CRS Software
    Visibility".

    Align the Linux usage with the r6.0 spec language.  No functional change
    intended.

    It's confusing to make this change, but I think "RRS" *is* a better
    abbreviation because it was easy to interpret "CRS" as "Completion Retry
    Status", which really didn't make any sense.

    Link: https://lore.kernel.org/r/20240827234848.4429-4-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-17 12:01:29 -07:00
Myron Stowe 57b98bef25 PCI: xgene: Do PCI error check on own line & keep return value
JIRA: https://issues.redhat.com/browse/RHEL-26162
Upstream Status: 910ed628e511b8533e40b7e9119040c160848a57

commit 910ed628e511b8533e40b7e9119040c160848a57
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Date:   Mon Sep 11 15:53:53 2023 +0300

    PCI: xgene: Do PCI error check on own line & keep return value

    Instead of an "if" condition with a line split, use the usual error
    handling pattern with a separate variable to improve readability.

    pci_generic_config_read32() already returns either PCIBIOS_SUCCESSFUL or
    PCIBIOS_DEVICE_NOT_FOUND so it is enough to simply return its return value
    when ret != PCIBIOS_SUCCESSFUL.

    No functional changes intended.

    Link: https://lore.kernel.org/r/20230911125354.25501-6-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-02-25 08:39:28 -07:00
Myron Stowe fed96fd48d PCI: Remove unnecessary <linux/of_irq.h> includes
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2166398
Upstream Status: 277004d7a4a348de185fb4149ff29a651e994ff4

commit 277004d7a4a348de185fb4149ff29a651e994ff4
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Mon Oct 31 10:39:54 2022 -0500

    PCI: Remove unnecessary <linux/of_irq.h> includes

    Many host controller drivers #include <linux/of_irq.h> even though they
    don't need it.  Remove the unnecessary #includes.

    Link: https://lore.kernel.org/r/20221031153954.1163623-6-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Roy Zang <roy.zang@nxp.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-07 18:02:03 -07:00
Myron Stowe 0991126f19 PCI: Drop of_match_ptr() to avoid unused variables
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2124638
Upstream Status: 1dff012f636d4440f2f99256c09c5b6bfacf7552

commit 1dff012f636d4440f2f99256c09c5b6bfacf7552
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Wed Jul 6 14:27:21 2022 -0500

    PCI: Drop of_match_ptr() to avoid unused variables

    We have stubs for most OF interfaces even when CONFIG_OF is not set, so we
    allow building of most controller drivers in that case for compile testing.

    When CONFIG_OF is not set, "of_match_ptr(<match_table>)" compiles to NULL,
    which leaves <match_table> unused, resulting in errors like this:

      $ make W=1
      drivers/pci/controller/pci-xgene.c:636:34: error: ‘xgene_pcie_match_table’ defined but not used [-Werror=unused-const-variable=]

    Drop of_match_ptr() to avoid the unused variable warning.

    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-10-02 07:34:14 -06:00
Myron Stowe 0d1d0f6314 PCI: xgene: Revert "PCI: xgene: Fix IB window setup"
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068174
Upstream Status: 825da4e9cec68713fbb02dc6f71fe1bf65fe8050

commit 825da4e9cec68713fbb02dc6f71fe1bf65fe8050
Author: Marc Zyngier <maz@kernel.org>
Date:   Mon Mar 21 10:48:43 2022 +0000

    PCI: xgene: Revert "PCI: xgene: Fix IB window setup"

    Commit c7a75d07827a ("PCI: xgene: Fix IB window setup") tried to
    fix the damages that 6dce5aa59e ("PCI: xgene: Use inbound resources
    for setup") caused, but actually didn't improve anything for some
    plarforms (at least Mustang and m400 are still broken).

    Given that 6dce5aa59e has been reverted, revert this patch as well,
    restoring the PCIe support on XGene to its pre-5.5, working state.

    Link: https://lore.kernel.org/r/YjN8pT5e6/8cRohQ@xps13.dannf
    Link: https://lore.kernel.org/r/20220321104843.949645-3-maz@kernel.org
    Fixes: c7a75d07827a ("PCI: xgene: Fix IB window setup")
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: stable@vger.kernel.org
    Cc: Rob Herring <robh@kernel.org>
    Cc: Toan Le <toan@os.amperecomputing.com>
    Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: Krzysztof Wilczyński <kw@linux.com>
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Stéphane Graber <stgraber@ubuntu.com>
    Cc: dann frazier <dann.frazier@canonical.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-06-16 10:11:58 -06:00
Myron Stowe 1e439c5eb6 PCI: xgene: Revert "PCI: xgene: Use inbound resources for setup"
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068174
Upstream Status: 1874b6d7ab1bdc900e8398026350313ac29caddb

commit 1874b6d7ab1bdc900e8398026350313ac29caddb
Author: Marc Zyngier <maz@kernel.org>
Date:   Mon Mar 21 10:48:42 2022 +0000

    PCI: xgene: Revert "PCI: xgene: Use inbound resources for setup"

    Commit 6dce5aa59e ("PCI: xgene: Use inbound resources for setup")
    killed PCIe on my XGene-1 box (a Mustang board). The machine itself
    is still alive, but half of its storage (over NVMe) is gone, and the
    NVMe driver just times out.

    Note that this machine boots with a device tree provided by the
    UEFI firmware (2016 vintage), which could well be non conformant
    with the spec, hence the breakage.

    With the patch reverted, the box boots 5.17-rc8 with flying colors.

    Link: https://lore.kernel.org/all/Yf2wTLjmcRj+AbDv@xps13.dannf
    Link: https://lore.kernel.org/r/20220321104843.949645-2-maz@kernel.org
    Fixes: 6dce5aa59e ("PCI: xgene: Use inbound resources for setup")
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: stable@vger.kernel.org
    Cc: Rob Herring <robh@kernel.org>
    Cc: Toan Le <toan@os.amperecomputing.com>
    Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Cc: Krzysztof Wilczyński <kw@linux.com>
    Cc: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Stéphane Graber <stgraber@ubuntu.com>
    Cc: dann frazier <dann.frazier@canonical.com

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-06-16 10:11:55 -06:00
Myron Stowe 10336f15bb sizes.h: Add SZ_1T macro
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2068174
Upstream Status: 0cc62aed370d91ec3d5cf258e53028c736e88a09

commit 0cc62aed370d91ec3d5cf258e53028c736e88a09
Author: Christophe Leroy <christophe.leroy@csgroup.eu>
Date:   Fri Jan 21 08:42:21 2022 +0000

    sizes.h: Add SZ_1T macro

    Today drivers/pci/controller/pci-xgene.c defines SZ_1T

    Move it into linux/sizes.h so that it can be re-used elsewhere.

    Link: https://lore.kernel.org/r/575cb7164cf124c75df7cb9242ea7374733942bf.1642752946.git.christophe.leroy@csgroup.eu
    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
    Acked-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Toan Le <toan@os.amperecomputing.com>
    Cc: linux-pci@vger.kernel.org

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-06-16 10:10:57 -06:00
Myron Stowe 2cbdedd48f PCI: xgene: Rename xgene_pcie_port to xgene_pcie
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 24d174a116f6f0dd05c46b00d054f4ba85f9d010

commit 24d174a116f6f0dd05c46b00d054f4ba85f9d010
Author: Fan Fei <ffclaire1224@gmail.com>
Date:   Wed Dec 22 19:10:52 2021 -0600

    PCI: xgene: Rename xgene_pcie_port to xgene_pcie

    Rename struct xgene_pcie_port to xgene_pcie to match the convention of
    <driver>_pcie. No functional change intended.

    Link: https://lore.kernel.org/r/20211223011054.1227810-22-helgaas@kernel.org
    Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Toan Le <toan@os.amperecomputing.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:10 -06:00
Myron Stowe d2faf10379 PCI: xgene: Use PCI_ERROR_RESPONSE to identify config read errors
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: c78b9a9cbde5fe07ae7c3cc3789e43349db8c437

commit c78b9a9cbde5fe07ae7c3cc3789e43349db8c437
Author: Naveen Naidu <naveennaidu479@gmail.com>
Date:   Thu Nov 18 19:33:35 2021 +0530

    PCI: xgene: Use PCI_ERROR_RESPONSE to identify config read errors

    Include PCI_ERROR_RESPONSE along with 0xffffffff in the comment about
    identifying config read errors. This makes checks for config read errors
    easier to find. Comment change only.

    Link: https://lore.kernel.org/r/388b9733bd55394581c447be9f3df42ca2c9759c.1637243717.git.naveennaidu479@gmail.com
    Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:07 -06:00
Myron Stowe f5aa5aa38d PCI: xgene: Fix IB window setup
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: c7a75d07827a1f33d566e18e6098379cc2a0c2b2

commit c7a75d07827a1f33d566e18e6098379cc2a0c2b2
Author: Rob Herring <robh@kernel.org>
Date:   Mon Nov 29 11:36:37 2021 -0600

    PCI: xgene: Fix IB window setup

    Commit 6dce5aa59e ("PCI: xgene: Use inbound resources for setup")
    broke PCI support on XGene. The cause is the IB resources are now sorted
    in address order instead of being in DT dma-ranges order. The result is
    which inbound registers are used for each region are swapped. I don't
    know the details about this h/w, but it appears that IB region 0
    registers can't handle a size greater than 4GB. In any case, limiting
    the size for region 0 is enough to get back to the original assignment
    of dma-ranges to regions.

    Link: https://lore.kernel.org/all/CA+enf=v9rY_xnZML01oEgKLmvY1NGBUUhnSJaETmXtDtXfaczA@mail.gmail.com/
    Link: https://lore.kernel.org/r/20211129173637.303201-1-robh@kernel.org
    Fixes: 6dce5aa59e ("PCI: xgene: Use inbound resources for setup")
    Reported-by: Stéphane Graber <stgraber@ubuntu.com>
    Tested-by: Stéphane Graber <stgraber@ubuntu.com>
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
    Cc: stable@vger.kernel.org # v5.5+

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:01 -06:00
Myron Stowe 21816a5d2c PCI: xgene: Use PCI_VENDOR_ID_AMCC macro
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: 894682f0a9b34dcb6e8d2ee2d5f6380b24a5b2d9

commit 894682f0a9b34dcb6e8d2ee2d5f6380b24a5b2d9
Author: Pali Rohár <pali@kernel.org>
Date:   Mon Sep 27 15:43:56 2021 +0200

    PCI: xgene: Use PCI_VENDOR_ID_AMCC macro

    Header file linux/pci_ids.h defines AMCC vendor id (0x10e8) macro named
    PCI_VENDOR_ID_AMCC. So use this macro instead of driver custom macro.

    Link: https://lore.kernel.org/r/20210927134356.11799-1-pali@kernel.org
    Signed-off-by: Pali Rohár <pali@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:50:13 -06:00
Bjorn Helgaas 4343292f80 Merge branch 'pci/kernel-doc'
- Fix kernel-doc formatting errors (Krzysztof Wilczyński)

* pci/kernel-doc:
  PCI: Fix kernel-doc formatting
2021-07-06 10:56:29 -05:00
Bjorn Helgaas 662e4b0343 PCI: xgene: Annotate __iomem pointer
"bar_addr" is passed as the argument to writel(), which expects a
"void __iomem *".  Annotate "bar_addr" correctly.  Resolves an sparse
"incorrect type in argument 2 (different address spaces)" warning.

Link: https://lore.kernel.org/r/202105171809.Tay9fImZ-lkp@intel.com
Link: https://lore.kernel.org/r/20210517171839.25777-1-helgaas@kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2021-07-06 10:39:10 -05:00
Krzysztof Wilczyński 347269c113 PCI: Fix kernel-doc formatting
Fix kernel-doc formatting throughout drivers/pci and related include files.
No change to functionality intended.

Check for warnings:

  $ find include drivers/pci -type f -path "*pci*.[ch]" | xargs scripts/kernel-doc -none

[bhelgaas: squashed to one commit]
Link: https://lore.kernel.org/r/20210509030237.368540-1-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-1-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-2-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-3-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-4-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-5-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2021-07-06 10:37:46 -05:00
Dejin Zheng d4707d79fa PCI: xgene: Fix cfg resource mapping
In commit e2dcd20b16 a change was made to use
devm_platform_ioremap_resource_byname() to simplify code and remove
the res variable; this was wrong since the res variable is still needed
and as an outcome the port->cfg_addr gets an erroneous address.

Revert the change going back to original behaviour.

Link: https://lore.kernel.org/r/20210328144118.305074-1-zhengdejin5@gmail.com
Fixes: e2dcd20b16 ("PCI: controller: Convert to devm_platform_ioremap_resource_byname()")
Reported-by: dann.frazier@canonical.com
Tested-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: stable@vger.kernel.org    # v5.9+
2021-03-31 10:28:38 +01:00
Bjorn Helgaas cc4a08cd09 PCI: xgene: Fix CRS SV comment
Configuration Request Retry Status ("CRS") must be supported by all PCIe
devices.  CRS Software Visibility is an optional feature that enables a
Root Port to make CRS visible to software by returning a special data value
to complete a config read.

Clarify a comment to say that it is "CRS SV", not "CRS", that can be
enabled.

Link: https://lore.kernel.org/r/20210126213503.2922848-1-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2021-01-28 10:46:43 +00:00
Krzysztof Wilczyński cddadae974 PCI: xgene: Removed unused ".bus_shift" initialisers from pci-xgene.c
Removed unused ".bus_shift" initialisers from pci-xgene.c as
xgene_pcie_map_bus() did not use these.

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20201129230743.3006978-6-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2020-12-10 14:56:11 -06:00
Rob Herring b64aa11eb2 PCI: Set bridge map_irq and swizzle_irq to default functions
The majority of DT based host drivers use the default .map_irq() and
.swizzle_irq() functions, so let's initialize the function pointers to
the default and drop setting them in the host drivers.

Drivers like iProc which don't support legacy interrupts need to set
.map_irq() back to NULL.

Link: https://lore.kernel.org/r/20200722022514.1283916-20-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-08-04 16:36:30 +01:00
Rob Herring 669cbc7081 PCI: Move DT resource setup into devm_pci_alloc_host_bridge()
Now that pci_parse_request_of_pci_ranges() callers just setup
pci_host_bridge.windows and dma_ranges directly and don't need the bus
range returned, we can just initialize them when allocating the
pci_host_bridge struct.

With this, pci_parse_request_of_pci_ranges() becomes a static function.

Link: https://lore.kernel.org/r/20200722022514.1283916-19-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-08-04 16:36:30 +01:00
Rob Herring d3bb94d06a PCI: Drop unnecessary zeroing of bridge fields
The struct pci_host_bridge is 0 initialized when allocated, so there's
no need to explicitly set fields to 0.

Link: https://lore.kernel.org/r/20200722022514.1283916-4-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-07-23 11:20:50 +01:00
Rob Herring 6a589900d0 PCI: Set default bridge parent device
The host bridge's parent device is always the platform device. As we
already have a pointer to it in the devres functions, let's initialize
the parent device. Drivers can still override the parent if desired.

Link: https://lore.kernel.org/r/20200722022514.1283916-3-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-07-23 11:20:49 +01:00
Dejin Zheng e2dcd20b16 PCI: controller: Convert to devm_platform_ioremap_resource_byname()
Use devm_platform_ioremap_resource_byname() to simplify the code,
since it calls respectively platform_get_resource_byname() and
devm_ioremap_resource().

Link: https://lore.kernel.org/r/20200602171601.17630-1-zhengdejin5@gmail.com
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
2020-07-10 11:50:23 +01:00
Rob Herring 97c5372aeb PCI: xgene: Use pci_host_probe() to register host
The xgene host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.

Link: https://lore.kernel.org/r/20200522234832.954484-10-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Toan Le <toan@os.amperecomputing.com>
2020-07-10 11:50:23 +01:00
Rob Herring 0b104773b4 PCI: Constify struct pci_ecam_ops
struct pci_ecam_ops is typically DT match table data which is defined to
be const. It's also best practice for ops structs to be const. Ideally,
we'd make struct pci_ops const as well, but that becomes pretty
invasive, so for now we just cast it where needed.

Link: https://lore.kernel.org/r/20200409234923.21598-2-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andrew Murray <amurray@thegoodpenguin.co.uk>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Jonathan Chocron <jonnyc@amazon.com>
Cc: Zhou Wang <wangzhou1@hisilicon.com>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Mans Rullgard <mans@mansr.com>
Cc: linux-acpi@vger.kernel.org
2020-05-01 16:28:59 +01:00
Rob Herring 6dce5aa59e PCI: xgene: Use inbound resources for setup
Now that the helpers provide the inbound resources in the host bridge
'dma_ranges' resource list, convert the Xgene host bridge to use the
resource list to setup the inbound addresses.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2019-11-20 17:00:14 +00:00
Rob Herring 331f634571 PCI: of: Add inbound resource parsing to helpers
Extend devm_of_pci_get_host_bridge_resources() and
pci_parse_request_of_pci_ranges() helpers to also parse the inbound
addresses from DT 'dma-ranges' and populate a resource list with the
translated addresses. This will help ensure 'dma-ranges' is always
parsed in a consistent way.

Tested-by: Srinath Mannam <srinath.mannam@broadcom.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> # for AArdvark
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Will Deacon <will@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Tom Joseph <tjoseph@cadence.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>
Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Cc: Simon Horman <horms@verge.net.au>
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: rfi@lists.rocketboards.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
2019-11-20 16:59:58 +00:00
Rob Herring 83083e241d PCI: xgene: Use pci_parse_request_of_pci_ranges()
Convert the xgene host bridge to use the common
pci_parse_request_of_pci_ranges().

There's no need to assign the resources to a temporary list first. Just
use bridge->windows directly and remove all the temporary list handling.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Andrew Murray <andrew.murray@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2019-10-29 10:51:18 +00:00
Sergei Shtylyov 925652d035 PCI: xgene: Fix I/O space page leak
When testing the R-Car PCIe driver on the Condor board, if the PCIe PHY
driver was left disabled, the kernel crashed with this BUG:

  kernel BUG at lib/ioremap.c:72!
  Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
  Modules linked in:
  CPU: 0 PID: 39 Comm: kworker/0:1 Not tainted 4.17.0-dirty #1092
  Hardware name: Renesas Condor board based on r8a77980 (DT)
  Workqueue: events deferred_probe_work_func
  pstate: 80000005 (Nzcv daif -PAN -UAO)
  pc : ioremap_page_range+0x370/0x3c8
  lr : ioremap_page_range+0x40/0x3c8
  sp : ffff000008da39e0
  x29: ffff000008da39e0 x28: 00e8000000000f07
  x27: ffff7dfffee00000 x26: 0140000000000000
  x25: ffff7dfffef00000 x24: 00000000000fe100
  x23: ffff80007b906000 x22: ffff000008ab8000
  x21: ffff000008bb1d58 x20: ffff7dfffef00000
  x19: ffff800009c30fb8 x18: 0000000000000001
  x17: 00000000000152d0 x16: 00000000014012d0
  x15: 0000000000000000 x14: 0720072007200720
  x13: 0720072007200720 x12: 0720072007200720
  x11: 0720072007300730 x10: 00000000000000ae
  x9 : 0000000000000000 x8 : ffff7dffff000000
  x7 : 0000000000000000 x6 : 0000000000000100
  x5 : 0000000000000000 x4 : 000000007b906000
  x3 : ffff80007c61a880 x2 : ffff7dfffeefffff
  x1 : 0000000040000000 x0 : 00e80000fe100f07
  Process kworker/0:1 (pid: 39, stack limit = 0x        (ptrval))
  Call trace:
   ioremap_page_range+0x370/0x3c8
   pci_remap_iospace+0x7c/0xac
   pci_parse_request_of_pci_ranges+0x13c/0x190
   rcar_pcie_probe+0x4c/0xb04
   platform_drv_probe+0x50/0xbc
   driver_probe_device+0x21c/0x308
   __device_attach_driver+0x98/0xc8
   bus_for_each_drv+0x54/0x94
   __device_attach+0xc4/0x12c
   device_initial_probe+0x10/0x18
   bus_probe_device+0x90/0x98
   deferred_probe_work_func+0xb0/0x150
   process_one_work+0x12c/0x29c
   worker_thread+0x200/0x3fc
   kthread+0x108/0x134
   ret_from_fork+0x10/0x18
  Code: f9004ba2 54000080 aa0003fb 17ffff48 (d4210000)

It turned out that pci_remap_iospace() wasn't undone when the driver's
probe failed, and since devm_phy_optional_get() returned -EPROBE_DEFER,
the probe was retried, finally causing the BUG due to trying to remap
already remapped pages.

The X-Gene PCI controller driver has the same issue.
Replace pci_remap_iospace() with the devm_ managed version so that the
pages get unmapped automagically on any probe failure.

Fixes: 5f6b6ccdbe ("PCI: xgene: Add APM X-Gene PCIe driver")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[lorenzo.pieralisi@arm.com: updated the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2018-07-18 16:59:40 -05:00
Shawn Lin 6e0832fa43 PCI: Collect all native drivers under drivers/pci/controller/
Native PCI drivers for root complex devices were originally all in
drivers/pci/host/.  Some of these devices can also be operated in endpoint
mode.  Drivers for endpoint mode didn't seem to fit in the "host"
directory, so we put both the root complex and endpoint drivers in
per-device directories, e.g., drivers/pci/dwc/, drivers/pci/cadence/, etc.

These per-device directories contain trivial Kconfig and Makefiles and
clutter drivers/pci/.  Make a new drivers/pci/controllers/ directory and
collect all the device-specific drivers there.

No functional change intended.

Link: https://lkml.kernel.org/r/1520304202-232891-1-git-send-email-shawn.lin@rock-chips.com
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-06-08 07:50:11 -05:00