1. 04 Apr, 2018 24 commits
    • Bjorn Helgaas's avatar
      Merge branch 'lorenzo/pci/dwc' · f3c91098
      Bjorn Helgaas authored
      * lorenzo/pci/dwc:
        PCI: histb: Add an optional regulator for PCIe port power control
        PCI: histb: Fix error path of histb_pcie_host_enable()
        PCI: qcom: Use regulator bulk api for apq8064 supplies
        PCI: qcom: Add missing supplies required for msm8996
        PCI: designware-ep: Fix typo in error message
      f3c91098
    • Bjorn Helgaas's avatar
      Merge branch 'lorenzo/pci/altera' · 248c51d9
      Bjorn Helgaas authored
      * lorenzo/pci/altera:
        PCI: altera: Fix bool initialization in tlp_read_packet()
      248c51d9
    • Bjorn Helgaas's avatar
      Merge branch 'pci/vpd' · c8afd5ef
      Bjorn Helgaas authored
        - consolidate VPD code in vpd.c (Bjorn Helgaas)
      
      * pci/vpd:
        PCI/VPD: Move VPD structures to vpd.c
        PCI/VPD: Move VPD quirks to vpd.c
        PCI/VPD: Move VPD sysfs code to vpd.c
        PCI/VPD: Move VPD access code to vpd.c
      c8afd5ef
    • Bjorn Helgaas's avatar
      Merge branch 'pci/virtualization' · a4b88505
      Bjorn Helgaas authored
        - probe for device reset support during enumeration instead of runtime
          (Bjorn Helgaas)
      
        - add ACS quirk for Ampere (née APM) root ports (Feng Kan)
      
        - add function 1 DMA alias quirk for Marvell 88SE9220 (Thomas
          Vincent-Cross)
      
        - protect device restore with device lock (Sinan Kaya)
      
        - handle failure of FLR gracefully (Sinan Kaya)
      
        - handle CRS (config retry status) after device resets (Sinan Kaya)
      
        - skip various config reads for SR-IOV VFs as an optimization (KarimAllah
          Ahmed)
      
      * pci/virtualization:
        PCI/IOV: Add missing prototypes for powerpc pcibios interfaces
        PCI/IOV: Use VF0 cached config registers for other VFs
        PCI/IOV: Skip BAR sizing for VFs
        PCI/IOV: Skip INTx config reads for VFs
        PCI: Wait for device to become ready after secondary bus reset
        PCI: Add a return type for pci_reset_bridge_secondary_bus()
        PCI: Wait for device to become ready after a power management reset
        PCI: Rename pci_flr_wait() to pci_dev_wait() and make it generic
        PCI: Handle FLR failure and allow other reset types
        PCI: Protect restore with device lock to be consistent
        PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
        PCI: Add ACS quirk for Ampere root ports
        PCI: Remove redundant probes for device reset support
        PCI: Probe for device reset support during enumeration
      
      Conflicts:
      	include/linux/pci.h
      a4b88505
    • Bjorn Helgaas's avatar
      Merge branch 'pci/sparc' · 0eb6de78
      Bjorn Helgaas authored
        - support arbitrary PCI host bridge offsets on sparc (Yinghai Lu)
      
        - remove System and Video ROM reservations on sparc (Bjorn Helgaas)
      
      * pci/sparc:
        sparc/PCI: Stop reserving System ROM and Video ROM in PCI space
        sparc/PCI: Support arbitrary host bridge address offset
      0eb6de78
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource-mmap' · 1e1b3201
      Bjorn Helgaas authored
        - use generic pci_mmap_resource_range() instead of powerpc and xtensa
          arch-specific versions (David Woodhouse)
      
      * pci/resource-mmap:
        xtensa/PCI: Use generic pci_mmap_resource_range()
        powerpc/pci: Use generic pci_mmap_resource_range()
      1e1b3201
    • Bjorn Helgaas's avatar
      Merge branch 'pci/portdrv' · 64ae499c
      Bjorn Helgaas authored
        - move pcieport_if.h to drivers/pci/pcie/ to encapsulate it (Frederick
          Lawler)
      
        - merge pcieport_if.h into portdrv.h (Bjorn Helgaas)
      
        - move workaround for BIOS PME issue from portdrv to PCI core (Bjorn
          Helgaas)
      
        - completely disable portdrv with "pcie_ports=compat" (Bjorn Helgaas)
      
        - remove portdrv link order dependency (Bjorn Helgaas)
      
        - remove support for unused VC portdrv service (Bjorn Helgaas)
      
        - simplify portdrv feature permission checking (Bjorn Helgaas)
      
        - remove "pcie_hp=nomsi" parameter (use "pci=nomsi" instead) (Bjorn
          Helgaas)
      
        - remove unnecessary "pcie_ports=auto" parameter (Bjorn Helgaas)
      
        - use cached AER capability offset (Frederick Lawler)
      
        - don't enable DPC if BIOS hasn't granted AER control (Mika Westerberg)
      
        - rename pcie-dpc.c to dpc.c (Bjorn Helgaas)
      
      * pci/portdrv:
        PCI/DPC: Rename from pcie-dpc.c to dpc.c
        PCI/DPC: Do not enable DPC if AER control is not allowed by the BIOS
        PCI/AER: Use cached AER Capability offset
        PCI/portdrv: Rename and reverse sense of pcie_ports_auto
        PCI/portdrv: Encapsulate pcie_ports_auto inside the port driver
        PCI/portdrv: Remove unnecessary "pcie_ports=auto" parameter
        PCI/portdrv: Remove "pcie_hp=nomsi" kernel parameter
        PCI/portdrv: Remove unnecessary include of <linux/pci-aspm.h>
        PCI/portdrv: Simplify PCIe feature permission checking
        PCI/portdrv: Remove unused PCIE_PORT_SERVICE_VC
        PCI/portdrv: Remove pcie_port_bus_type link order dependency
        PCI/portdrv: Disable port driver in compat mode
        PCI/PM: Clear PCIe PME Status bit for Root Complex Event Collectors
        PCI/PM: Clear PCIe PME Status bit in core, not PCIe port driver
        PCI/PM: Move pcie_clear_root_pme_status() to core
        PCI/portdrv: Merge pcieport_if.h into portdrv.h
        PCI/portdrv: Move pcieport_if.h to drivers/pci/pcie/
      
      Conflicts:
      	drivers/pci/pcie/Makefile
      	drivers/pci/pcie/portdrv.h
      64ae499c
    • Bjorn Helgaas's avatar
      Merge branch 'pci/msi' · ac30aa59
      Bjorn Helgaas authored
        - don't set up INTx if MSI or MSI-X is enabled to align cris, frv, ia64,
          and mn10300 with x86 (Bjorn Helgaas)
      
      * pci/msi:
        PCI/MSI: Don't set up INTx if MSI or MSI-X is enabled
      ac30aa59
    • Bjorn Helgaas's avatar
      Merge branch 'pci/misc' · 43b90eae
      Bjorn Helgaas authored
        - use PCI_EXP_DEVCTL2_COMP_TIMEOUT in rapidio/tsi721 (Bjorn Helgaas)
      
        - remove possible NULL pointer dereference in of_pci_bus_find_domain_nr()
          (Shawn Lin)
      
        - report quirk timings with dev_info (Bjorn Helgaas)
      
        - report quirks that take longer than 10ms (Bjorn Helgaas)
      
        - add and use Altera Vendor ID (Johannes Thumshirn)
      
        - tidy Makefiles and comments (Bjorn Helgaas)
      
      * pci/misc:
        PCI: Always define the of_node helpers
        PCI: Tidy comments
        PCI: Tidy Makefiles
        mcb: Add Altera PCI ID to mcb-pci
        PCI: Add Altera vendor ID
        PCI: Report quirks that take more than 10ms
        PCI: Report quirk timings with pci_info() instead of pr_debug()
        PCI: Fix NULL pointer dereference in of_pci_bus_find_domain_nr()
        rapidio/tsi721: use PCI_EXP_DEVCTL2_COMP_TIMEOUT macro
      43b90eae
    • Bjorn Helgaas's avatar
      Merge branch 'pci/lpc' · 3da1b617
      Bjorn Helgaas authored
        - add support for PCI I/O port space that's neither directly accessible
          via CPU in/out instructions nor directly mapped into CPU physical
          memory space (Zhichang Yuan)
      
        - add support for HiSilicon Hip06/Hip07 LPC I/O space (Zhichang Yuan,
          John Garry)
      
      * pci/lpc:
        MAINTAINERS: Add John Garry as maintainer for HiSilicon LPC driver
        HISI LPC: Add ACPI support
        ACPI / scan: Do not enumerate Indirect IO host children
        ACPI / scan: Rename acpi_is_serial_bus_slave() for more general use
        HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings
        of: Add missing I/O range exception for indirect-IO devices
        PCI: Apply the new generic I/O management on PCI IO hosts
        PCI: Add fwnode handler as input param of pci_register_io_range()
        PCI: Remove __weak tag from pci_register_io_range()
        lib: Add generic PIO mapping method
      3da1b617
    • Bjorn Helgaas's avatar
      Merge branch 'pci/hotplug' · a5c6ad78
      Bjorn Helgaas authored
        - fix possible cpqphp NULL pointer dereference (Shawn Lin)
      
        - rescan more of the hierarchy on ACPI hotplug to fix Thunderbolt/xHCI
          hotplug (Mika Westerberg)
      
      * pci/hotplug:
        ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status()
        PCI: cpqphp: Fix possible NULL pointer dereference
      a5c6ad78
    • Bjorn Helgaas's avatar
      Merge branch 'pci/enumeration' · 315271b0
      Bjorn Helgaas authored
        - add decoding for 16 GT/s link speed (Jay Fang)
      
        - add interfaces to get max link speed and width (Tal Gilboa)
      
        - add pcie_bandwidth_capable() to compute max supported link bandwidth
          (Tal Gilboa)
      
        - add pcie_bandwidth_available() to compute bandwidth available to device
          (Tal Gilboa)
      
        - add pcie_print_link_status() to log link speed and whether it's limited
          (Tal Gilboa)
      
        - use PCI core interfaces to report when device performance may be
          limited by its slot instead of doing it in each driver (Tal Gilboa)
      
      * pci/enumeration:
        fm10k: Report PCIe link properties with pcie_print_link_status()
        net/mlx5e: Use pcie_bandwidth_available() to compute bandwidth
        net/mlx5: Report PCIe link properties with pcie_print_link_status()
        net/mlx4_core: Report PCIe link properties with pcie_print_link_status()
        PCI: Add pcie_print_link_status() to log link speed and whether it's limited
        PCI: Add pcie_bandwidth_available() to compute bandwidth available to device
        PCI: Add pcie_bandwidth_capable() to compute max supported link bandwidth
        PCI: Add pcie_get_width_cap() to find max supported link width
        PCI: Add pcie_get_speed_cap() to find max supported link speed
        PCI: Add decoding for 16 GT/s link speed
      315271b0
    • Bjorn Helgaas's avatar
      Merge branch 'pci/deprecate-get-bus-and-slot' · db7a726e
      Bjorn Helgaas authored
        - remove last user of pci_get_bus_and_slot() and the function itself
          (Sinan Kaya)
      
      * pci/deprecate-get-bus-and-slot:
        PCI: Remove pci_get_bus_and_slot() function
        drm/i915: Deprecate pci_get_bus_and_slot()
      db7a726e
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aspm' · 09baca98
      Bjorn Helgaas authored
        - skip ASPM common clock warning if BIOS already configured it (Sinan
          Kaya)
      
        - fix ASPM Coverity warning about threshold_ns (Gustavo A. R. Silva)
      
      * pci/aspm:
        PCI/ASPM: Don't warn if already in common clock mode
        PCI/ASPM: Declare threshold_ns as u32, not u64
      09baca98
    • Bjorn Helgaas's avatar
      Merge branch 'pci/aer' · 63d5ce5f
      Bjorn Helgaas authored
        - move pci_uevent_ers() out of pci.h (Michael Ellerman)
      
      * pci/aer:
        PCI/AER: Move pci_uevent_ers() out of pci.h
      63d5ce5f
    • John Garry's avatar
      MAINTAINERS: Add John Garry as maintainer for HiSilicon LPC driver · 6183d9b3
      John Garry authored
      Add John Garry as maintainer for drivers/bus/hisi_lpc.c, the HiSilicon LPC
      driver.
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      6183d9b3
    • John Garry's avatar
      HISI LPC: Add ACPI support · e0aa1563
      John Garry authored
      Based on the previous patches, this patch supports the LPC host on
      Hip06/Hip07 for ACPI FW.
      
      It is the responsibility of the LPC host driver to enumerate the child
      devices, as the ACPI scan code will not enumerate children of "indirect IO"
      hosts.
      
      The ACPI table for the LPC host controller and the child devices is in the
      following format:
      
        Device (LPC0) {
          Name (_HID, "HISI0191")  // HiSi LPC
          Name (_CRS, ResourceTemplate () {
            Memory32Fixed (ReadWrite, 0xa01b0000, 0x1000)
          })
        }
      
        Device (LPC0.IPMI) {
          Name (_HID, "IPI0001")
          Name (LORS, ResourceTemplate() {
            QWordIO (
              ResourceConsumer,
              MinNotFixed,     // _MIF
              MaxNotFixed,     // _MAF
              PosDecode,
              EntireRange,
              0x0,             // _GRA
              0xe4,            // _MIN
              0x3fff,          // _MAX
              0x0,             // _TRA
              0x04,            // _LEN
              , ,
              BTIO
            )
          })
      
      Since the IO resources of the child devices need to be translated from LPC
      bus addresses to logical PIO addresses, and we shouldn't modify the
      resources of the devices generated in the FW scan, a per-child MFD is
      created as a substitute.  The MFD IO resources will be the translated bus
      addresses of the ACPI child.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarZhichang Yuan <yuanzhichang@hisilicon.com>
      Signed-off-by: default avatarGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      e0aa1563
    • John Garry's avatar
      ACPI / scan: Do not enumerate Indirect IO host children · dfda4492
      John Garry authored
      Through the logical PIO framework, systems which otherwise have no IO space
      access to legacy ISA/LPC devices may access these devices through so-called
      "indirect IO" method.  In this, IO space accesses for non-PCI hosts are
      redirected to a host LLDD to manually generate the IO space (bus) accesses.
      Hosts are able to register a region in logical PIO space to map to its bus
      address range.
      
      Indirect IO child devices have an associated host-specific bus address.
      Special translation is required to map between a logical PIO address for a
      device and its host bus address.
      
      Since in the ACPI tables the child device IO resources would be the
      host-specific values, it is required the ACPI scan code should not
      enumerate these devices, and that this should be the responsibility of the
      host driver so that it can "fixup" the resources so that they map to the
      appropriate logical PIO addresses.
      
      To avoid enumerating these child devices, add a check from
      acpi_device_enumeration_by_parent() as to whether the parent for a device
      is a member of a known list of "indirect IO" hosts.  For now, the HiSilicon
      LPC host controller ID is added.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      dfda4492
    • John Garry's avatar
      ACPI / scan: Rename acpi_is_serial_bus_slave() for more general use · d87fb091
      John Garry authored
      Currently the ACPI scan has special handling for serial bus slaves, in that
      it makes it the responsibility of the slave device's parent to enumerate
      the device.
      
      To support other types of slave devices which require the same special
      handling but where the bus is not strictly a serial bus, such as devices on
      the HiSilicon LPC controller bus, rename acpi_is_serial_bus_slave() to
      acpi_device_enumeration_by_parent(), so that the name can fit the wider
      purpose.
      
      Also rename the associated device flag acpi_device_flags.serial_bus_slave
      to .enumeration_by_parent.
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d87fb091
    • Zhichang Yuan's avatar
      HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings · adf38bb0
      Zhichang Yuan authored
      The low-pin-count (LPC) interface of Hip06/Hip07 accesses I/O port space of
      peripherals.
      
      Implement the LPC host controller driver which performs the I/O operations
      on the underlying hardware.  We don't want to touch existing drivers such
      as ipmi-bt, so this driver applies the indirect-IO introduced in the
      previous patch after registering an indirect-IO node to the indirect-IO
      devices list which will be searched by the I/O accessors to retrieve the
      host-local I/O port.
      
      The driver config is set as a bool instead of a tristate.  The reason here
      is that, by the very nature of the driver providing a logical PIO range, it
      does not make sense to have this driver as a loadable module.  Another more
      specific reason is that the Huawei D03 board which includes Hip06 SoC
      requires the LPC bus for UART console, so should be built in.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarZou Rongrong <zourongrong@huawei.com>
      Signed-off-by: default avatarZhichang Yuan <yuanzhichang@hisilicon.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: Rob Herring <robh@kernel.org>	# dts part
      adf38bb0
    • Zhichang Yuan's avatar
      of: Add missing I/O range exception for indirect-IO devices · 65af618d
      Zhichang Yuan authored
      There are some special ISA/LPC devices that work on a specific I/O range
      where it is not correct to specify a 'ranges' property in the DTS parent
      node as CPU addresses translated from DTS node are only for memory space on
      some architectures, such as ARM64.  Without the parent 'ranges' property,
      of_translate_address() returns an error.
      
      Here we add special handling for this case.
      
      During the OF address translation, some checking will be performed to
      identify whether the device node is registered as indirect-IO.  If it is,
      the I/O translation will be done in a different way from that one of PCI
      MMIO.  In this way, the I/O 'reg' property of the special ISA/LPC devices
      will be parsed correctly.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarZhichang Yuan <yuanzhichang@hisilicon.com>
      Signed-off-by: default avatarGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: Arnd Bergmann <arnd@arndb.de>    # earlier draft
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      65af618d
    • Zhichang Yuan's avatar
      PCI: Apply the new generic I/O management on PCI IO hosts · 5745392e
      Zhichang Yuan authored
      After introducing the new generic I/O space management (Logical PIO), the
      original PCI MMIO relevant helpers need to be updated based on the new
      interfaces defined in logical PIO.
      
      Adapt the corresponding code to match the changes introduced by logical
      PIO.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarZhichang Yuan <yuanzhichang@hisilicon.com>
      Signed-off-by: default avatarGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: Arnd Bergmann <arnd@arndb.de>        # earlier draft
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      5745392e
    • Gabriele Paoloni's avatar
      PCI: Add fwnode handler as input param of pci_register_io_range() · fcfaab30
      Gabriele Paoloni authored
      In preparation for having the PCI MMIO helpers use the new generic I/O
      space management (logical PIO) we need to add the fwnode handler as an
      extra input parameter.
      
      Changes the signature of pci_register_io_range() and its callers as
      needed.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      fcfaab30
    • Gabriele Paoloni's avatar
      PCI: Remove __weak tag from pci_register_io_range() · e2515476
      Gabriele Paoloni authored
      pci_register_io_range() has only one definition, so there is no need for
      the __weak attribute.  Remove it.
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarGabriele Paoloni <gabriele.paoloni@huawei.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      e2515476
  2. 03 Apr, 2018 6 commits
    • Bjorn Helgaas's avatar
      fm10k: Report PCIe link properties with pcie_print_link_status() · 170648fd
      Bjorn Helgaas authored
      Previously the driver used pcie_get_minimum_link() to warn when the NIC
      is in a slot that can't supply as much bandwidth as the NIC could use.
      
      pcie_get_minimum_link() can be misleading because it finds the slowest link
      and the narrowest link (which may be different links) without considering
      the total bandwidth of each link.  For a path with a 16 GT/s x1 link and a
      2.5 GT/s x16 link, it returns 2.5 GT/s x1, which corresponds to 250 MB/s of
      bandwidth, not the true available bandwidth of about 1969 MB/s for a
      16 GT/s x1 link.
      
      Use pcie_print_link_status() to report PCIe link speed and possible
      limitations instead of implementing this in the driver itself.  This finds
      the slowest link in the path to the device by computing the total bandwidth
      of each link and compares that with the capabilities of the device.
      
      Note that the driver previously used dev_warn() to suggest using a
      different slot, but pcie_print_link_status() uses dev_info() because if the
      platform has no faster slot available, the user can't do anything about the
      warning and may not want to be bothered with it.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      170648fd
    • Tal Gilboa's avatar
      net/mlx5e: Use pcie_bandwidth_available() to compute bandwidth · 33523a36
      Tal Gilboa authored
      Use the new pci_bandwidth_available() function to calculate maximum
      available bandwidth through the PCI chain instead of computing it ourselves
      with mlx5e_get_pci_bw().
      
      This is used to detect when the device is capable of more bandwidth than is
      available in the current slot.  The driver may adjust compression settings
      accordingly.
      
      Note that pci_bandwidth_available() accounts for PCIe encoding overhead, so
      it is more accurate than mlx5e_get_pci_bw() was.
      Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
      [bhelgaas: remove mlx5e_get_pci_bw() wrapper altogether]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      33523a36
    • Tal Gilboa's avatar
      net/mlx5: Report PCIe link properties with pcie_print_link_status() · 00c6bcb0
      Tal Gilboa authored
      Use pcie_print_link_status() to report PCIe link speed and possible
      limitations.
      Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
      [bhelgaas: changelog]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      00c6bcb0
    • Tal Gilboa's avatar
      net/mlx4_core: Report PCIe link properties with pcie_print_link_status() · 190b509c
      Tal Gilboa authored
      Use pcie_print_link_status() to report PCIe link speed and possible
      limitations instead of implementing this in the driver itself.
      Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      [bhelgaas: changelog]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      190b509c
    • Tal Gilboa's avatar
      PCI: Add pcie_print_link_status() to log link speed and whether it's limited · 9e506a7b
      Tal Gilboa authored
      Add pcie_print_link_status().  This logs the current settings of the link
      (speed, width, and total available bandwidth).
      
      If the device is capable of more bandwidth but is limited by a slower
      upstream link, we include information about the link that limits the
      device's performance.
      
      The user may be able to move the device to a different slot for better
      performance.
      
      This provides a unified method for all PCI devices to report status and
      issues, instead of each device reporting in a different way, using
      different code.
      Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
      [bhelgaas: changelog, reword log messages, print device capabilities when
      not limited, print bandwidth in Gb/s]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      9e506a7b
    • Tal Gilboa's avatar
      PCI: Add pcie_bandwidth_available() to compute bandwidth available to device · 6db79a88
      Tal Gilboa authored
      Add pcie_bandwidth_available() to compute the bandwidth available to a
      device.  This may be limited by the device itself or by a slower upstream
      link leading to the device.
      
      The available bandwidth at each link along the path is computed as:
      
        link_width * link_speed * (1 - encoding_overhead)
      
      2.5 and 5.0 GT/s links use 8b/10b encoding, which reduces the raw bandwidth
      available by 20%; 8.0 GT/s and faster links use 128b/130b encoding, which
      reduces it by about 1.5%.
      
      The result is in Mb/s, i.e., megabits/second, of raw bandwidth.
      
      Also return the device with the slowest link and the speed and width of
      that link.
      Signed-off-by: default avatarTal Gilboa <talgi@mellanox.com>
      [bhelgaas: changelog, leave pcie_get_minimum_link() alone for now, return
      bw directly, use pci_upstream_bridge(), check "next_bw <= bw" to find
      uppermost limiting device, return speed/width of the limiting device]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      6db79a88
  3. 31 Mar, 2018 3 commits
    • Bjorn Helgaas's avatar
      PCI/DPC: Rename from pcie-dpc.c to dpc.c · e02602bd
      Bjorn Helgaas authored
      Rename pcie-dpc.c to dpc.c.  The path "drivers/pci/pcie/pcie-dpc.c" has
      more occurrences of "pci" than necessary.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      e02602bd
    • Mathieu Malaterre's avatar
      PCI/IOV: Add missing prototypes for powerpc pcibios interfaces · 619e6f34
      Mathieu Malaterre authored
      Add missing prototypes for:
      
        resource_size_t pcibios_default_alignment(void);
        int pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs);
        int pcibios_sriov_disable(struct pci_dev *pdev);
      
      This fixes the following warnings treated as errors when using W=1:
      
        arch/powerpc/kernel/pci-common.c:236:17: error: no previous prototype for ‘pcibios_default_alignment’ [-Werror=missing-prototypes]
        arch/powerpc/kernel/pci-common.c:253:5: error: no previous prototype for ‘pcibios_sriov_enable’ [-Werror=missing-prototypes]
        arch/powerpc/kernel/pci-common.c:261:5: error: no previous prototype for ‘pcibios_sriov_disable’ [-Werror=missing-prototypes]
      
      Also, commit 978d2d68 ("PCI: Add pcibios_iov_resource_alignment()
      interface") added a new function but the prototype was located in the main
      header instead of the CONFIG_PCI_IOV specific section.  Move this function
      next to the newly added ones.
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Signed-off-by: default avatarBjorn Helgaas <helgaas@kernel.org>
      619e6f34
    • KarimAllah Ahmed's avatar
      PCI/IOV: Use VF0 cached config registers for other VFs · cf0921be
      KarimAllah Ahmed authored
      Cache some config data from VF0 and use it for all other VFs instead of
      reading it from the config space of each VF.  We assume these items are the
      same across all associated VFs:
      
         Revision ID
         Class Code
         Subsystem Vendor ID
         Subsystem ID
      
      This is an optimization when enabling SR-IOV on a device with many VFs.
      Signed-off-by: default avatarKarimAllah Ahmed <karahmed@amazon.de>
      [bhelgaas: changelog, simplify comments, remove unused "device", test
      CONFIG_PCI_IOV instead of CONFIG_PCI_ATS, rename functions]
      Signed-off-by: default avatarBjorn Helgaas <helgaas@kernel.org>
      cf0921be
  4. 30 Mar, 2018 7 commits
    • Bjørn Mork's avatar
      PCI: Always define the of_node helpers · ad32eb2d
      Bjørn Mork authored
      Simply move these inline functions outside the ifdef instead of duplicating
      them as stubs in the !OF case.  The struct device of_node field does not
      depend on OF.
      
      This also fixes the missing stubbed pci_bus_to_OF_node().
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarBjorn Helgaas <helgaas@kernel.org>
      ad32eb2d
    • Mika Westerberg's avatar
      PCI/DPC: Do not enable DPC if AER control is not allowed by the BIOS · 4e5fad42
      Mika Westerberg authored
      Commit eed85ff4 ("PCI/DPC: Enable DPC only if AER is available") made
      DPC control dependent whether AER is enabled in the OS.  However, it does
      not take into account situations where BIOS has not given OS control of
      AER:
      
        acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
        acpi PNP0A08:00: _OSC: platform does not support [AER]
        acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability]
      
      I think here it is better not to enable DPC even if the capability is
      available because then it would be against what "Determination of DPC
      Control" note in PCIe 4.0 sec 6.1.10 recommends.
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarBjorn Helgaas <helgaas@kernel.org>
      4e5fad42
    • Frederick Lawler's avatar
      PCI/AER: Use cached AER Capability offset · f0553ba0
      Frederick Lawler authored
      Replace pci_find_ext_capability(..., PCI_EXT_CAP_ID_ERR) calls with
      pci_dev->aer_cap.
      
      pci_dev->aer_cap is initialized in pci_init_capabilities(), which happens
      before any of these users of the AER Capability.
      Signed-off-by: default avatarFrederick Lawler <fred@fredlawl.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      f0553ba0
    • Bjorn Helgaas's avatar
      PCI/portdrv: Rename and reverse sense of pcie_ports_auto · d850882b
      Bjorn Helgaas authored
      The platform may restrict the OS's use of PCIe services, e.g., via the ACPI
      _OSC method.  The user may use "pcie_ports=native" to force the port driver
      to use PCIe services even if the platform asked us not to.
      
      The "pcie_ports=native" parameter determines the setting of
      pcie_ports_auto.  Rename this to pcie_ports_native and reverse the
      sense to simplify the code.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      d850882b
    • Bjorn Helgaas's avatar
      PCI/portdrv: Encapsulate pcie_ports_auto inside the port driver · 842b447f
      Bjorn Helgaas authored
      "pcie_ports_auto" is only used inside the PCIe port driver itself, so
      move it from include/linux/pci.h to portdrv.h so it's not visible to the
      whole kernel.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      842b447f
    • Bjorn Helgaas's avatar
      PCI/portdrv: Remove unnecessary "pcie_ports=auto" parameter · 4c0fd764
      Bjorn Helgaas authored
      The "pcie_ports=auto" parameter set pcie_ports_disabled and pcie_ports_auto
      to their compiled-in defaults, so specifying the parameter is the same as
      not using it at all.
      
      Remove the "pcie_ports=auto" parameter and update the documentation.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      4c0fd764
    • Bjorn Helgaas's avatar
      PCI/portdrv: Remove "pcie_hp=nomsi" kernel parameter · 1e447c57
      Bjorn Helgaas authored
      7570a333 ("PCI: Add pcie_hp=nomsi to disable MSI/MSI-X for pciehp
      driver") added the "pcie_hp=nomsi" kernel parameter to work around this
      error on shutdown:
      
        irq 16: nobody cared (try booting with the "irqpoll" option)
        Pid: 1081, comm: reboot Not tainted 3.2.0 #1
        ...
        Disabling IRQ #16
      
      This happened on an unspecified system (possibly involving the Integrated
      Device Technology, Inc. Device 807f bridge) where "an un-wanted interrupt
      is generated when PCI driver switches from MSI/MSI-X to INTx while shutting
      down the device."
      
      The implication was that the device was buggy, but it is normal for a
      device to use INTx after MSI/MSI-X have been disabled.  The only problem
      was that the driver was still attached and it wasn't prepared for INTx
      interrupts.  Prarit Bhargava fixed this issue with fda78d7a ("PCI/MSI:
      Stop disabling MSI/MSI-X in pci_device_shutdown()").
      
      There is no automated way to set this parameter, so it's not very useful
      for distributions or end users.  It's really only useful for debugging, and
      we have "pci=nomsi" for that purpose.
      
      Revert 7570a333 to remove the "pcie_hp=nomsi" parameter.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      CC: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
      CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      CC: Prarit Bhargava <prarit@redhat.com>
      1e447c57