Commit 1c2b4a4c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull PCI updates from Bjorn Helgaas:
 "Enumeration:

   - Don't try to enable Extended Tags on VFs since that bit is Reserved
     and causes misleading log messages (Håkon Bugge)

   - Initialize Endpoint Read Completion Boundary to match Root Port,
     regardless of ACPI _HPX (Håkon Bugge)

   - Apply _HPX PCIe Setting Record only to AER configuration, and only
     when OS owns PCIe hotplug but not AER, to avoid clobbering Extended
     Tag and Relaxed Ordering settings (Håkon Bugge)

  Resource management:

   - Move CardBus code to setup-cardbus.c and only build it when
     CONFIG_CARDBUS is set (Ilpo Järvinen)

   - Fix bridge window alignment with optional resources, where
     additional alignment requirement was previously lost (Ilpo
     Järvinen)

   - Stop over-estimating bridge window size since they are now assigned
     without any gaps between them (Ilpo Järvinen)

   - Increase resource MAX_IORES_LEVEL to avoid /proc/iomem flattening
     for nested bridges and endpoints (Ilpo Järvinen)

   - Add pbus_mem_size_optional() to handle sizes of optional resources
     (SR-IOV VF BARs, expansion ROMs, bridge windows) (Ilpo Järvinen)

   - Don't claim disabled bridge windows to avoid spurious claim
     failures (Ilpo Järvinen)

  Driver binding:

   - Fix device reference leak in pcie_port_remove_service() (Uwe
     Kleine-König)

   - Move pcie_port_bus_match() and pcie_port_bus_type to PCIe-specific
     portdrv.c (Uwe Kleine-König)

   - Convert portdrv to use pcie_port_bus_type.probe() and .remove()
     callbacks so .probe() and .remove() can eventually be removed from
     struct device_driver (Uwe Kleine-König)

  Error handling:

   - Clear stale errors on reporting agents upon probe so they don't
     look like recent errors (Lukas Wunner)

   - Add generic RAS tracepoint for hotplug events (Shuai Xue)

   - Add RAS tracepoint for link speed changes (Shuai Xue)

  Power management:

   - Avoid redundant delay on transition from D3hot to D3cold if the
     device was already in D3hot (Brian Norris)

   - Prevent runtime suspend until devices are fully initialized to
     avoid saving incompletely configured device state (Brian Norris)

  Power control:

   - Add power_on/off callbacks with generic signature to pwrseq,
     tc9563, and slot drivers so they can be used by pwrctrl core
     (Manivannan Sadhasivam)

   - Add PCIe M.2 connector support to the slot pwrctrl driver
     (Manivannan Sadhasivam)

   - Switch to pwrctrl interfaces to create, destroy, and power on/off
     devices, calling them from host controller drivers instead of the
     PCI core (Manivannan Sadhasivam)

   - Drop qcom .assert_perst() callbacks since this is now done by the
     controller driver instead of the pwrctrl driver (Manivannan
     Sadhasivam)

  Virtualization:

   - Remove an incorrect unlock in pci_slot_trylock() error handling
     (Jinhui Guo)

   - Lock the bridge device for slot reset (Keith Busch)

   - Enable ACS after IOMMU configuration on OF platforms so ACS is
     enabled an all devices; previously the first device enumerated
     (typically a Root Port) didn't have ACS enabled (Manivannan
     Sadhasivam)

   - Disable ACS Source Validation for IDT 0x80b5 and 0x8090 switches to
     work around hardware erratum; previously ACS SV was only
     temporarily disabled, which worked for enumeration but not after
     reset (Manivannan Sadhasivam)

  Peer-to-peer DMA:

   - Release per-CPU pgmap ref when vm_insert_page() fails to avoid hang
     when removing the PCI device (Hou Tao)

   - Remove incorrect p2pmem_alloc_mmap() warning about page refcount
     (Hou Tao)

  Endpoint framework:

   - Add configfs sub-groups synchronously to avoid NULL pointer
     dereference when racing with removal (Liu Song)

   - Fix swapped parameters in pci_{primary/secondary}_epc_epf_unlink()
     functions (Manikanta Maddireddy)

  ASPEED PCIe controller driver:

   - Add ASPEED Root Complex DT binding and driver (Jacky Chou)

  Freescale i.MX6 PCIe controller driver:

   - Add DT binding and driver support for an optional external refclock
     in addition to the refclock from the internal PLL (Richard Zhu)

   - Fix CLKREQ# control so host asserts it during enumeration and
     Endpoints can use it afterwards to exit the L1.2 link state
     (Richard Zhu)

  NVIDIA Tegra PCIe controller driver:

   - Export irq_domain_free_irqs() to allow PCI/MSI drivers that tear
     down MSI domains to be built as modules (Aaron Kling)

   - Allow pci-tegra to be built as a module (Aaron Kling)

  NVIDIA Tegra194 PCIe controller driver:

   - Relax Kconfig so tegra194 can be built for platforms beyond
     Tegra194 (Vidya Sagar)

  Qualcomm PCIe controller driver:

   - Merge SC8180x DT binding into SM8150 (Krzysztof Kozlowski)

   - Move SDX55, SDM845, QCS404, IPQ5018, IPQ6018, IPQ8074 Gen3,
     IPQ8074, IPQ4019, IPQ9574, APQ8064, MSM8996, APQ8084 to dedicated
     schema (Krzysztof Kozlowski)

   - Add DT binding and driver support for SA8255p Endpoint being
     configured by firmware (Mrinmay Sarkar)

   - Parse PERST# from all PCIe bridge nodes for future platforms that
     will have PERST# in Switch Downstream Ports as well as in Root
     Ports (Manivannan Sadhasivam)

  Renesas RZ/G3S PCIe controller driver:

   - Use pci_generic_config_write() since the writability provided by
     the custom wrapper is unnecessary (Claudiu Beznea)

  SOPHGO PCIe controller driver:

   - Disable ASPM L0s and L1 on Sophgo 2044 PCIe Root Ports (Inochi
     Amaoto)

  Synopsys DesignWare PCIe controller driver:

   - Extend PCI_FIND_NEXT_CAP() and PCI_FIND_NEXT_EXT_CAP() to return a
     pointer to the preceding Capability, to allow removal of
     Capabilities that are advertised but not fully implemented (Qiang
     Yu)

   - Remove MSI and MSI-X Capabilities in platforms that can't support
     them, so the PCI core automatically falls back to INTx (Qiang Yu)

   - Add ASPM L1.1 and L1.2 Substates context to debugfs ltssm_status
     for drivers that support this (Shawn Lin)

   - Skip PME_Turn_Off broadcast and L2/L3 transition during suspend if
     link is not up to avoid an unnecessary timeout (Manivannan
     Sadhasivam)

   - Revert dw-rockchip, qcom, and DWC core changes that used link-up
     IRQs to trigger enumeration instead of waiting for link to be up
     because the PCI core doesn't allocate bus number space for
     hierarchies that might be attached (Niklas Cassel)

   - Make endpoint iATU entry for MSI permanent instead of programming
     it dynamically, which is slow and racy with respect to other
     concurrent traffic, e.g., eDMA (Koichiro Den)

   - Use iMSI-RX MSI target address when possible to fix endpoints using
     32-bit MSI (Shawn Lin)

   - Allow DWC host controller driver probe to continue if device is not
     found or found but inactive; only fail when there's an error with
     the link (Manivannan Sadhasivam)

   - For controllers like NXP i.MX6QP and i.MX7D, where LTSSM registers
     are not accessible after PME_Turn_Off, simply wait 10ms instead of
     polling for L2/L3 Ready (Richard Zhu)

   - Use multiple iATU entries to map large bridge windows and DMA
     ranges when necessary instead of failing (Samuel Holland)

   - Add EPC dynamic_inbound_mapping feature bit for Endpoint
     Controllers that can update BAR inbound address translation without
     requiring EPF driver to clear/reset the BAR first, and advertise it
     for DWC-based Endpoints (Koichiro Den)

   - Add EPC subrange_mapping feature bit for Endpoint Controllers that
     can map multiple independent inbound regions in a single BAR,
     implement subrange mapping, advertise it for DWC-based Endpoints,
     and add Endpoint selftests for it (Koichiro Den)

   - Make resizable BARs work for Endpoint multi-PF configurations;
     previously it only worked for PF 0 (Aksh Garg)

   - Fix Endpoint non-PF 0 support for BAR configuration, ATU mappings,
     and Address Match Mode (Aksh Garg)

   - Set up iATU when ECAM is enabled; previously IO and MEM outbound
     windows weren't programmed, and ECAM-related iATU entries weren't
     restored after suspend/resume, so config accesses failed (Krishna
     Chaitanya Chundru)

  Miscellaneous:

   - Use system_percpu_wq and WQ_PERCPU to explicitly request per-CPU
     work so WQ_UNBOUND can eventually be removed (Marco Crivellari)"

