11 Oct, 2017

2 commits

  • struct pci_host_bridge gained hooks to map/swizzle IRQs, so that the IRQ
    mapping can be done automatically by PCI core code through the
    pci_assign_irq() function instead of resorting to arch-specific
    implementation callbacks to carry out the same task which force PCI host
    bridge drivers implementation to implement per-arch kludges to carry out a
    task that is inherently architecture agnostic.

    Commit 769b461fc0c0 ("arm64: PCI: Drop DT IRQ allocation from
    pcibios_alloc_irq()") was assuming all PCI host controller drivers had been
    converted to use ->map_irq(), but that wasn't the case: pci-aardvark had
    not been converted. Due to this, it broke the support for legacy PCI
    interrupts when using the pci-aardvark driver (used on Marvell Armada 3720
    platforms).

    In order to fix this, we make sure the ->map_irq and ->swizzle_irq fields
    of pci_host_bridge are properly filled in.

    Fixes: 769b461fc0c0 ("arm64: PCI: Drop DT IRQ allocation from pcibios_alloc_irq()")
    Signed-off-by: Thomas Petazzoni
    Signed-off-by: Bjorn Helgaas
    Cc: stable@vger.kernel.org # v4.13+

    Thomas Petazzoni
     
  • This reverts commit d7bd554f27c942e6b8b54100b4044f9be1038edf.

    It turns out that Tegra20 has a bug in the implementation of the MSI
    target address register (which is worked around by the existence of the
    struct tegra_pcie_soc.msi_base_shift parameter) that restricts the MSI
    target memory to the lower 32 bits of physical memory on that particular
    generation. The offending patch causes a regression on TrimSlice, which
    is a Tegra20-based device and has a PCI network interface card.

    An initial, simpler fix was to change the MSI target address for Tegra20
    only, but it was pointed out that the offending commit also prevents the
    use of 32-bit only MSI capable devices, even on later chips. Technically
    this was never guaranteed to work with the prior code in the first place
    because the allocated page could have resided beyond the 4 GiB boundary,
    but it is still possible that this could've introduced a regression.

    The proper fix that was settled on is to select a fixed address within
    the lowest 32 bits of physical address space that is otherwise unused,
    but testing of that patch has provided mixed results that are not fully
    understood yet.

    Given all of the above and the relative urgency to get this fixed in
    v4.13, revert the offending commit until a universal fix is found.

    Fixes: d7bd554f27c9 ("PCI: tegra: Do not allocate MSI target memory")
    Reported-by: Tomasz Maciej Nowak
    Reported-by: Erik Faye-Lund
    Signed-off-by: Thierry Reding
    Signed-off-by: Bjorn Helgaas
    Cc: stable@vger.kernel.org # 4.13.x

    Thierry Reding
     

26 Sep, 2017

1 commit

  • The driver_override implementation is susceptible to a race condition when
    different threads are reading vs. storing a different driver override. Add
    locking to avoid the race condition.

    This is in close analogy to commit 6265539776a0 ("driver core: platform:
    fix race condition with driver_override") from Adrian Salido.

    Fixes: 782a985d7af2 ("PCI: Introduce new device binding path using pci_dev.driver_override")
    Signed-off-by: Nicolai Stange
    Signed-off-by: Bjorn Helgaas
    Cc: stable@vger.kernel.org # v3.16+

    Nicolai Stange
     

21 Sep, 2017

1 commit

  • pci_epf_test_raise_irq() reads the interrupt to use for the response from
    reg->command, but this has been cleared at the beginning of the command
    handler so the value is always zero at this point.

    Instead, extract the interrupt index before handling the command and then
    pass the requested interrupt into pci_epf_test_raise_irq(). This allows us
    to remove the specific code to extract the interrupt for
    COMMAND_RAISE_MSI_IRQ since it is now handled in common code.

    Fixes: 3ecf3232c54c ("PCI: endpoint: Do not reset *command* inadvertently")
    Signed-off-by: John Keeping
    Signed-off-by: Bjorn Helgaas
    Acked-by: Kishon Vijay Abraham I

    John Keeping
     

15 Sep, 2017

1 commit

  • This reverts commit 40f11adc7cd9281227f0a6a627d966dd0a5f0cd9.

    Jens found that iwlwifi firmware loading failed on a Lenovo X1 Carbon,
    gen4:

    iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-34.ucode failed with error -2
    iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-33.ucode failed with error -2
    iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-32.ucode failed with error -2
    iwlwifi 0000:04:00.0: loaded firmware version 31.532993.0 op_mode iwlmvm
    iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0x208
    ...
    iwlwifi 0000:04:00.0: Failed to load firmware chunk!
    iwlwifi 0000:04:00.0: Could not load the [0] uCode section
    iwlwifi 0000:04:00.0: Failed to start INIT ucode: -110
    iwlwifi 0000:04:00.0: Failed to run INIT ucode: -110

    He bisected it to 40f11adc7cd9 ("PCI: Avoid race while enabling upstream
    bridges"). Revert that commit to fix the regression.

    Link: http://lkml.kernel.org/r/4bcbcbc1-7c79-09f0-5071-bc2f53bf6574@kernel.dk
    Fixes: 40f11adc7cd9 ("PCI: Avoid race while enabling upstream bridges")
    Signed-off-by: Bjorn Helgaas
    CC: Srinath Mannam
    CC: Jens Axboe
    CC: Luca Coelho
    CC: Johannes Berg
    CC: Emmanuel Grumbach

    Bjorn Helgaas
     

14 Sep, 2017

1 commit


09 Sep, 2017

1 commit

  • Pull PCI updates from Bjorn Helgaas:

    - add enhanced Downstream Port Containment support, which prints more
    details about Root Port Programmed I/O errors (Dongdong Liu)

    - add Layerscape ls1088a and ls2088a support (Hou Zhiqiang)

    - add MediaTek MT2712 and MT7622 support (Ryder Lee)

    - add MediaTek MT2712 and MT7622 MSI support (Honghui Zhang)

    - add Qualcom IPQ8074 support (Varadarajan Narayanan)

    - add R-Car r8a7743/5 device tree support (Biju Das)

    - add Rockchip per-lane PHY support for better power management (Shawn
    Lin)

    - fix IRQ mapping for hot-added devices by replacing the
    pci_fixup_irqs() boot-time design with a host bridge hook called at
    probe-time (Lorenzo Pieralisi, Matthew Minter)

    - fix race when enabling two devices that results in upstream bridge
    not being enabled correctly (Srinath Mannam)

    - fix pciehp power fault infinite loop (Keith Busch)

    - fix SHPC bridge MSI hotplug events by enabling bus mastering
    (Aleksandr Bezzubikov)

    - fix a VFIO issue by correcting PCIe capability sizes (Alex
    Williamson)

    - fix an INTD issue on Xilinx and possibly other drivers by unifying
    INTx IRQ domain support (Paul Burton)

    - avoid IOMMU stalls by marking AMD Stoney GPU ATS as broken (Joerg
    Roedel)

    - allow APM X-Gene device assignment to guests by adding an ACS quirk
    (Feng Kan)

    - fix driver crashes by disabling Extended Tags on Broadcom HT2100
    (Extended Tags support is required for PCIe Receivers but not
    Requesters, and we now enable them by default when Requesters support
    them) (Sinan Kaya)

    - fix MSIs for devices that use phantom RIDs for DMA by assuming MSIs
    use the real Requester ID (not a phantom RID) (Robin Murphy)

    - prevent assignment of Intel VMD children to guests (which may be
    supported eventually, but isn't yet) by not associating an IOMMU with
    them (Jon Derrick)

    - fix Intel VMD suspend/resume by releasing IRQs on suspend (Scott
    Bauer)

    - fix a Function-Level Reset issue with Intel 750 NVMe by waiting
    longer (up to 60sec instead of 1sec) for device to become ready
    (Sinan Kaya)

    - fix a Function-Level Reset issue on iProc Stingray by working around
    hardware defects in the CRS implementation (Oza Pawandeep)

    - fix an issue with Intel NVMe P3700 after an iProc reset by adding a
    delay during shutdown (Oza Pawandeep)

    - fix a Microsoft Hyper-V lockdep issue by polling instead of blocking
    in compose_msi_msg() (Stephen Hemminger)

    - fix a wireless LAN driver timeout by clearing DesignWare MSI
    interrupt status after it is handled, not before (Faiz Abbas)

    - fix DesignWare ATU enable checking (Jisheng Zhang)

    - reduce Layerscape dependencies on the bootloader by doing more
    initialization in the driver (Hou Zhiqiang)

    - improve Intel VMD performance allowing allocation of more IRQ vectors
    than present CPUs (Keith Busch)

    - improve endpoint framework support for initial DMA mask, different
    BAR sizes, configurable page sizes, MSI, test driver, etc (Kishon
    Vijay Abraham I, Stan Drozd)

    - rework CRS support to add periodic messages while we poll during
    enumeration and after Function-Level Reset and prepare for possible
    other uses of CRS (Sinan Kaya)

    - clean up Root Port AER handling by removing unnecessary code and
    moving error handler methods to struct pcie_port_service_driver
    (Christoph Hellwig)

    - clean up error handling paths in various drivers (Bjorn Andersson,
    Fabio Estevam, Gustavo A. R. Silva, Harunobu Kurokawa, Jeffy Chen,
    Lorenzo Pieralisi, Sergei Shtylyov)

    - clean up SR-IOV resource handling by disabling VF decoding before
    updating the corresponding resource structs (Gavin Shan)

    - clean up DesignWare-based drivers by unifying quirks to update Class
    Code and Interrupt Pin and related handling of write-protected
    registers (Hou Zhiqiang)

    - clean up by adding empty generic pcibios_align_resource() and
    pcibios_fixup_bus() and removing empty arch-specific implementations
    (Palmer Dabbelt)

    - request exclusive reset control for several drivers to allow cleanup
    elsewhere (Philipp Zabel)

    - constify various structures (Arvind Yadav, Bhumika Goyal)

    - convert from full_name() to %pOF (Rob Herring)

    - remove unused variables from iProc, HiSi, Altera, Keystone (Shawn
    Lin)

    * tag 'pci-v4.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (170 commits)
    PCI: xgene: Clean up whitespace
    PCI: xgene: Define XGENE_PCI_EXP_CAP and use generic PCI_EXP_RTCTL offset
    PCI: xgene: Fix platform_get_irq() error handling
    PCI: xilinx-nwl: Fix platform_get_irq() error handling
    PCI: rockchip: Fix platform_get_irq() error handling
    PCI: altera: Fix platform_get_irq() error handling
    PCI: spear13xx: Fix platform_get_irq() error handling
    PCI: artpec6: Fix platform_get_irq() error handling
    PCI: armada8k: Fix platform_get_irq() error handling
    PCI: dra7xx: Fix platform_get_irq() error handling
    PCI: exynos: Fix platform_get_irq() error handling
    PCI: iproc: Clean up whitespace
    PCI: iproc: Rename PCI_EXP_CAP to IPROC_PCI_EXP_CAP
    PCI: iproc: Add 500ms delay during device shutdown
    PCI: Fix typos and whitespace errors
    PCI: Remove unused "res" variable from pci_resource_io()
    PCI: Correct kernel-doc of pci_vpd_srdt_size(), pci_vpd_srdt_tag()
    PCI/AER: Reformat AER register definitions
    iommu/vt-d: Prevent VMD child devices from being remapping targets
    x86/PCI: Use is_vmd() rather than relying on the domain number
    ...

    Linus Torvalds
     

08 Sep, 2017

33 commits

  • * pci/virtualization:
    PCI: Disable VF decoding before pcibios_sriov_disable() updates resources
    PCI: Add ACS quirk for APM X-Gene devices
    PCI: Mark AMD Stoney GPU ATS as broken

    Conflicts:
    drivers/pci/quirks.c

    Bjorn Helgaas
     
  • * pci/trivial:
    PCI: Fix typos and whitespace errors
    PCI: Remove unused "res" variable from pci_resource_io()
    PCI: Correct kernel-doc of pci_vpd_srdt_size(), pci_vpd_srdt_tag()

    Bjorn Helgaas
     
  • * pci/resource:
    microblaze/PCI: Remove pcibios_setup_bus_{self/devices} dead code
    ARC: Remove empty kernel/pcibios.c
    PCI: Add a generic weak pcibios_align_resource()
    PCI: Add a generic weak pcibios_fixup_bus()

    Bjorn Helgaas
     
  • * pci/pm:
    PCI/PM: Expand description of pci_set_power_state()

    Bjorn Helgaas
     
  • * pci/msi:
    PCI/MSI: Assume MSIs use real Requester ID, not an alias

    Bjorn Helgaas
     
  • * pci/misc:
    PCI: Fix PCIe capability sizes
    PCI: Convert to using %pOF instead of full_name()
    PCI: Constify endpoint pci_epf_type device_type
    PCI: Constify bin_attribute structures
    PCI: Constify hotplug pci_device_id structures
    PCI: Constify hotplug attribute_group structures
    PCI: Constify label attribute_group structures
    PCI: Constify sysfs attribute_group structures

    Bjorn Helgaas
     
  • * pci/irq-fixups:
    PCI: Inline and remove pcibios_update_irq()
    PCI: Remove unused pci_fixup_irqs() function
    sparc/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    unicore32/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    tile/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    m68k/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    alpha/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    sh/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks
    sh/PCI: Remove __init optimisations from IRQ mapping functions/data
    MIPS: PCI: Fix pcibios_scan_bus() NULL check code path

    Bjorn Helgaas
     
  • * pci/hotplug:
    PCI: pciehp: Report power fault only once until we clear it
    PCI: shpchp: Enable bridge bus mastering if MSI is enabled

    Bjorn Helgaas
     
  • * pci/enumeration:
    PCI: Warn periodically while waiting for non-CRS ("device ready") status
    PCI: Wait up to 60 seconds for device to become ready after FLR
    PCI: Factor out pci_bus_wait_crs()
    PCI: Add pci_bus_crs_vendor_id() to detect CRS response data
    PCI: Always check for non-CRS response before timeout
    PCI: Avoid race while enabling upstream bridges
    PCI: Mark Broadcom HT2100 Root Port Extended Tags as broken

    Bjorn Helgaas
     
  • * pci/dpc:
    PCI/DPC: Add local struct device pointers
    PCI/DPC: Add eDPC support

    Bjorn Helgaas
     
  • * pci/aer:
    PCI/AER: Reformat AER register definitions
    PCI/portdrv: Move error handler methods to struct pcie_port_service_driver

    Bjorn Helgaas
     
  • * pci/endpoint:
    tools: PCI: Add a missing option help line
    misc: pci_endpoint_test: Enable/Disable MSI using module param
    misc: pci_endpoint_test: Avoid using hard-coded BAR sizes
    misc: pci_endpoint_test: Add support to not enable MSI interrupts
    misc: pci_endpoint_test: Add support to provide aligned buffer addresses
    misc: pci_endpoint_test: Add support for PCI_ENDPOINT_TEST regs to be mapped to any BAR
    PCI: designware-ep: Do not disable BARs during initialization
    PCI: dra7xx: Reset all BARs during initialization
    PCI: dwc: designware: Provide page_size to pci_epc_mem
    PCI: endpoint: Remove the ->remove() callback
    PCI: endpoint: Add support to poll early for host commands
    PCI: endpoint: Add support to use _any_ BAR to map PCI_ENDPOINT_TEST regs
    PCI: endpoint: Do not reset *command* inadvertently
    PCI: endpoint: Add "volatile" to pci_epf_test_reg
    PCI: endpoint: Add support for configurable page size
    PCI: endpoint: Make ->remove() callback optional
    PCI: endpoint: Add an API to get matching "pci_epf_device_id"
    PCI: endpoint: Use of_dma_configure() to set initial DMA mask

    Bjorn Helgaas
     
  • * pci/host-xilinx:
    PCI: xilinx-nwl: Fix platform_get_irq() error handling
    PCI: xilinx: Allow build on MIPS platforms
    PCI: xilinx: Don't enable config completion interrupts
    PCI: xilinx: Unify INTx & MSI interrupt decode
    PCI: xilinx-nwl: Translate INTx range to hwirqs 0-3
    PCI: xilinx: Translate INTx range to hwirqs 0-3

    Bjorn Helgaas
     
  • * pci/host-xgene:
    PCI: xgene: Clean up whitespace
    PCI: xgene: Define XGENE_PCI_EXP_CAP and use generic PCI_EXP_RTCTL offset
    PCI: xgene: Fix platform_get_irq() error handling

    Bjorn Helgaas
     
  • * pci/host-vmd:
    iommu/vt-d: Prevent VMD child devices from being remapping targets
    x86/PCI: Use is_vmd() rather than relying on the domain number
    x86/PCI: Move VMD quirk to x86 fixups
    MAINTAINERS: Add Jonathan Derrick as VMD maintainer
    PCI: vmd: Remove IRQ affinity so we can allocate more IRQs
    PCI: vmd: Free up IRQs on suspend path
    PCI: vmd: Assign vector zero to all bridges
    PCI: vmd: Reserve IRQ pre-vector for better affinity

    Bjorn Helgaas
     
  • * pci/host-tegra:
    PCI: tegra: Explicitly request exclusive reset control

    Bjorn Helgaas
     
  • * pci/host-spear13xx:
    PCI: spear13xx: Fix platform_get_irq() error handling

    Bjorn Helgaas
     
  • * pci/host-rockchip:
    PCI: rockchip: Fix platform_get_irq() error handling
    PCI: rockchip: Umap IO space if probe fails
    PCI: rockchip: Remove IRQ domain if probe fails
    PCI: rockchip: Disable vpcie0v9 if resume_noirq fails
    PCI: rockchip: Clean up PHY if driver probe or resume fails
    PCI: rockchip: Factor out rockchip_pcie_deinit_phys()
    PCI: rockchip: Factor out rockchip_pcie_disable_clocks()
    PCI: rockchip: Factor out rockchip_pcie_enable_clocks()
    PCI: rockchip: Factor out rockchip_pcie_setup_irq()
    PCI: rockchip: Use gpiod_set_value_cansleep() to allow reset via expanders
    PCI: rockchip: Use PCI_NUM_INTX
    PCI: rockchip: Explicitly request exclusive reset control
    dt-bindings: phy-rockchip-pcie: Convert to per-lane PHY model
    dt-bindings: PCI: rockchip: Convert to per-lane PHY model
    arm64: dts: rockchip: convert PCIe to use per-lane PHYs for rk3339
    PCI: rockchip: Idle inactive PHY(s)
    phy: rockchip-pcie: Reconstruct driver to support per-lane PHYs
    PCI: rockchip: Add per-lane PHY support
    PCI: rockchip: Factor out rockchip_pcie_get_phys()
    PCI: rockchip: Control optional 12v power supply
    dt-bindings: PCI: rockchip: Add vpcie12v-supply for Rockchip PCIe controller

    Bjorn Helgaas
     
  • * pci/host-rcar:
    PCI: rcar: Add device tree support for r8a7743/5
    PCI: rcar: Fix memory leak when no PCIe card is inserted
    PCI: rcar: Fix error exit path

    Bjorn Helgaas
     
  • * pci/host-qcom:
    PCI: qcom: Add support for IPQ8074 PCIe controller
    dt-bindings: PCI: qcom: Add support for IPQ8074
    PCI: qcom: Use block IP version for operations
    PCI: qcom: Explicitly request exclusive reset control
    PCI: qcom: Use gpiod_set_value_cansleep() to allow reset via expanders

    Bjorn Helgaas
     
  • * pci/host-mvebu:
    PCI: mvebu: Remove unneeded gpiod NULL check

    Bjorn Helgaas
     
  • * pci/host-mediatek:
    PCI: mediatek: Use PCI_NUM_INTX
    PCI: mediatek: Add MSI support for MT2712 and MT7622
    PCI: mediatek: Use bus->sysdata to get host private data
    dt-bindings: PCI: Add support for MT2712 and MT7622
    PCI: mediatek: Add controller support for MT2712 and MT7622
    dt-bindings: PCI: Cleanup MediaTek binding text
    dt-bindings: PCI: Rename MediaTek binding
    PCI: mediatek: Switch to use platform_get_resource_byname()
    PCI: mediatek: Add a structure to abstract the controller generations
    PCI: mediatek: Rename port->index and mtk_pcie_parse_ports()
    PCI: mediatek: Use readl_poll_timeout() to wait for Gen2 training
    PCI: mediatek: Explicitly request exclusive reset control

    Bjorn Helgaas
     
  • * pci/host-layerscape:
    PCI: layerscape: Add support for ls1088a
    PCI: layerscape: Add support for ls2088a
    PCI: artpec6: Stop enabling writes to DBI read-only registers
    PCI: layerscape: Remove unnecessary class code fixup
    PCI: dwc: Enable write permission for Class Code, Interrupt Pin updates
    PCI: dwc: Add accessors for write permission of DBI read-only registers
    PCI: layerscape: Disable outbound windows configured by bootloader
    PCI: layerscape: Refactor ls1021_pcie_host_init()
    PCI: layerscape: Move generic init functions earlier in file
    PCI: layerscape: Add class code and multifunction fixups for ls1021a
    PCI: layerscape: Move STRFMR1 access out from the DBI write-enable bracket
    PCI: layerscape: Call dw_pcie_setup_rc() from ls_pcie_host_init()

    Bjorn Helgaas
     
  • * pci/host-kirin:
    PCI: kirin: Constify dw_pcie_host_ops structure

    Bjorn Helgaas
     
  • * pci/host-keystone:
    PCI: keystone: Use PCI_NUM_INTX
    PCI: keystone: Remove duplicate MAX_*_IRQS defs
    PCI: keystone-dw: Remove unused ks_pcie, pci variables

    Bjorn Helgaas
     
  • * pci/host-iproc:
    PCI: iproc: Clean up whitespace
    PCI: iproc: Rename PCI_EXP_CAP to IPROC_PCI_EXP_CAP
    PCI: iproc: Add 500ms delay during device shutdown
    PCI: iproc: Work around Stingray CRS defects
    PCI: iproc: Factor out memory-mapped config access address calculation
    PCI: iproc: Remove unused struct iproc_pcie *pcie

    Bjorn Helgaas
     
  • * pci/host-imx6:
    PCI: imx6: Explicitly request exclusive reset control

    Bjorn Helgaas
     
  • * pci/host-hv:
    PCI: hv: Do not sleep in compose_msi_msg()

    Bjorn Helgaas
     
  • * pci/host-hisi:
    PCI: hisi: Constify dw_pcie_host_ops structure
    PCI: hisi: Remove unused variable driver

    Bjorn Helgaas
     
  • * pci/host-faraday:
    PCI: faraday: Use PCI_NUM_INTX
    PCI: faraday: Fix of_irq_get() error check

    Bjorn Helgaas
     
  • * pci/host-exynos:
    PCI: exynos: Fix platform_get_irq() error handling

    Bjorn Helgaas
     
  • * pci/host-dra7xx:
    PCI: dra7xx: Fix platform_get_irq() error handling
    PCI: dra7xx: Propagate platform_get_irq() errors in dra7xx_pcie_probe()
    PCI: dra7xx: Use PCI_NUM_INTX

    Bjorn Helgaas
     
  • * pci/host-designware:
    PCI: dwc: Clear MSI interrupt status after it is handled, not before
    PCI: qcom: Allow ->post_init() to fail
    PCI: qcom: Don't unroll init if ->init() fails
    PCI: dwc: designware: Handle ->host_init() failures
    PCI: dwc: designware: Test PCIE_ATU_ENABLE bit specifically
    PCI: dwc: designware: Make dw_pcie_prog_*_atu_unroll() static

    Bjorn Helgaas