Merge tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 7 Apr 2018 01:31:06 +0000 (18:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 7 Apr 2018 01:31:06 +0000 (18:31 -0700)
Pull PCI updates from Bjorn Helgaas:

 - move pci_uevent_ers() out of pci.h (Michael Ellerman)

 - skip ASPM common clock warning if BIOS already configured it (Sinan
   Kaya)

 - fix ASPM Coverity warning about threshold_ns (Gustavo A. R. Silva)

 - remove last user of pci_get_bus_and_slot() and the function itself
   (Sinan Kaya)

 - 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)

 - fix possible cpqphp NULL pointer dereference (Shawn Lin)

 - rescan more of the hierarchy on ACPI hotplug to fix Thunderbolt/xHCI
   hotplug (Mika Westerberg)

 - 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. This is fairly intrusive and includes minor changes to
   interfaces used for I/O space on most platforms (Zhichang Yuan, John
   Garry)

 - add support for HiSilicon Hip06/Hip07 LPC I/O space (Zhichang Yuan,
   John Garry)

 - 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)

 - don't set up INTx if MSI or MSI-X is enabled to align cris, frv,
   ia64, and mn10300 with x86 (Bjorn Helgaas)

 - 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)

 - use generic pci_mmap_resource_range() instead of powerpc and xtensa
   arch-specific versions (David Woodhouse)

 - support arbitrary PCI host bridge offsets on sparc (Yinghai Lu)

 - remove System and Video ROM reservations on sparc (Bjorn Helgaas)

 - 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)

 - consolidate VPD code in vpd.c (Bjorn Helgaas)

 - add Tegra dependency on PCI_MSI_IRQ_DOMAIN (Arnd Bergmann)

 - add DT support for R-Car r8a7743 (Biju Das)

 - fix a PCI_EJECT vs PCI_BUS_RELATIONS race condition in Hyper-V host
   bridge driver that causes a general protection fault (Dexuan Cui)

 - fix Hyper-V host bridge hang in MSI setup on 1-vCPU VMs with SR-IOV
   (Dexuan Cui)

 - fix Hyper-V host bridge hang when ejecting a VF before setting up MSI
   (Dexuan Cui)

 - make several structures static (Fengguang Wu)

 - increase number of MSI IRQs supported by Synopsys DesignWare bridges
   from 32 to 256 (Gustavo Pimentel)

 - implemented multiplexed IRQ domain API and remove obsolete MSI IRQ
   API from DesignWare drivers (Gustavo Pimentel)

 - add Tegra power management support (Manikanta Maddireddy)

 - add Tegra loadable module support (Manikanta Maddireddy)

 - handle 64-bit BARs correctly in endpoint support (Niklas Cassel)

 - support optional regulator for HiSilicon STB (Shawn Guo)

 - use regulator bulk API for Qualcomm apq8064 (Srinivas Kandagatla)

 - support power supplies for Qualcomm msm8996 (Srinivas Kandagatla)

* tag 'pci-v4.17-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (123 commits)
  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()
  MAINTAINERS: Add missing /drivers/pci/cadence directory entry
  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
  misc: pci_endpoint_test: Handle 64-bit BARs properly
  PCI: designware-ep: Make dw_pcie_ep_reset_bar() handle 64-bit BARs properly
  PCI: endpoint: Make sure that BAR_5 does not have 64-bit flag set when clearing
  PCI: endpoint: Make epc->ops->clear_bar()/pci_epc_clear_bar() take struct *epf_bar
  ...

21 files changed:
1  2 
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
drivers/acpi/scan.c
drivers/bus/Kconfig
drivers/bus/Makefile
drivers/gpu/drm/i915/i915_drv.c
drivers/net/ethernet/intel/fm10k/fm10k_pci.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/pci/dwc/pcie-designware-host.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/probe.c
drivers/pci/quirks.c
drivers/pci/setup-res.c
drivers/pci/vpd.c
include/asm-generic/io.h
include/linux/pci.h
include/linux/pci_ids.h
lib/Makefile

diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
@@@ -5,11 -5,10 +5,13 @@@
  
  # Interconnect bus drivers for ARM platforms
  obj-$(CONFIG_ARM_CCI)         += arm-cci.o
 -obj-$(CONFIG_ARM_CCN)         += arm-ccn.o
+ obj-$(CONFIG_HISILICON_LPC)   += hisi_lpc.o
  obj-$(CONFIG_BRCMSTB_GISB_ARB)        += brcmstb_gisb.o
 +
 +# DPAA2 fsl-mc bus
 +obj-$(CONFIG_FSL_MC_BUS)      += fsl-mc/
 +
  obj-$(CONFIG_IMX_WEIM)                += imx-weim.o
  obj-$(CONFIG_MIPS_CDMM)               += mips_cdmm.o
  obj-$(CONFIG_MVEBU_MBUS)      += mvebu-mbus.o
Simple merge
@@@ -4033,50 -3864,16 +4033,20 @@@ void mlx5e_build_default_indir_rqt(u32 
                indirection_rqt[i] = i % num_channels;
  }
  
- static int mlx5e_get_pci_bw(struct mlx5_core_dev *mdev, u32 *pci_bw)
- {
-       enum pcie_link_width width;
-       enum pci_bus_speed speed;
-       int err = 0;
-       err = pcie_get_minimum_link(mdev->pdev, &speed, &width);
-       if (err)
-               return err;
-       if (speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN)
-               return -EINVAL;
-       switch (speed) {
-       case PCIE_SPEED_2_5GT:
-               *pci_bw = 2500 * width;
-               break;
-       case PCIE_SPEED_5_0GT:
-               *pci_bw = 5000 * width;
-               break;
-       case PCIE_SPEED_8_0GT:
-               *pci_bw = 8000 * width;
-               break;
-       default:
-               return -EINVAL;
-       }
-       return 0;
- }
 -static bool cqe_compress_heuristic(u32 link_speed, u32 pci_bw)
 +static bool slow_pci_heuristic(struct mlx5_core_dev *mdev)
  {
 -      return (link_speed && pci_bw &&
 -              (pci_bw < 40000) && (pci_bw < link_speed));
 -}
 +      u32 link_speed = 0;
 +      u32 pci_bw = 0;
  
 -static bool hw_lro_heuristic(u32 link_speed, u32 pci_bw)
 -{
 -      return !(link_speed && pci_bw &&
 -               (pci_bw <= 16000) && (pci_bw < link_speed));
 +      mlx5e_get_max_linkspeed(mdev, &link_speed);
-       mlx5e_get_pci_bw(mdev, &pci_bw);
++      pci_bw = pcie_bandwidth_available(mdev->pdev, NULL, NULL, NULL);
 +      mlx5_core_dbg_once(mdev, "Max link speed = %d, PCI BW = %d\n",
 +                         link_speed, pci_bw);
 +
 +#define MLX5E_SLOW_PCI_RATIO (2)
 +
 +      return link_speed && pci_bw &&
 +              link_speed > MLX5E_SLOW_PCI_RATIO * pci_bw;
  }
  
  void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -61,3 -513,123 +513,132 @@@ int pci_vpd_find_info_keyword(const u8 
        return -ENOENT;
  }
  EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword);
 -      pci_set_vpd_size(dev, 8192);