* tag 'pci-v7.0-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: (176 commits)
  PCI/bwctrl: Disable BW controller on Intel P45 using a quirk
  PCI: Disable ACS SV for IDT 0x8090 switch
  PCI: Disable ACS SV for IDT 0x80b5 switch
  PCI: Cache ACS Capabilities register
  PCI: Enable ACS after configuring IOMMU for OF platforms
  PCI: Add ACS quirk for Pericom PI7C9X2G404 switches [12d8:b404]
  PCI: Add ACS quirk for Qualcomm Hamoa & Glymur
  PCI: Use device_lock_assert() to verify device lock is held
  PCI: Use lockdep_assert_held(pci_bus_sem) to verify lock is held
  PCI: Fix pci_slot_lock () device locking
  PCI: Fix pci_slot_trylock() error handling
  PCI: Mark Nvidia GB10 to avoid bus reset
  PCI: Mark ASM1164 SATA controller to avoid bus reset
  PCI: host-generic: Avoid reporting incorrect 'missing reg property' error
  PCI/PME: Replace RMW of Root Status register with direct write
  PCI/AER: Clear stale errors on reporting agents upon probe
  PCI: Don't claim disabled bridge windows
  PCI: rzg3s-host: Fix device node reference leak in rzg3s_pcie_host_parse_port()
  PCI: dwc: Fix missing iATU setup when ECAM is enabled
  PCI: dwc: Clean up iATU index usage in dw_pcie_iatu_setup()
  ...
