1. 02 Apr, 2020 30 commits
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/mobiveil' · d09fca9e
      Bjorn Helgaas authored
        - Restructure mobiveil driver to support either Root Complex mode or
          Endpoint mode (Hou Zhiqiang)
      
        - Collect host initialization into one place (Hou Zhiqiang)
      
        - Collect interrupt-related code into one place (Hou Zhiqiang)
      
        - Split mobiveil into separate files under
          drivers/pci/controller/mobiveil for easier reuse (Hou Zhiqiang)
      
        - Add callbacks for interrupt initialization and linkup checking (Hou
          Zhiqiang)
      
        - Add 8- and 16-bit CSR accessors (Hou Zhiqiang)
      
        - Initialize host driver only if Header Type is "bridge" (Hou Zhiqiang)
      
        - Add DT bindings for NXP Layerscape SoCs PCIe Gen4 controller (Hou
          Zhiqiang)
      
        - Add PCIe Gen4 RC driver for Layerscape SoCs (Hou Zhiqiang)
      
        - Add pcie-mobiveil __iomem annotations (Hou Zhiqiang)
      
        - Add PCI_MSI_IRQ_DOMAIN Kconfig dependency (Hou Zhiqiang)
      
      * remotes/lorenzo/pci/mobiveil:
        PCI: mobiveil: Fix unmet dependency warning for PCIE_MOBIVEIL_PLAT
        PCI: mobiveil: Fix sparse different address space warnings
        PCI: mobiveil: Add PCIe Gen4 RC driver for Layerscape SoCs
        dt-bindings: PCI: Add NXP Layerscape SoCs PCIe Gen4 controller
        PCI: mobiveil: Add Header Type field check
        PCI: mobiveil: Add 8-bit and 16-bit CSR register accessors
        PCI: mobiveil: Allow mobiveil_host_init() to be used to re-init host
        PCI: mobiveil: Add callback function for link up check
        PCI: mobiveil: Add callback function for interrupt initialization
        PCI: mobiveil: Modularize the Mobiveil PCIe Host Bridge IP driver
        PCI: mobiveil: Collect the interrupt related operations into a function
        PCI: mobiveil: Move the host initialization into a function
        PCI: mobiveil: Introduce a new structure mobiveil_root_port
      d09fca9e
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/hv' · a29a44c1
      Bjorn Helgaas authored
        - Fix memory leak in hv probe path (Dexuan Cui)
      
        - Add support for Hyper-V protocol 1.3 (Long Li)
      
        - Replace zero-length array with flexible-array member (Gustavo A. R.
          Silva)
      
        - Move hypercall definitions to <asm/hyperv-tlfs.h> (Boqun Feng)
      
        - Move retarget definitions to <asm/hyperv-tlfs.h> and make them packed
          (Boqun Feng)
      
        - Add struct hv_msi_entry and hv_set_msi_entry_from_desc() to prepare for
          future virtual PCI on non-x86 (Boqun Feng)
      
      * remotes/lorenzo/pci/hv:
        PCI: hv: Introduce hv_msi_entry
        PCI: hv: Move retarget related structures into tlfs header
        PCI: hv: Move hypercall related definitions into tlfs header
        PCI: hv: Replace zero-length array with flexible-array member
        PCI: hv: Add support for protocol 1.3 and support PCI_BUS_RELATIONS2
        PCI: hv: Decouple the func definition in hv_dr_state from VSP message
        PCI: hv: Add missing kfree(hbus) in hv_pci_probe()'s error handling path
        PCI: hv: Remove unnecessary type casting from kzalloc
      a29a44c1
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/endpoint' · b16f2ab2
      Bjorn Helgaas authored
        - Use notification chain instead of EPF linkup ops for EPC events (Kishon
          Vijay Abraham I)
      
        - Protect concurrent allocation in endpoint outbound address region
          (Kishon Vijay Abraham I)
      
        - Protect concurrent access to pci_epf_ops (Kishon Vijay Abraham I)
      
        - Assign function number for each PF in endpoint core (Kishon Vijay
          Abraham I)
      
        - Refactor endpoint mode core initialization (Vidya Sagar)
      
        - Add API to notify when core initialization completes (Vidya Sagar)
      
        - Add test framework support to defer core initialization (Vidya Sagar)
      
        - Update Tegra SoC ABI header to support uninitialization of UPHY PLL
          when in endpoint mode without reference clock (Vidya Sagar)
      
        - Add DT and driver support for Tegra194 PCIe endpoint nodes (Vidya
          Sagar)
      
        - Add endpoint test support for DMA data transfer (Kishon Vijay
          Abraham I)
      
        - Print throughput information in endpoint test (Kishon Vijay Abraham I)
      
        - Use streaming DMA APIs for endpoint test buffer allocation (Kishon
          Vijay Abraham I)
      
        - Add endpoint test command line option for DMA (Kishon Vijay Abraham I)
      
        - When stopping a controller via configfs, clear endpoint "start" entry
          to prevent WARN_ON (Kunihiko Hayashi)
      
        - Update endpoint ->set_msix() to pay attention to MSI-X BAR Indicator
          and offset when finding MSI-X tables (Kishon Vijay Abraham I)
      
        - MSI-X tables are in local memory, not in the PCI address space.  Update
          pcie-designware-ep to account for this (Kishon Vijay Abraham I)
      
        - Allow AM654 PCIe Endpoint to raise MSI-X interrupts (Kishon Vijay
          Abraham I)
      
        - Avoid using module parameter to determine irqtype for endpoint test
          (Kishon Vijay Abraham I)
      
        - Add ioctl to clear IRQ for endpoint test (Kishon Vijay Abraham I)
      
        - Add endpoint test 'e' option to clear IRQ (Kishon Vijay Abraham I)
      
        - Bump limit on number of endpoint test devices from 10 to 10,000 (Kishon
          Vijay Abraham I)
      
        - Use full pci-endpoint-test name in request_irq() for easier profiling
          (Kishon Vijay Abraham I)
      
        - Reduce log level of -EPROBE_DEFER error messages to debug (Thierry
          Reding)
      
      * remotes/lorenzo/pci/endpoint:
        misc: pci_endpoint_test: remove duplicate macro PCI_ENDPOINT_TEST_STATUS
        PCI: tegra: Print -EPROBE_DEFER error message at debug level
        misc: pci_endpoint_test: Use full pci-endpoint-test name in request_irq()
        misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
        tools: PCI: Add 'e' to clear IRQ
        misc: pci_endpoint_test: Add ioctl to clear IRQ
        misc: pci_endpoint_test: Avoid using module parameter to determine irqtype
        PCI: keystone: Allow AM654 PCIe Endpoint to raise MSI-X interrupt
        PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address
        PCI: endpoint: Fix ->set_msix() to take BIR and offset as arguments
        misc: pci_endpoint_test: Add support to get DMA option from userspace
        tools: PCI: Add 'd' command line option to support DMA
        misc: pci_endpoint_test: Use streaming DMA APIs for buffer allocation
        PCI: endpoint: functions/pci-epf-test: Print throughput information
        PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data
        PCI: endpoint: Fix clearing start entry in configfs
        PCI: tegra: Add support for PCIe endpoint mode in Tegra194
        dt-bindings: PCI: tegra: Add DT support for PCIe EP nodes in Tegra194
        soc/tegra: bpmp: Update ABI header
        PCI: pci-epf-test: Add support to defer core initialization
        PCI: dwc: Add API to notify core initialization completion
        PCI: endpoint: Add notification for core init completion
        PCI: dwc: Refactor core initialization code for EP mode
        PCI: endpoint: Add core init notifying feature
        PCI: endpoint: Assign function number for each PF in EPC core
        PCI: endpoint: Protect concurrent access to pci_epf_ops with mutex
        PCI: endpoint: Fix for concurrent memory allocation in OB address region
        PCI: endpoint: Replace spinlock with mutex
        PCI: endpoint: Use notification chain mechanism to notify EPC events to EPF
      b16f2ab2
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/dwc' · cc36a451
      Bjorn Helgaas authored
        - Fix dra7xx issue with missing an MSI if new events pended during IRQ
          handler (Vignesh Raghavendra)
      
      * remotes/lorenzo/pci/dwc:
        PCI: dwc: pci-dra7xx: Fix MSI IRQ handling
      cc36a451
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/dt' · 86d0b6a1
      Bjorn Helgaas authored
        - Add common schema for PCI endpoint controllers (Kishon Vijay Abraham I)
      
        - Add host and endpoint schemas for Cadence PCIe core (Kishon Vijay
          Abraham I)
      
        - Convert Cadence platform bindings to DT schema (Kishon Vijay Abraham I)
      
      * remotes/lorenzo/pci/dt:
        dt-bindings: PCI: Convert PCIe Host/Endpoint in Cadence platform to DT schema
        dt-bindings: PCI: cadence: Add PCIe RC/EP DT schema for Cadence PCIe
        dt-bindings: PCI: Add PCI Endpoint Controller Schema
      86d0b6a1
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/amlogic' · d620d864
      Bjorn Helgaas authored
        - Add Amlogic AXG MIPI/PCIe PHY driver and related DT bindings (Remi
          Pommarel)
      
        - Use shared PHY driver for Amlogic AXG and G12A platforms (Remi
          Pommarel)
      
      * remotes/lorenzo/pci/amlogic:
        PCI: amlogic: Use AXG PCIE
        phy: amlogic: Add Amlogic AXG PCIE PHY Driver
        phy: amlogic: Add Amlogic AXG MIPI/PCIE analog PHY Driver
        dt-bindings: PCI: meson: Update PCIE bindings documentation
        dt-bindings: Add AXG shared MIPI/PCIE analog PHY bindings
        dt-bindings: Add AXG PCIE PHY bindings
      d620d864
    • Bjorn Helgaas's avatar
      Merge branch 'pci/virtualization' · 1ee57ad6
      Bjorn Helgaas authored
        - Add ACS quirks for Zhaoxin Root Ports, Downstream Ports, and
          multi-function devices (Raymond Pang)
      
      * pci/virtualization:
        PCI: Add ACS quirk for Zhaoxin Root/Downstream Ports
        PCI: Add ACS quirk for Zhaoxin multi-function devices
        PCI: Add Zhaoxin Vendor ID
      1ee57ad6
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource' · 86845e37
      Bjorn Helgaas authored
        - Use ioremap(), not phys_to_virt() for platform ROM, to fix video ROM
          mapping with CONFIG_HIGHMEM (Mikel Rychliski)
      
        - Add support for root bus sizing so we don't have to assume host bridge
          windows are known a priori (Ivan Kokshaysky)
      
        - Fix alpha Nautilus PCI setup, which has been broken since we started
          enforcing window limits in resource allocation (Ivan Kokshaysky)
      
      * pci/resource:
        alpha: Fix nautilus PCI setup
        PCI: Add support for root bus sizing
        PCI: Use ioremap(), not phys_to_virt() for platform ROM
      86845e37
    • Bjorn Helgaas's avatar
      Merge branch 'pci/p2pdma' · de71a000
      Bjorn Helgaas authored
        - Add Intel Sky Lake-E Root Ports B, C, D to P2PDMA whitelist (Andrew
          Maier)
      
      * pci/p2pdma:
        PCI/P2PDMA: Add Intel Sky Lake-E Root Ports B, C, D to the whitelist
      de71a000
    • Bjorn Helgaas's avatar
      Merge branch 'pci/misc' · 10e8141b
      Bjorn Helgaas authored
        - Move _HPX type array from stack to static data (Colin Ian King)
      
        - Avoid an ASMedia XHCI USB PME# defect; apparently it doesn't assert
          PME# when USB3.0 devices are hotplugged in D0 (Kai-Heng Feng)
      
        - Revert sysfs "rescan" file renames that broke an application (Kelsey
          Skunberg)
      
      * pci/misc:
        PCI: sysfs: Revert "rescan" file renames
        PCI: Avoid ASMedia XHCI USB PME# from D0 defect
        PCI/ACPI: Move pcie_to_hpx3_type[] from stack to static data
      10e8141b
    • Bjorn Helgaas's avatar
      Merge branch 'pci/interrupts' · 74f0862c
      Bjorn Helgaas authored
        - Extend boot interrupt quirk to cover several Xeon chipsets (Sean V
          Kelley)
      
        - Add documentation about boot interrupts (Sean V Kelley)
      
      * pci/interrupts:
        Documentation: PCI: Add background on Boot Interrupts
        PCI: Add boot interrupt quirk mechanism for Xeon chipsets
      74f0862c
    • Bjorn Helgaas's avatar
      Merge branch 'pci/hotplug' · 30386853
      Bjorn Helgaas authored
        - Disable in-band presence detection when possible (Alexandru Gagniuc)
      
        - Poll for presence detect if in-band presence detection is disabled
          (Alexandru Gagniuc)
      
        - Add DMI table of systems that don't support in-band presence detection
          (Stuart Hayes)
      
        - Fix indefinite pciehp wait caused by race in handling sysfs requests
          (Lukas Wunner)
      
        - Fix pciehp MSI interrupt race that caused us to miss interrupts (Stuart
          Hayes)
      
      * pci/hotplug:
        PCI: pciehp: Fix MSI interrupt race
        PCI: pciehp: Fix indefinite wait on sysfs requests
        PCI: pciehp: Add DMI table for in-band presence detection disabled
        PCI: pciehp: Wait for PDS if in-band presence is disabled
        PCI: pciehp: Disable in-band presence detect when possible
      30386853
    • Bjorn Helgaas's avatar
      Merge branch 'pci/enumeration' · eb81b249
      Bjorn Helgaas authored
        - Add PCIe 32 GT/s speed decoding for sysfs "max_link_speed" and dmesg
          notes about available bandwidth (Yicong Yang)
      
        - Simplify and unify PCI bus/link speed reporting (Yicong Yang)
      
      * pci/enumeration:
        PCI: Add PCIE_LNKCAP2_SLS2SPEED() macro
        PCI: Use pci_speed_string() for all PCI/PCI-X/PCIe strings
        PCI: Add pci_speed_string()
        PCI: Add 32 GT/s decoding in some macros
      eb81b249
    • Bjorn Helgaas's avatar
      Merge branch 'pci/edr' · 4ea40c38
      Bjorn Helgaas authored
        - Update error status after reset_link() so we don't report "recovery
          failed" when it in fact succeeded (Kuppuswamy Sathyanarayanan)
      
        - Move DPC data into struct pci_dev instead of allocating a separate
          struct dpc_dev (Bjorn Helgaas)
      
        - Remove AER/DPC service dependency to simplify error recovery
          (Kuppuswamy Sathyanarayanan)
      
        - Return error recovery status for future use by EDR, which needs to tell
          firmware whether recovery was successful (Kuppuswamy Sathyanarayanan)
      
        - Cache DPC capability info in core since it's needed by EDR as well as
          DPC driver (Kuppuswamy Sathyanarayanan)
      
        - Add pci_aer_raw_clear_status() to allow EDR recovery path to clear AER
          status even when OS doesn't own the AER capability (Kuppuswamy
          Sathyanarayanan)
      
        - Add Error Disconnect Recover (EDR) support, so firmware can use ACPI
          notification to tell the OS that devices have been disconnected, e.g.,
          via DPC, and that OS should attempt recovery (Kuppuswamy
          Sathyanarayanan)
      
        - Rename AER error status clearing interfaces to be more consistent
          (Kuppuswamy Sathyanarayanan)
      
      * pci/edr:
        PCI/AER: Rationalize error status register clearing
        PCI/DPC: Add Error Disconnect Recover (EDR) support
        PCI/DPC: Expose dpc_process_error(), dpc_reset_link() for use by EDR
        PCI/AER: Add pci_aer_raw_clear_status() to unconditionally clear Error Status
        PCI/DPC: Cache DPC capabilities in pci_init_capabilities()
        PCI/ERR: Return status of pcie_do_recovery()
        PCI/ERR: Remove service dependency in pcie_do_recovery()
        PCI/DPC: Move DPC data into struct pci_dev
        PCI/ERR: Update error status after reset_link()
        PCI/ERR: Combine pci_channel_io_frozen cases
      4ea40c38
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aspm' · dd956a12
      Bjorn Helgaas authored
        - Clear the correct bits when enabling ASPM L1 substates (Yicong Yang)
      
        - Reduce severity of ASPM common clock config message (Chris Packham)
      
      * pci/aspm:
        PCI/ASPM: Reduce severity of common clock config message
        PCI/ASPM: Clear the correct bits when enabling L1 substates
      dd956a12
    • Lad Prabhakar's avatar
      misc: pci_endpoint_test: remove duplicate macro PCI_ENDPOINT_TEST_STATUS · e48ba3eb
      Lad Prabhakar authored
      PCI_ENDPOINT_TEST_STATUS is already defined in pci_endpoint_test.c along
      with the status bits, drop the duplicate definition.
      Signed-off-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      e48ba3eb
    • Thierry Reding's avatar
      PCI: tegra: Print -EPROBE_DEFER error message at debug level · 54455238
      Thierry Reding authored
      Probe deferral is an expected error condition that will usually be
      recovered from. Print such error messages at debug level to make them
      available for diagnostic purposes when building with debugging enabled
      and hide them otherwise to not spam the kernel log with them.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarVidya Sagar <vidyas@nvidia.com>
      Tested-by: default avatarVidya Sagar <vidyas@nvidia.com>
      54455238
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Use full pci-endpoint-test name in request_irq() · c2be14ab
      Kishon Vijay Abraham I authored
      Use full pci-endpoint-test name in request_irq(), so that it's easy to
      profile the device that actually raised the interrupt.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      c2be14ab
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices · 6b443e5c
      Kishon Vijay Abraham I authored
      Adding more than 10 pci-endpoint-test devices results in
      "kobject_add_internal failed for pci-endpoint-test.1 with -EEXIST, don't
      try to register things with the same name in the same directory". This
      is because commit 2c156ac7 ("misc: Add host side PCI driver for PCI
      test function device") limited the length of the "name" to 20 characters.
      Change the length of the name to 24 in order to support upto 10000
      pci-endpoint-test devices.
      
      Fixes: 2c156ac7 ("misc: Add host side PCI driver for PCI test function device")
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: stable@vger.kernel.org # v4.14+
      6b443e5c
    • Kishon Vijay Abraham I's avatar
      tools: PCI: Add 'e' to clear IRQ · 74d60b28
      Kishon Vijay Abraham I authored
      Add a new command line option 'e' to invoke "PCITEST_CLEAR_IRQ"
      ioctl. This can be used to clear the irqs set using the 'i' option.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      74d60b28
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Add ioctl to clear IRQ · 475007f9
      Kishon Vijay Abraham I authored
      Add ioctl to clear IRQ which can be used to free the allocated
      IRQ vectors and free the requested IRQ.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      475007f9
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Avoid using module parameter to determine irqtype · b2ba9225
      Kishon Vijay Abraham I authored
      commit e0332712 ("pci_endpoint_test: Add 2 ioctl commands")
      uses module parameter 'irqtype' in pci_endpoint_test_set_irq()
      to check if IRQ vectors of a particular type (MSI or MSI-X or
      LEGACY) is already allocated. However with multi-function devices,
      'irqtype' will not correctly reflect the IRQ type of the PCI device.
      
      Fix it here by adding 'irqtype' for each PCI device to show the
      IRQ type of a particular PCI device.
      
      Fixes: e0332712 ("pci_endpoint_test: Add 2 ioctl commands")
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: stable@vger.kernel.org # v4.19+
      b2ba9225
    • Kishon Vijay Abraham I's avatar
      PCI: keystone: Allow AM654 PCIe Endpoint to raise MSI-X interrupt · 146d3288
      Kishon Vijay Abraham I authored
      AM654 PCIe EP controller has MSI-X capability register and has the
      ability to raise MSI-X interrupt. Add support in pci-keystone.c
      for PCIe endpoint controller in AM654 to raise MSI-X interrupts.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      146d3288
    • Kishon Vijay Abraham I's avatar
      PCI: dwc: Fix dw_pcie_ep_raise_msix_irq() to get correct MSI-X table address · 6f5e193b
      Kishon Vijay Abraham I authored
      commit beb4641a ("PCI: dwc: Add MSI-X callbacks handler"),
      in order to raise MSI-X interrupt, obtained MSIX table address from
      Base Address Register (BAR). However BAR only holds PCI address
      programmed by the host whereas the MSI-X table should be in the local
      memory.
      
      Store the MSI-X table address (virtual address) as part of ->set_bar()
      callback and use that to get the message address and message data
      here.
      
      Fixes: beb4641a ("PCI: dwc: Add MSI-X callbacks handler")
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      6f5e193b
    • Kishon Vijay Abraham I's avatar
      PCI: endpoint: Fix ->set_msix() to take BIR and offset as arguments · 83153d9f
      Kishon Vijay Abraham I authored
      commit 8963106e ("PCI: endpoint: Add MSI-X interfaces") while
      adding support to raise MSI-X interrupts from endpoint didn't include
      BAR Indicator register (BIR) configuration and MSI-X table offset as
      arguments in pci_epc_set_msix(). This would result in endpoint
      controller register using random BAR indicator register, the memory
      for which might not be allocated by the endpoint function driver.
      Add BAR indicator register and MSI-X table offset as arguments in
      pci_epc_set_msix() and allocate space for MSI-X table and pending
      bit array (PBA) in pci-epf-test endpoint function driver.
      
      Fixes: 8963106e ("PCI: endpoint: Add MSI-X interfaces")
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      83153d9f
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Add support to get DMA option from userspace · cf376b4b
      Kishon Vijay Abraham I authored
      'pcitest' utility now uses '-d' option to allow the user to test DMA.
      Add support to parse option to use DMA from userspace application.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
      cf376b4b
    • Kishon Vijay Abraham I's avatar
      tools: PCI: Add 'd' command line option to support DMA · 73c57626
      Kishon Vijay Abraham I authored
      Add a new command line option 'd' to use DMA for data transfers.
      It should be used with read, write or copy commands.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
      73c57626
    • Kishon Vijay Abraham I's avatar
      misc: pci_endpoint_test: Use streaming DMA APIs for buffer allocation · 0a121f9b
      Kishon Vijay Abraham I authored
      Use streaming DMA APIs (dma_map_single/dma_unmap_single) for buffers
      transmitted/received by the endpoint device instead of allocating
      a coherent memory. Also add default_data to set the alignment to
      4KB since dma_map_single might not return a 4KB aligned address.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
      0a121f9b
    • Kishon Vijay Abraham I's avatar
      PCI: endpoint: functions/pci-epf-test: Print throughput information · 5893c2e5
      Kishon Vijay Abraham I authored
      Print throughput information in KB/s after every completed transfer,
      including information on whether DMA is used or not.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
      5893c2e5
    • Kishon Vijay Abraham I's avatar
      PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data · 5ebf3fc5
      Kishon Vijay Abraham I authored
      Use dmaengine API and add support for transferring data using DMA.
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Tested-by: default avatarAlan Mikhak <alan.mikhak@sifive.com>
      5ebf3fc5
  2. 31 Mar, 2020 4 commits
    • Stuart Hayes's avatar
      PCI: pciehp: Fix MSI interrupt race · 8edf5332
      Stuart Hayes authored
      Without this commit, a PCIe hotplug port can stop generating interrupts on
      hotplug events, so device adds and removals will not be seen:
      
      The pciehp interrupt handler pciehp_isr() reads the Slot Status register
      and then writes back to it to clear the bits that caused the interrupt.  If
      a different interrupt event bit gets set between the read and the write,
      pciehp_isr() returns without having cleared all of the interrupt event
      bits.  If this happens when the MSI isn't masked (which by default it isn't
      in handle_edge_irq(), and which it will never be when MSI per-vector
      masking is not supported), we won't get any more hotplug interrupts from
      that device.
      
      That is expected behavior, according to the PCIe Base Spec r5.0, section
      6.7.3.4, "Software Notification of Hot-Plug Events".
      
      Because the Presence Detect Changed and Data Link Layer State Changed event
      bits can both get set at nearly the same time when a device is added or
      removed, this is more likely to happen than it might seem.  The issue was
      found (and can be reproduced rather easily) by connecting and disconnecting
      an NVMe storage device on at least one system model where the NVMe devices
      were being connected to an AMD PCIe port (PCI device 0x1022/0x1483).
      
      Fix the issue by modifying pciehp_isr() to loop back and re-read the Slot
      Status register immediately after writing to it, until it sees that all of
      the event status bits have been cleared.
      
      [lukas: drop loop count limitation, write "events" instead of "status",
      don't loop back in INTx and poll modes, tweak code comment & commit msg]
      Link: https://lore.kernel.org/r/78b4ced5072bfe6e369d20e8b47c279b8c7af12e.1582121613.git.lukas@wunner.deTested-by: default avatarStuart Hayes <stuart.w.hayes@gmail.com>
      Signed-off-by: default avatarStuart Hayes <stuart.w.hayes@gmail.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarJoerg Roedel <jroedel@suse.de>
      8edf5332
    • Lukas Wunner's avatar
      PCI: pciehp: Fix indefinite wait on sysfs requests · 3e487d2e
      Lukas Wunner authored
      David Hoyer reports that powering pciehp slots up or down via sysfs may
      hang:  The call to wait_event() in pciehp_sysfs_enable_slot() and
      _disable_slot() does not return because ctrl->ist_running remains true.
      
      This flag, which was introduced by commit 157c1062 ("PCI: pciehp: Avoid
      returning prematurely from sysfs requests"), signifies that the IRQ thread
      pciehp_ist() is running.  It is set to true at the top of pciehp_ist() and
      reset to false at the end.  However there are two additional return
      statements in pciehp_ist() before which the commit neglected to reset the
      flag to false and wake up waiters for the flag.
      
      That omission opens up the following race when powering up the slot:
      
      * pciehp_ist() runs because a PCI_EXP_SLTSTA_PDC event was requested
        by pciehp_sysfs_enable_slot()
      
      * pciehp_ist() turns on slot power via the following call stack:
        pciehp_handle_presence_or_link_change() -> pciehp_enable_slot() ->
        __pciehp_enable_slot() -> board_added() -> pciehp_power_on_slot()
      
      * after slot power is turned on, the link comes up, resulting in a
        PCI_EXP_SLTSTA_DLLSC event
      
      * the IRQ handler pciehp_isr() stores the event in ctrl->pending_events
        and returns IRQ_WAKE_THREAD
      
      * the IRQ thread is already woken (it's bringing up the slot), but the
        genirq code remembers to re-run the IRQ thread after it has finished
        (such that it can deal with the new event) by setting IRQTF_RUNTHREAD
        via __handle_irq_event_percpu() -> __irq_wake_thread()
      
      * the IRQ thread removes PCI_EXP_SLTSTA_DLLSC from ctrl->pending_events
        via board_added() -> pciehp_check_link_status() in order to deal with
        presence and link flaps per commit 6c35a1ac ("PCI: pciehp:
        Tolerate initially unstable link")
      
      * after pciehp_ist() has successfully brought up the slot, it resets
        ctrl->ist_running to false and wakes up the sysfs requester
      
      * the genirq code re-runs pciehp_ist(), which sets ctrl->ist_running
        to true but then returns with IRQ_NONE because ctrl->pending_events
        is empty
      
      * pciehp_sysfs_enable_slot() is finally woken but notices that
        ctrl->ist_running is true, hence continues waiting
      
      The only way to get the hung task going again is to trigger a hotplug
      event which brings down the slot, e.g. by yanking out the card.
      
      The same race exists when powering down the slot because remove_board()
      likewise clears link or presence changes in ctrl->pending_events per commit
      3943af9d ("PCI: pciehp: Ignore Link State Changes after powering off a
      slot") and thereby may cause a re-run of pciehp_ist() which returns with
      IRQ_NONE without resetting ctrl->ist_running to false.
      
      Fix by adding a goto label before the teardown steps at the end of
      pciehp_ist() and jumping to that label from the two return statements which
      currently neglect to reset the ctrl->ist_running flag.
      
      Fixes: 157c1062 ("PCI: pciehp: Avoid returning prematurely from sysfs requests")
      Link: https://lore.kernel.org/r/cca1effa488065cb055120aa01b65719094bdcb5.1584530321.git.lukas@wunner.deReported-by: default avatarDavid Hoyer <David.Hoyer@netapp.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
      Cc: stable@vger.kernel.org	# v4.19+
      3e487d2e
    • Kunihiko Hayashi's avatar
      PCI: endpoint: Fix clearing start entry in configfs · f58d5f53
      Kunihiko Hayashi authored
      After an endpoint is started through configfs, if 0 is written to the
      configfs entry 'start', the controller stops but the epc_group->start
      value remains 1.
      
      A subsequent unlinking of the function from the controller would trigger
      a spurious WARN_ON_ONCE() in pci_epc_epf_unlink() despite right
      behavior.
      
      Fix it by setting epc_group->start = 0 when a controller is stopped
      using configfs.
      
      Fixes: d7467991 ("PCI: endpoint: Introduce configfs entry for configuring EP functions")
      Signed-off-by: default avatarKunihiko Hayashi <hayashi.kunihiko@socionext.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      f58d5f53
    • Vidya Sagar's avatar
      PCI: tegra: Add support for PCIe endpoint mode in Tegra194 · c57247f9
      Vidya Sagar authored
      Add support for the endpoint mode of Synopsys DesignWare core based
      dual mode PCIe controllers present in Tegra194 SoC.
      Signed-off-by: default avatarVidya Sagar <vidyas@nvidia.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarThierry Reding <treding@nvidia.com>
      c57247f9
  3. 30 Mar, 2020 4 commits
  4. 28 Mar, 2020 2 commits