+ #ifdef CONFIG_PCI_QUIRKS
+ /*
+  * Quirk non-zero PCI functions to route VPD access through function 0 for
+  * devices that share VPD resources between functions.  The functions are
+  * expected to be identical devices.
+  */
+ static void quirk_f0_vpd_link(struct pci_dev *dev)
+ {
+       struct pci_dev *f0;
+       if (!PCI_FUNC(dev->devfn))
+               return;
+       f0 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
+       if (!f0)
+               return;
+       if (f0->vpd && dev->class == f0->class &&
+           dev->vendor == f0->vendor && dev->device == f0->device)
+               dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
+       pci_dev_put(f0);
+ }
+ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
+                             PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link);
+ /*
+  * If a device follows the VPD format spec, the PCI core will not read or
+  * write past the VPD End Tag.  But some vendors do not follow the VPD
+  * format spec, so we can't tell how much data is safe to access.  Devices
+  * may behave unpredictably if we access too much.  Blacklist these devices
+  * so we don't touch VPD at all.
+  */
+ static void quirk_blacklist_vpd(struct pci_dev *dev)
+ {
+       if (dev->vpd) {
+               dev->vpd->len = 0;
+               pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n");
+       }
+ }
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0060, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x007c, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0413, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0078, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0079, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0073, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x0071, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005b, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x002f, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
+               quirk_blacklist_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd);
+ /*
+  * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
+  * VPD end tag will hang the device.  This problem was initially
+  * observed when a vpd entry was created in sysfs
+  * ('/sys/bus/pci/devices/<id>/vpd').   A read to this sysfs entry
+  * will dump 32k of data.  Reading a full 32k will cause an access
+  * beyond the VPD end tag causing the device to hang.  Once the device
+  * is hung, the bnx2 driver will not be able to reset the device.
+  * We believe that it is legal to read beyond the end tag and
+  * therefore the solution is to limit the read/write length.
+  */
+ static void quirk_brcm_570x_limit_vpd(struct pci_dev *dev)
+ {
+       /*
+        * Only disable the VPD capability for 5706, 5706S, 5708,
+        * 5708S and 5709 rev. A
+        */
+       if ((dev->device == PCI_DEVICE_ID_NX2_5706) ||
+           (dev->device == PCI_DEVICE_ID_NX2_5706S) ||
+           (dev->device == PCI_DEVICE_ID_NX2_5708) ||
+           (dev->device == PCI_DEVICE_ID_NX2_5708S) ||
+           ((dev->device == PCI_DEVICE_ID_NX2_5709) &&
+            (dev->revision & 0xf0) == 0x0)) {
+               if (dev->vpd)
+                       dev->vpd->len = 0x80;
+       }
+ }
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5706,
+                       quirk_brcm_570x_limit_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5706S,
+                       quirk_brcm_570x_limit_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5708,
+                       quirk_brcm_570x_limit_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5708S,
+                       quirk_brcm_570x_limit_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5709,
+                       quirk_brcm_570x_limit_vpd);
+ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
+                       PCI_DEVICE_ID_NX2_5709S,
+                       quirk_brcm_570x_limit_vpd);
+ static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
+ {
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x20, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x21, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x22, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x23, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x24, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x25, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x26, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x30, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x31, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x32, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x35, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x36, quirk_chelsio_extend_vpd);
 -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x37, quirk_chelsio_extend_vpd);
++      int chip = (dev->device & 0xf000) >> 12;
++      int func = (dev->device & 0x0f00) >>  8;
++      int prod = (dev->device & 0x00ff) >>  0;
++
++      /*
++       * If this is a T3-based adapter, there's a 1KB VPD area at offset
++       * 0xc00 which contains the preferred VPD values.  If this is a T4 or
++       * later based adapter, the special VPD is at offset 0x400 for the
++       * Physical Functions (the SR-IOV Virtual Functions have no VPD
++       * Capabilities).  The PCI VPD Access core routines will normally
++       * compute the size of the VPD by parsing the VPD Data Structure at
++       * offset 0x000.  This will result in silent failures when attempting
++       * to accesses these other VPD areas which are beyond those computed
++       * limits.
++       */
++      if (chip == 0x0 && prod >= 0x20)
++              pci_set_vpd_size(dev, 8192);
++      else if (chip >= 0x4 && func < 0x8)
++              pci_set_vpd_size(dev, 2048);
+ }
++
++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
++                      quirk_chelsio_extend_vpd);
++
+ #endif
Simple merge
Simple merge
Simple merge
diff --cc lib/Makefile
Simple merge