parents 61e62959 dff645f5
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -95,6 +95,30 @@ by the PCI endpoint function driver.
   Register space of the function driver is usually configured
   using this API.

   Some endpoint controllers also support calling pci_epc_set_bar() again
   for the same BAR (without calling pci_epc_clear_bar()) to update inbound
   address translations after the host has programmed the BAR base address.
   Endpoint function drivers can check this capability via the
   dynamic_inbound_mapping EPC feature bit.

   When pci_epf_bar.num_submap is non-zero, the endpoint function driver is
   requesting BAR subrange mapping using pci_epf_bar.submap. This requires
   the EPC to advertise support via the subrange_mapping EPC feature bit.

   When an EPF driver wants to make use of the inbound subrange mapping
   feature, it requires that the BAR base address has been programmed by
   the host during enumeration. Thus, it needs to call pci_epc_set_bar()
   twice for the same BAR (requires dynamic_inbound_mapping): first with
   num_submap set to zero and configuring the BAR size, then after the PCIe
   link is up and the host enumerates the endpoint and programs the BAR
   base address, again with num_submap set to non-zero value.

   Note that when making use of the inbound subrange mapping feature, the
   EPF driver must not call pci_epc_clear_bar() between the two
   pci_epc_set_bar() calls, because clearing the BAR can clear/disable the
   BAR register or BAR decode on the endpoint while the host still expects
   the assigned BAR address to remain valid.

* pci_epc_clear_bar()

   The PCI endpoint function driver should use pci_epc_clear_bar() to reset
+19 −0
Original line number Diff line number Diff line
@@ -84,6 +84,25 @@ device, the following commands can be used::
	# echo 32 > functions/pci_epf_test/func1/msi_interrupts
	# echo 2048 > functions/pci_epf_test/func1/msix_interrupts

By default, pci-epf-test uses the following BAR sizes::

	# grep . functions/pci_epf_test/func1/pci_epf_test.0/bar?_size
	  functions/pci_epf_test/func1/pci_epf_test.0/bar0_size:131072
	  functions/pci_epf_test/func1/pci_epf_test.0/bar1_size:131072
	  functions/pci_epf_test/func1/pci_epf_test.0/bar2_size:131072
	  functions/pci_epf_test/func1/pci_epf_test.0/bar3_size:131072
	  functions/pci_epf_test/func1/pci_epf_test.0/bar4_size:131072
	  functions/pci_epf_test/func1/pci_epf_test.0/bar5_size:1048576

