Skip to content
  1. Mar 07, 2019
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/vmd' · dd92b667
      Bjorn Helgaas authored
        - Configure MPS settings for VMD root ports (Jon Derrick)
      
      * remotes/lorenzo/pci/vmd:
        PCI/VMD: Configure MPS settings before adding devices
      dd92b667
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/misc' · 5b90fc56
      Bjorn Helgaas authored
        - Fix mvebu prefetchable BAR regression caused by common bridge emulation
          that assumed all bridges had prefetchable windows (Thomas Petazzoni)
      
        - Make advk_pci_bridge_emul_ops static (Wei Yongjun)
      
      * remotes/lorenzo/pci/misc:
        PCI: aardvark: Make symbol 'advk_pci_bridge_emul_ops' static
        PCI: pci-bridge-emul: Extend pci_bridge_emul_init() with flags
        PCI: pci-bridge-emul: Create per-bridge copy of register behavior
      5b90fc56
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/mediatek' · d00aaa88
      Bjorn Helgaas authored
        - Fix mediatek MMIO size computation to enable full size of available
          MMIO space (Honghui Zhang)
      
        - Fix mediatek DMA window size computation to allow endpoint DMA access
          to full DRAM address range (Honghui Zhang)
      
      * remotes/lorenzo/pci/mediatek:
        PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM
        PCI: mediatek: Fix memory mapped IO range size computation
      d00aaa88
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/hv' · a8e04a7a
      Bjorn Helgaas authored
        - Remove duplicate struct hv_vp_set in favor of struct hv_vpset (Maya
          Nakamura)
      
        - Rework hv_irq_unmask() to use cpumask_to_vpset() instead of open-coded
          reimplementation (Maya Nakamura)
      
        - Align Hyper-V struct retarget_msi_interrupt arguments (Maya Nakamura)
      
      * remotes/lorenzo/pci/hv:
        PCI: hv: Refactor hv_irq_unmask() to use cpumask_to_vpset()
        PCI: hv: Replace hv_vp_set with hv_vpset
        PCI: hv: Add __aligned(8) to struct retarget_msi_interrupt
      a8e04a7a
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/endpoint' · 7e5b22dd
      Bjorn Helgaas authored
        - Use memcpy_fromio()/memcpy_toio() instead of plain memcpy() in PCI
          endpoint framework (Wen Yang)
      
        - Add interface to discover supported endpoint features to replace a
          bitfield that wasn't flexible enough (Kishon Vijay Abraham I)
      
        - Implement the new supported-feature interface for designware-plat,
          dra7xx, rockchip, cadence (Kishon Vijay Abraham I)
      
        - Fix issues with 64-bit BAR in endpoints (Kishon Vijay Abraham I)
      
        - Add layerscape endpoint mode support (Xiaowei Bao)
      
      * remotes/lorenzo/pci/endpoint:
        misc: pci_endpoint_test: Add the layerscape EP device support
        PCI: layerscape: Add EP mode support
        arm64: dts: Add the PCIE EP node in dts
        dt-bindings: add DT binding for the layerscape PCIe controller with EP mode
        PCI: endpoint: Remove features member in struct pci_epc
        PCI: designware-plat: Remove setting epc->features in Designware plat EP driver
        PCI: rockchip: Remove pci_epf_linkup() from Rockchip EP driver
        PCI: cadence: Remove pci_epf_linkup() from Cadence EP driver
        PCI: pci-epf-test: Use pci_epc_get_features() to get EPC features
        PCI: pci-epf-test: Do not allocate next BARs memory if current BAR is 64Bit
        PCI: pci-epf-test: Remove setting epf_bar flags in function driver
        PCI: endpoint: Fix pci_epf_alloc_space() to set correct MEM TYPE flags
        PCI: endpoint: Add helper to get first unreserved BAR
        PCI: cadence: Populate ->get_features() cdns_pcie_epc_ops
        PCI: rockchip: Populate ->get_features() dw_pcie_ep_ops
        PCI: pci-dra7xx: Populate ->get_features() dw_pcie_ep_ops
        PCI: designware-plat: Populate ->get_features() dw_pcie_ep_ops
        PCI: dwc: Add ->get_features() callback function to dw_pcie_ep_ops
        PCI: endpoint: Add new pci_epc_ops to get EPC features
        PCI: endpoint: functions: Use memcpy_fromio()/memcpy_toio()
      7e5b22dd
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/dwc' · 2506419e
      Bjorn Helgaas authored
        - Add dra72x/dra74x/dra76x SoC compatible strings (Kishon Vijay
          Abraham I)
      
        - Enable x2 mode support for dra72x/dra74x/dra76x SoC (Kishon Vijay
          Abraham I)
      
        - Configure dra7xx PHY to PCIe mode (Kishon Vijay Abraham I)
      
        - Simplify dwc (remove unnecessary header includes, name variables
          consistently, reduce inverted logic, etc) (Gustavo Pimentel)
      
        - Add i.MX8MQ support (Andrey Smirnov)
      
        - Add message to help debug dwc MSI-X mask bit errors (Gustavo Pimentel)
      
        - Work around imx7d PCIe PLL erratum (Trent Piepho)
      
        - Don't assert qcom reset GPIO during probe (Bjorn Andersson)
      
        - Skip dwc MSI init if MSIs have been disabled (Lucas Stach)
      
      * remotes/lorenzo/pci/dwc:
        PCI: dwc: skip MSI init if MSIs have been explicitly disabled
        PCI: dwc: Remove superfluous shifting in definitions
        PCI: dwc: Make use of GENMASK/FIELD_PREP
        PCI: dwc: Make use of BIT() in constant definitions
        PCI: dwc: Share code for dw_pcie_rd/wr_other_conf()
        PCI: dwc: Make use of IS_ALIGNED()
        PCI: imx6: Add code to request/control "pcie_aux" clock for i.MX8MQ
        dt-bindings: imx6q-pcie: Add "pcie_aux" clock for imx8mq
        PCI: qcom: Don't deassert reset GPIO during probe
        PCI: imx: Add workaround for e10728, IMX7d PCIe PLL failure
        ARM: dts: imx7d: Add node for PCIe PHY
        dt-bindings: imx6q-pcie: Add description of imx7d pcie phy
        PCI: dwc: Print debug error message when MSI-X entry control mask bit is set
        PCI: imx6: Add support for i.MX8MQ
        PCI: imx6: Convert DIRECT_SPEED_CHANGE quirk code to use a flag
        PCI: imx6: Mark PHY functions as i.MX6 specific
        PCI: imx6: Introduce drvdata
        PCI: dwc: Replace bit rotation operation (1 << bit) with BIT(bit)
        PCI: dwc: Improve code readability and simplify mask/unmask operations
        PCI: dwc: Rename variable name from data to d on dw_pcie_irq_domain_free()
        PCI: dwc: Rename variable name from data to d on dw_pci_msi_set_affinity()
        PCI: dwc: Rename variable name from data to d on dw_pci_setup_msi_msg()
        PCI: dwc: Rename variable name from data to d on dw_pci_bottom_mask/unmask()
        PCI: dwc: Remove unnecessary header include (signal.h)
        PCI: dwc: Remove unnecessary header include (of_gpio.h)
        PCI: dwc: dra7xx: Invoke phy_set_mode() API to set PHY mode to PHY_MODE_PCIE
        PCI: dwc: dra7xx: Enable x2 mode support for dra74x, dra76x and dra72x
        dt-bindings: PCI: dra7xx: Add properties to enable x2 lane in dra7
        dt-bindings: PCI: dra7xx: Add SoC specific compatible strings
      2506419e
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/dt' · 0c65bb7a
      Bjorn Helgaas authored
        - Add DT support for R-Car RZ/G2E (R8A774C0) (Fabrizio Castro)
      
      * remotes/lorenzo/pci/dt:
        dt-bindings: PCI: rcar: Add device tree support for r8a774c0
      0c65bb7a
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/cadence' · 2124dab3
      Bjorn Helgaas authored
        - Replace Douglas with Tom Joseph as Cadence PCI host/endpoint maintainer
          (Lorenzo Pieralisi)
      
      * remotes/lorenzo/pci/cadence:
        MAINTAINERS: Update PCI Cadence maintainer entry
      2124dab3
    • Bjorn Helgaas's avatar
      Merge branch 'remotes/lorenzo/pci/altera' · b6019755
      Bjorn Helgaas authored
        - Extend altera to support Stratix 10 (Ley Foon Tan)
      
        - Allow building altera driver on ARM64 (Ley Foon Tan)
      
      * remotes/lorenzo/pci/altera:
        dt-bindings: PCI: altera: Add altr,pcie-root-port-2.0
        PCI: altera: Enable driver on ARM64
        PCI: altera: Add Stratix 10 PCIe support
      b6019755
    • Bjorn Helgaas's avatar
      Merge branch 'pci/pm' · 7733f692
      Bjorn Helgaas authored
        - Blacklist Gigabyte X299 Root Port power management to fix Thunderbolt
          hotplug (Mika Westerberg)
      
        - Revert runtime PM suspend/resume callbacks that broke PME on network
          cable plug (Mika Westerberg)
      
        - Disable Data Link State Changed interrupts to prevent wakeup
          immediately after suspend (Mika Westerberg)
      
      * pci/pm:
        PCI/PME: Fix possible use-after-free on remove
        PCI/PME: Fix hotplug/sysfs remove deadlock in pcie_pme_remove()
        PCI: pciehp: Disable Data Link Layer State Changed event on suspend
        Revert "PCI/PME: Implement runtime PM callbacks"
        PCI: Blacklist power management of Gigabyte X299 DESIGNARE EX PCIe ports
      7733f692
    • Bjorn Helgaas's avatar
      Merge branch 'pci/portdrv' · 9c926ec7
      Bjorn Helgaas authored
        - Allow portdrv to claim subtractive decode Ports so PCIe services will
          work for them (Honghui Zhang)
      
        - Report PCIe links that become degraded at run-time (Alexandru Gagniuc)
      
      * pci/portdrv:
        PCI/LINK: Report degraded links via link bandwidth notification
        PCI/portdrv: Support PCIe services on subtractive decode bridges
        PCI/portdrv: Use conventional Device ID table formatting
      9c926ec7
    • Bjorn Helgaas's avatar
      Merge branch 'pci/misc' · 6d940a71
      Bjorn Helgaas authored
        - Mark expected switch fall-through (Mathieu Malaterre)
      
        - Use of_node_name_eq() for node name comparisons (Rob Herring)
      
        - Add ACS and pciehp quirks for HXT SD4800 (Shunyong Yang)
      
        - Consolidate Rohm Vendor ID definitions (Andy Shevchenko)
      
        - Use u32 (not __u32) for things not exposed to userspace (Logan
          Gunthorpe)
      
        - Fix locking semantics of bus and slot reset interfaces (Alex
          Williamson)
      
        - Update PCIEPORTBUS Kconfig help text (Hou Zhiqiang)
      
      * pci/misc:
        PCI: Update PCIEPORTBUS Kconfig help text
        PCI: Fix "try" semantics of bus and slot reset
        PCI: Clean up usage of __u32 type
        genirq/msi: Clean up usage of __u8/__u16 types
        PCI: Move Rohm Vendor ID to generic list
        PCI: pciehp: Add HXT quirk for Command Completed errata
        PCI: Add ACS quirk for HXT SD4800
        PCI: Add HXT vendor ID
        PCI: Use of_node_name_eq() for node name comparisons
        PCI: Mark expected switch fall-through
      6d940a71
    • Bjorn Helgaas's avatar
      Merge branch 'pci/hotplug' · 58a79db4
      Bjorn Helgaas authored
        - Reorder pciehp cached state/hardware state updates to avoid missed
          interrupts (Mika Westerberg)
      
        - Turn ibmphp semaphores into completions or mutexes (Arnd Bergmann)
      
      * pci/hotplug:
        PCI: ibmphp: Turn semaphores into completions or mutexes
        PCI: pciehp: Assign ctrl->slot_ctrl before writing it to hardware
      58a79db4
    • Bjorn Helgaas's avatar
      Merge branch 'pci/enumeration' · 5d130e3d
      Bjorn Helgaas authored
        - Probe bridge window attributes only once at enumeration-time to fix
          device accesses during rescan (Bjorn Helgaas)
      
        - Return BAR size (not "size -1 ") from pci_size() to simplify code (Du
          Changbin)
      
        - Use config header type (not class code) identify bridges more reliably
          (Honghui Zhang)
      
        - Work around Intel Denverton incorrect Trace Hub BAR size reporting
          (Alexander Shishkin)
      
      * pci/enumeration:
        x86/PCI: Fixup RTIT_BAR of Intel Denverton Trace Hub
        PCI: Rely on config space header type, not class code
        PCI: Make pci_size() return real BAR size
        PCI: Probe bridge window attributes once at enumeration-time
      5d130e3d
    • Bjorn Helgaas's avatar
      Merge branch 'pci/dpc' · 1bd2e9ee
      Bjorn Helgaas authored
        - Fix DPC use of uninitialized data (Dongdong Liu)
      
      * pci/dpc:
        PCI/DPC: Fix print AER status in DPC event handling
      1bd2e9ee
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aspm' · 2fcc19b3
      Bjorn Helgaas authored
        - Use Latency Tolerance Reporting if already enabled by platform (Bjorn
          Helgaas)
      
        - Save/restore LTR info for suspend/resume (Bjorn Helgaas)
      
      * pci/aspm:
        PCI/ASPM: Save LTR Capability for suspend/resume
        PCI/ASPM: Use LTR if already enabled by platform
      2fcc19b3
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aer' · 9d8e0e4b
      Bjorn Helgaas authored
        - Use match_string() instead of reimplementing it (Andy Shevchenko)
      
        - Enable SERR# forwarding for all bridges (Bharat Kumar Gogada)
      
      * pci/aer:
        PCI: Enable SERR# forwarding for all bridges
        PCI/AER: Use match_string() helper to simplify the code
      9d8e0e4b
    • Hou Zhiqiang's avatar
      PCI: Update PCIEPORTBUS Kconfig help text · 8f55ed3f
      Hou Zhiqiang authored
      
      
      The Virtual Channel service has been removed and Downstream Port
      Containment has been added, so update the symbol description to be
      consistent with the current code.
      
      Signed-off-by: default avatarHou Zhiqiang <Zhiqiang.Hou@nxp.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      8f55ed3f
  2. Mar 06, 2019
  3. Mar 04, 2019
  4. Mar 02, 2019
  5. Mar 01, 2019
    • Wei Yongjun's avatar
      PCI: aardvark: Make symbol 'advk_pci_bridge_emul_ops' static · d3b34d04
      Wei Yongjun authored
      Fix the following sparse warning:
      
      drivers/pci/controller/pci-aardvark.c:469:28: warning:
       symbol 'advk_pci_bridge_emul_ops' was not declared. Should it be static?
      
      Fixes: 8a3ebd8d
      
       ("PCI: aardvark: Implement emulated root PCI bridge config space")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      d3b34d04
    • Lucas Stach's avatar
      PCI: dwc: skip MSI init if MSIs have been explicitly disabled · 3afc8299
      Lucas Stach authored
      Since 7c5925af (PCI: dwc: Move MSI IRQs allocation to IRQ domains
      hierarchical API) the MSI init claims one of the controller IRQs as a
      chained IRQ line for the MSI controller. On some designs, like the i.MX6,
      this line is shared with a PCIe legacy IRQ. When the line is claimed for
      the MSI domain, any device trying to use this legacy IRQs will fail to
      request this IRQ line.
      
      As MSI and legacy IRQs are already mutually exclusive on the DWC core,
      as the core won't forward any legacy IRQs once any MSI has been enabled,
      users wishing to use legacy IRQs already need to explictly disable MSI
      support (usually via the pci=nomsi kernel commandline option). To avoid
      any issues with MSI conflicting with legacy IRQs, just skip all of the
      DWC MSI initalization, including the IRQ line claim, when MSI is disabled.
      
      Fixes: 7c5925af
      
       ("PCI: dwc: Move MSI IRQs allocation to IRQ domains hierarchical API")
      Tested-by: default avatarTim Harvey <tharvey@gateworks.com>
      Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: stable@vger.kernel.org
      3afc8299
    • Maya Nakamura's avatar
      PCI: hv: Refactor hv_irq_unmask() to use cpumask_to_vpset() · c8ccf759
      Maya Nakamura authored
      
      
      Remove the duplicate implementation of cpumask_to_vpset() and use the
      shared implementation. Export hv_max_vp_index, which is required by
      cpumask_to_vpset().
      
      Signed-off-by: default avatarMaya Nakamura <m.maya.nakamura@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Tested-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      c8ccf759
    • Maya Nakamura's avatar
      PCI: hv: Replace hv_vp_set with hv_vpset · 9bc11742
      Maya Nakamura authored
      
      
      Remove a duplicate definition of VP set (hv_vp_set) and use the common
      definition (hv_vpset) that is used in other places.
      
      Change the order of the members in struct hv_pcibus_device so that the
      declaration of retarget_msi_interrupt_params is the last member. Struct
      hv_vpset, which contains a flexible array, is nested two levels deep in
      struct hv_pcibus_device via retarget_msi_interrupt_params.
      
      Add a comment that retarget_msi_interrupt_params should be the last
      member of struct hv_pcibus_device.
      
      Signed-off-by: default avatarMaya Nakamura <m.maya.nakamura@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Reviewed-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Tested-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      9bc11742
    • Maya Nakamura's avatar
      PCI: hv: Add __aligned(8) to struct retarget_msi_interrupt · 6ae91579
      Maya Nakamura authored
      
      
      Because Hyper-V requires that hypercall arguments be aligned on an 8
      byte boundary, add __aligned(8) to struct retarget_msi_interrupt.
      
      Link: https://lore.kernel.org/lkml/87k1hlqlby.fsf@vitty.brq.redhat.com/
      Signed-off-by: default avatarMaya Nakamura <m.maya.nakamura@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      6ae91579
    • Honghui Zhang's avatar
      PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM · cbe3a772
      Honghui Zhang authored
      
      
      The PCIE_AXI_WINDOW0 register defines the inbound window size for
      requests coming from PCI endpoints. Requests outside of this window will
      be treated as unsupported requests.
      
      Enlarge this window size from 2^31 to 2^33 to support a 8GB address
      space (which gives endpoints DMA access to full 4GB DRAM address range
      - physical DRAM starts at 0x40000000).
      
      Reported-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarHonghui Zhang <honghui.zhang@mediatek.com>
      [lorenzo.pieralisi@arm.com: updated commit log]
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      cbe3a772
    • Honghui Zhang's avatar
      PCI: mediatek: Fix memory mapped IO range size computation · c61df573
      Honghui Zhang authored
      
      
      Mediatek's HW assigns a MMIO address range (typically starts from
      0x20000000 to 0x2fffffff for both mt2712 and mt7622) for PCI usage.
      
      This MMIO address space represents the address space that can
      be allocated to PCI devices through Base Address Registers.
      
      Even though the full MMIO address range is available to be allocated, it
      should be enabled by the PCIE_AHB_TRANS_BASE register in the host
      controller and the size that is enabled is determined by AHB2PCIE_SIZE
      bits in this register.
      
      Owing to a bug in the MMIO window size computation, current code does
      not enable the full size of the available MMIO address range in the
      PCI host controller; if the PCI devices BARs requested size exceeds the
      size enabled through the PCIE_AHB_TRANS_BASE register the requests
      targeting the disabled address address space will be blocked by the root
      complex causing a system error.
      
      Existing code has never run into a system error in production because
      even half of the enabled MMIO range (128MB) is big enough for typical
      devices BAR requests (4MB) but the full MMIO address range should
      be enabled regardless.
      
      Fix the MMIO window size computation by using resource_size(mem) instead
      of mem->end - mem->start.
      
      Since the MMIO window size for both MT2712 and MT7622 is 0x10000000,
      this change will update the parameter passed to fls() from 0xfffffff to
      0x10000000 and calculate the whole memory mapped IO range size
      correctly.
      
      Detected through coccinelle semantic patch (and related warning):
      
      scripts/coccinelle/api/resource_size.cocci:
      
      pcie-mediatek.c:720:13-16: WARNING: Suspicious code. resource_size is maybe missing with mem
      
      Signed-off-by: default avatarHonghui Zhang <honghui.zhang@mediatek.com>
      [lorenzo.pieralisi@arm.com: rewrote the commit log]
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      c61df573
    • Andrey Smirnov's avatar
      PCI: dwc: Remove superfluous shifting in definitions · 44ddb77b
      Andrey Smirnov authored
      
      
      Surrounding definitions no longer use explicit shift, so "<< 0" here
      serve no purpose. Remove them. No functional change intended.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      44ddb77b
    • Andrey Smirnov's avatar
      PCI: dwc: Make use of GENMASK/FIELD_PREP · a991f748
      Andrey Smirnov authored
      
      
      Convert various multi-bit fields to be defined using GENMASK/FIELD_PREP.
      This way bit field boundaries are defined in a single place only, as
      well as defined in a way that makes it easier to verify them against the
      reference manual. No functional change intended.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      a991f748
    • Andrey Smirnov's avatar
      PCI: dwc: Make use of BIT() in constant definitions · 0e11faa4
      Andrey Smirnov authored
      
      
      Avoid using explicit left shifts and convert various definitions to
      use BIT() instead. No functional change intended.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      [lorenzo.pieralisi@arm.com: fixed PORT_LOGIC_SPEED_CHANGE redefinition]
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      0e11faa4
    • Andrey Smirnov's avatar
      PCI: dwc: Share code for dw_pcie_rd/wr_other_conf() · 689e349a
      Andrey Smirnov authored
      
      
      Default implementation of pcie_rd_other_conf() and
      dw_pcie_wd_other_conf() share more than 80% of their code. Move shared
      code into a dedicated subroutine and convert pcie_rd_other_conf() and
      dw_pcie_wd_other_conf() to use it. No functional change intended.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      689e349a
    • Andrey Smirnov's avatar
      PCI: dwc: Make use of IS_ALIGNED() · 4f8bbd2f
      Andrey Smirnov authored
      
      
      Make the intent a bit more clear as well as get rid of explicit
      arithmetic by using IS_ALIGNED() to determine if "addr" is aligned to
      "size". No functional change intended.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarGustavo Pimentel <gustavo.pimentel@synopsys.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      4f8bbd2f
    • Andrey Smirnov's avatar
      PCI: imx6: Add code to request/control "pcie_aux" clock for i.MX8MQ · 5278f651
      Andrey Smirnov authored
      
      
      The PCIe IP block has an additional clock, "pcie_aux", that needs to
      be controlled by the driver. Add code to support it.
      
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Fabio Estevam <fabio.estevam@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: "A.s. Dong" <aisheng.dong@nxp.com>
      Cc: Richard Zhu <hongxing.zhu@nxp.com>
      Cc: linux-imx@nxp.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pci@vger.kernel.org
      Cc: Rob Herring <robh@kernel.org>
      Cc: devicetree@vger.kernel.org
      5278f651
    • Rafael J. Wysocki's avatar
      PCI/PME: Fix hotplug/sysfs remove deadlock in pcie_pme_remove() · 95c80bc6
      Rafael J. Wysocki authored
      Dongdong reported a deadlock triggered by a hotplug event during a sysfs
      "remove" operation:
      
        pciehp 0000:00:0c.0:pcie004: Slot(0-1): Link Up
        # echo 1 > 0000:00:0c.0/remove
      
        PME and hotplug share an MSI/MSI-X vector.  The sysfs "remove" side is:
      
          remove_store
             pci_stop_and_remove_bus_device_locked
      	 pci_lock_rescan_remove
      	 pci_stop_and_remove_bus_device
      	   ...
      	   pcie_pme_remove
      	     pcie_pme_suspend
      	       synchronize_irq        # wait for hotplug IRQ handler
      	 pci_unlock_rescan_remove
      
        The hotplug side is:
      
          pciehp_ist
             pciehp_handle_presence_or_link_change
      	 pciehp_configure_device
      	   pci_lock_rescan_remove     # wait for pci_unlock_rescan_remove()
      
        INFO: task bash:10913 blocked for more than 120 seconds.
      
        # ps -ax |grep D
         PID TTY      STAT   TIME COMMAND
        10913 ttyAMA0  Ds+    0:00 -bash
        14022 ?        D      0:00 [irq/745-pciehp]
      
        # cat /proc/14022/stack
        __switch_to+0x94/0xd8
        pci_lock_rescan_remove+0x20/0x28
        pciehp_configure_device+0x30/0x140
        pciehp_handle_presence_or_link_change+0x324/0x458
        pciehp_ist+0x1dc/0x1e0
      
        # cat /proc/10913/stack
        __switch_to+0x94/0xd8
        synchronize_irq+0x8c/0xc0
        pcie_pme_suspend+0xa4/0x118
        pcie_pme_remove+0x20/0x40
        pcie_port_remove_service+0x3c/0x58
        ...
        pcie_port_device_remove+0x2c/0x48
        pcie_portdrv_remove+0x68/0x78
        pci_device_remove+0x48/0x120
        ...
        pci_stop_bus_device+0x84/0xc0
        pci_stop_and_remove_bus_device_locked+0x24/0x40
        remove_store+0xa4/0xb8
        dev_attr_store+0x44/0x60
        sysfs_kf_write+0x58/0x80
      
      It is incorrect to call pcie_pme_suspend() from pcie_pme_remove() for two
      reasons.
      
      First, pcie_pme_suspend() calls synchronize_irq(), which will wait for the
      native hotplug interrupt handler as well as for the PME one, because they
      share one IRQ (as per the spec).  That may deadlock if hotplug is signaled
      while pcie_pme_remove() is running and the latter calls
      pci_lock_rescan_remove() before the former.
      
      Second, if pcie_pme_suspend() figures out that wakeup needs to be enabled
      for the port, it will return without disabling the interrupt as expected by
      pcie_pme_remove() which was overlooked by commit c7b5a4e6 ("PCI / PM:
      Fix native PME handling during system suspend/resume").
      
      To fix that, rework pcie_pme_remove() to disable the PME interrupt, clear
      its status and prevent the PME worker function from re-enabling it before
      calling free_irq() on it, which should be sufficient.
      
      Fixes: c7b5a4e6
      
       ("PCI / PM: Fix native PME handling during system suspend/resume")
      Link: https://lore.kernel.org/linux-pci/c7697e7c-e1af-13e4-8491-0a3996e6ab5d@huawei.com
      Reported-by: default avatarDongdong Liu <liudongdong3@huawei.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      [bhelgaas: add URL and deadlock details from Dongdong]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      95c80bc6
  6. Feb 28, 2019