The user can override a default value using e.g.::
	# echo 1048576 > functions/pci_epf_test/func1/pci_epf_test.0/bar1_size

Overriding the default BAR sizes can only be done before binding the
pci-epf-test device to a PCI endpoint controller driver.

Note: Some endpoint controllers might have fixed-size BARs or reserved BARs;
for such controllers, the corresponding BAR size in configfs will be ignored.


Binding pci-epf-test Device to EP Controller
--------------------------------------------
+7 −7
Original line number Diff line number Diff line
@@ -52,14 +52,14 @@ pci-epf-vntb device, the following commands can be used::
	# cd /sys/kernel/config/pci_ep/
	# mkdir functions/pci_epf_vntb/func1

The "mkdir func1" above creates the pci-epf-ntb function device that will
The "mkdir func1" above creates the pci-epf-vntb function device that will
be probed by pci_epf_vntb driver.

The PCI endpoint framework populates the directory with the following
configurable fields::

	# ls functions/pci_epf_ntb/func1
	baseclass_code    deviceid          msi_interrupts    pci-epf-ntb.0
	# ls functions/pci_epf_vntb/func1
	baseclass_code    deviceid          msi_interrupts    pci-epf-vntb.0
	progif_code       secondary         subsys_id         vendorid
	cache_line_size   interrupt_pin     msix_interrupts   primary
	revid             subclass_code     subsys_vendor_id
@@ -111,13 +111,13 @@ A sample configuration for virtual NTB driver for virtual PCI bus::
	# echo 0x080A > functions/pci_epf_vntb/func1/pci_epf_vntb.0/vntb_pid
	# echo 0x10 > functions/pci_epf_vntb/func1/pci_epf_vntb.0/vbus_number

Binding pci-epf-ntb Device to EP Controller
Binding pci-epf-vntb Device to EP Controller
--------------------------------------------

NTB function device should be attached to PCI endpoint controllers
connected to the host.

	# ln -s controllers/5f010000.pcie_ep functions/pci-epf-ntb/func1/primary
	# ln -s controllers/5f010000.pcie_ep functions/pci_epf_vntb/func1/primary

Once the above step is completed, the PCI endpoint controllers are ready to
establish a link with the host.
@@ -139,7 +139,7 @@ lspci Output at Host side
-------------------------

Note that the devices listed here correspond to the values populated in
"Creating pci-epf-ntb Device" section above::
"Creating pci-epf-vntb Device" section above::

	# lspci
        00:00.0 PCI bridge: Freescale Semiconductor Inc Device 0000 (rev 01)
@@ -152,7 +152,7 @@ lspci Output at EP Side / Virtual PCI bus
-----------------------------------------

Note that the devices listed here correspond to the values populated in
"Creating pci-epf-ntb Device" section above::
"Creating pci-epf-vntb Device" section above::

        # lspci
        10:00.0 Unassigned class [ffff]: Dawicontrol Computersysteme GmbH Device 1234 (rev ff)
+3 −3
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ function::

which allocates up to max_vecs interrupt vectors for a PCI device.  It
returns the number of vectors allocated or a negative error.  If the device
has a requirements for a minimum number of vectors the driver can pass a
has a requirement for a minimum number of vectors the driver can pass a
min_vecs argument set to this limit, and the PCI core will return -ENOSPC
if it can't meet the minimum number of vectors.

@@ -127,7 +127,7 @@ not be able to allocate as many vectors for MSI as it could for MSI-X. On
some platforms, MSI interrupts must all be targeted at the same set of CPUs
whereas MSI-X interrupts can all be targeted at different CPUs.

If a device supports neither MSI-X or MSI it will fall back to a single
If a device supports neither MSI-X nor MSI it will fall back to a single
legacy IRQ vector.

The typical usage of MSI or MSI-X interrupts is to allocate as many vectors
@@ -203,7 +203,7 @@ How to tell whether MSI/MSI-X is enabled on a device
----------------------------------------------------

Using 'lspci -v' (as root) may show some devices with "MSI", "Message
Signalled Interrupts" or "MSI-X" capabilities.  Each of these capabilities
Signaled Interrupts" or "MSI-X" capabilities.  Each of these capabilities
has an 'Enable' flag which is followed with either "+" (enabled)
or "-" (disabled).

+182 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/pci/aspeed,ast2600-pcie.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ASPEED PCIe Root Complex Controller

maintainers:
  - Jacky Chou <jacky_chou@aspeedtech.com>

description:
  The ASPEED PCIe Root Complex controller provides PCI Express Root Complex
  functionality for ASPEED SoCs, such as the AST2600 and AST2700.
  This controller enables connectivity to PCIe endpoint devices, supporting
  memory and I/O windows, MSI and INTx interrupts, and integration with
  the SoC's clock, reset, and pinctrl subsystems. On AST2600, the PCIe Root
  Port device number is always 8.

properties:
  compatible:
    enum:
      - aspeed,ast2600-pcie
      - aspeed,ast2700-pcie

  reg:
    maxItems: 1

  ranges:
    minItems: 2
    maxItems: 2

  interrupts:
    maxItems: 1
    description: INTx and MSI interrupt

  resets:
    items:
      - description: PCIe controller reset

  reset-names:
    items:
      - const: h2x

  aspeed,ahbc:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      Phandle to the ASPEED AHB Controller (AHBC) syscon node.
      This reference is used by the PCIe controller to access
      system-level configuration registers related to the AHB bus.
      To enable AHB access for the PCIe controller.

  aspeed,pciecfg:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      Phandle to the ASPEED PCIe configuration syscon node.
      This reference allows the PCIe controller to access
      SoC-specific PCIe configuration registers. There are the others
      functions such PCIe RC and PCIe EP will use this common register
      to configure the SoC interfaces.

  interrupt-controller: true

patternProperties:
  "^pcie@[0-9a-f]+,0$":
    type: object
    $ref: /schemas/pci/pci-pci-bridge.yaml#

    properties:
      reg:
        maxItems: 1

      resets:
        items:
          - description: PERST# signal

      reset-names:
        items:
          - const: perst

      clocks:
        maxItems: 1

      phys:
        maxItems: 1

    required:
      - resets
      - reset-names
      - clocks
      - phys
      - ranges

    unevaluatedProperties: false

allOf:
  - $ref: /schemas/pci/pci-host-bridge.yaml#
  - $ref: /schemas/interrupt-controller/msi-controller.yaml#
  - if:
      properties:
        compatible:
          contains:
            const: aspeed,ast2600-pcie
    then:
      required:
        - aspeed,ahbc
    else:
      properties:
        aspeed,ahbc: false
  - if:
      properties:
        compatible:
          contains:
            const: aspeed,ast2700-pcie
    then:
      required:
        - aspeed,pciecfg
    else:
      properties:
        aspeed,pciecfg: false

required:
  - reg
  - interrupts
  - bus-range
  - ranges
  - resets
  - reset-names
  - msi-controller
  - interrupt-controller
  - interrupt-map-mask
  - interrupt-map

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/clock/ast2600-clock.h>

    pcie0: pcie@1e770000 {
      compatible = "aspeed,ast2600-pcie";
      device_type = "pci";
      reg = <0x1e770000 0x100>;
      #address-cells = <3>;
      #size-cells = <2>;
      interrupts = <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>;
      bus-range = <0x00 0xff>;

      ranges = <0x01000000 0x0 0x00018000 0x00018000 0x0 0x00008000
                0x02000000 0x0 0x60000000 0x60000000 0x0 0x20000000>;

      resets = <&syscon ASPEED_RESET_H2X>;
      reset-names = "h2x";

      #interrupt-cells = <1>;
      msi-controller;

      aspeed,ahbc = <&ahbc>;

      interrupt-controller;
      interrupt-map-mask = <0 0 0 7>;
      interrupt-map = <0 0 0 1 &pcie0 0>,
                      <0 0 0 2 &pcie0 1>,
                      <0 0 0 3 &pcie0 2>,
                      <0 0 0 4 &pcie0 3>;

      pcie@8,0 {
        compatible = "pciclass,0604";
        reg = <0x00004000 0 0 0 0>;
        #address-cells = <3>;
        #size-cells = <2>;
        device_type = "pci";
        resets = <&syscon ASPEED_RESET_PCIE_RC_O>;
        reset-names = "perst";
        clocks = <&syscon ASPEED_CLK_GATE_BCLK>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_pcierc1_default>;
        phys = <&pcie_phy1>;
        ranges;
      };
    };
Loading