1. 03 4月, 2018 1 次提交
    • T
      PCI: Add pcie_bandwidth_available() to compute bandwidth available to device · 6db79a88
      Tal Gilboa 提交于
      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: NTal 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: NBjorn Helgaas <bhelgaas@google.com>
      6db79a88
  2. 22 3月, 2018 1 次提交
  3. 31 1月, 2018 2 次提交
  4. 27 1月, 2018 1 次提交
  5. 24 1月, 2018 1 次提交
    • J
      PCI: Add pci_enable_atomic_ops_to_root() · 430a2368
      Jay Cornwall 提交于
      The Atomic Operations feature (PCIe r4.0, sec 6.15) allows atomic
      transctions to be requested by, routed through and completed by PCIe
      components. Routing and completion do not require software support.
      Component support for each is detectable via the DEVCAP2 register.
      
      A Requester may use AtomicOps only if its PCI_EXP_DEVCTL2_ATOMIC_REQ is
      set. This should be set only if the Completer and all intermediate routing
      elements support AtomicOps.
      
      A concrete example is the AMD Fiji-class GPU (which is capable of making
      AtomicOp requests), below a PLX 8747 switch (advertising AtomicOp routing)
      with a Haswell host bridge (advertising AtomicOp completion support).
      
      Add pci_enable_atomic_ops_to_root() for per-device control over AtomicOp
      requests. This checks to be sure the Root Port supports completion of the
      desired AtomicOp sizes and the path to the Root Port supports routing the
      AtomicOps.
      Signed-off-by: NJay Cornwall <Jay.Cornwall@amd.com>
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      [bhelgaas: changelog, comments, whitespace]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      430a2368
  6. 20 1月, 2018 1 次提交
    • N
      PCI: Add dummy pci_irqd_intx_xlate() for CONFIG_PCI=n build · 80db6f08
      Niklas Cassel 提交于
      Some hardware can operate in either "host" or "endpoint" mode, which means
      there can be both a host bridge driver and an endpoint driver for the same
      device.  Those drivers share a lot of code, so sometimes they live in the
      same source file.
      
      The host bridge driver requires CONFIG_PCI=y because it enumerates PCI
      devices below the bridge using the PCI core.  The endpoint driver does not
      require CONFIG_PCI=y because it runs in an embedded kernel on the other
      side of the device, e.g., on an adapter card.
      
      pci-dra7xx.c contains both host and endpoint drivers.  If we select only
      the endpoint driver (CONFIG_PCI=n and CONFIG_PCI_DRA7XX_EP=y), the unneeded
      host driver is still compiled.  It references pci_irqd_intx_xlate(), which
      is not present when CONFIG_PCI=n, which causes this error:
      
        drivers/pci/dwc/pci-dra7xx.c:229:11: error: 'pci_irqd_intx_xlate' undeclared here (not in a function)
      
      Add a dummy pci_irqd_intx_xlate() for the CONFIG_PCI=n case.
      
      [bhelgaas: changelog]
      Signed-off-by: NNiklas Cassel <niklas.cassel@axis.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      80db6f08
  7. 19 1月, 2018 1 次提交
  8. 19 12月, 2017 2 次提交
  9. 14 12月, 2017 1 次提交
  10. 11 12月, 2017 1 次提交
  11. 07 12月, 2017 1 次提交
    • R
      PCI: Add pci_get_domain_bus_and_slot() stub · 7912af5c
      Randy Dunlap 提交于
      The coretemp driver build fails when CONFIG_PCI is not enabled because it
      uses a function that does not have a stub for that config case, so add the
      function stub.
      
        ../drivers/hwmon/coretemp.c: In function 'adjust_tjmax':
        ../drivers/hwmon/coretemp.c:250:9: error: implicit declaration of function 'pci_get_domain_bus_and_slot' [-Werror=implicit-function-declaration]
          struct pci_dev *host_bridge = pci_get_domain_bus_and_slot(0, 0, devfn);
        ../drivers/hwmon/coretemp.c:250:32: warning: initialization makes pointer from integer without a cast [enabled by default]
          struct pci_dev *host_bridge = pci_get_domain_bus_and_slot(0, 0, devfn);
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      [bhelgaas: identical patch also by Arnd Bergmann <arnd@arndb.de>]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NGuenter Roeck <linux@roeck-us.net>
      7912af5c
  12. 24 11月, 2017 1 次提交
  13. 07 11月, 2017 1 次提交
  14. 06 11月, 2017 1 次提交
  15. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  16. 26 10月, 2017 1 次提交
    • C
      PCI: Add pci_resize_resource() for resizing BARs · 8bb705e3
      Christian König 提交于
      Add a pci_resize_resource() interface to allow device drivers to resize
      BARs of their devices.
      
      This is useful for devices with large local storage, e.g., graphics
      devices.  These devices often only expose 256MB BARs initially to be
      compatible with 32-bit systems.
      
      This function only tries to reprogram the windows of the bridge directly
      above the requesting device and only the BAR of the same type (usually mem,
      64bit, prefetchable).  This is done to avoid disturbing other drivers by
      changing the BARs of their devices.
      
      Drivers should use the following sequence to resize their BARs:
      1. Disable memory decoding of the device using the PCI cfg dword.
      2. Use pci_release_resource() to release all BARs which can move during the
         resize, including the one you want to resize.
      3. Call pci_resize_resource() for each BAR you want to resize.
      4. Call pci_assign_unassigned_bus_resources() to reassign new locations
         for all BARs which are not resized, but could move.
      5. If everything worked as expected, enable memory decoding in the device
         again using the PCI cfg dword.
      Signed-off-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      8bb705e3
  17. 06 10月, 2017 2 次提交
  18. 26 9月, 2017 1 次提交
    • G
      PCI: Add dummy pci_acs_enabled() for CONFIG_PCI=n build · fe594932
      Geert Uytterhoeven 提交于
      If CONFIG_PCI=n and gcc (e.g. 4.1.2) decides not to inline
      get_pci_function_alias_group(), the build fails with:
      
        drivers/iommu/iommu.o: In function `get_pci_function_alias_group':
        iommu.c:(.text+0xfdc): undefined reference to `pci_acs_enabled'
      
      Due to the various dummies for PCI calls in the CONFIG_PCI=n case,
      pci_acs_enabled() never called, but not all versions of gcc are smart
      enough to realize that.
      
      While explicitly marking get_pci_function_alias_group() inline would fix
      the build, this would inflate the code for the CONFIG_PCI=y case, as
      get_pci_function_alias_group() is a not-so-small function called from two
      places.
      
      Hence fix the issue by introducing a dummy for pci_acs_enabled() instead.
      
      Fixes: 0ae349a0 ("iommu/qcom: Add qcom_iommu")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NAlex Williamson <alex.williamson@redhat.com>
      fe594932
  19. 02 9月, 2017 1 次提交
  20. 19 8月, 2017 1 次提交
    • G
      PCI/IB: add support for pci driver attribute groups · 92d50fc1
      Greg Kroah-Hartman 提交于
      Some drivers (specifically the nes IB driver), want to create a lot of
      sysfs driver attributes.  Instead of open-coding the creation and
      removal of these files (and getting it wrong btw), it's a better idea to
      let the driver core handle all of this logic for us.
      
      So add a new field to the pci driver structure, **groups, that allows
      pci drivers to specify an attribute group list it wishes to have created
      when it is registered with the driver core.
      
      Big bonus is now the driver doesn't race with userspace when the sysfs
      files are created vs. when the kobject is announced, so any script/tool
      that actually wanted to use these files will not have to poll waiting
      for them to show up.
      
      Cc: Faisal Latif <faisal.latif@intel.com>
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      92d50fc1
  21. 17 8月, 2017 1 次提交
    • P
      PCI: Add pci_irqd_intx_xlate() · 0d58e6c1
      Paul Burton 提交于
      Legacy PCI INTx interrupts are represented in the PCI_INTERRUPT_PIN
      register using the range 1-4, which matches our enum pci_interrupt_pin.
      This is however not ideal for an IRQ domain, where with 4 interrupts we
      would ideally have a domain of size 4 & hwirq numbers in the range 0-3.
      
      Different PCI host controller drivers have handled this in different ways.
      Of those under drivers/pci/ which register an INTx IRQ domain, we have:
      
        - pcie-altera uses the range 1-4 in device trees and an IRQ domain of
          size 5 to cover that range, with entry 0 wasted.
      
        - pcie-xilinx & pcie-xilinx-nwl use the range 1-4 in device trees but
          register an IRQ domain of size 4, which doesn't cover the hwirq=4/INTD
          case leading to that interrupt being broken.
      
        - pci-ftpci100 & pci-aardvark use the range 0-3 in both device trees & as
          hwirq numbering in the driver & IRQ domain.
      
      In order to introduce some level of consistency in at least the hwirq
      numbering used by the drivers & IRQ domains, this patch introduces a new
      pci_irqd_intx_xlate() helper function which drivers using the 1-4 range in
      device trees can assign as the xlate callback for their INTx IRQ domain.
      This translates the 1-4 range into a 0-3 range, allowing us to use an IRQ
      domain of size 4 & avoid a wasted entry. Further patches will make use of
      this in drivers to allow them to use an IRQ domain of size 4 for legacy
      INTx interrupts without breaking INTD.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      0d58e6c1
  22. 16 8月, 2017 1 次提交
    • P
      PCI: Move enum pci_interrupt_pin to linux/pci.h · b352baf1
      Paul Burton 提交于
      We currently have a definition of enum pci_interrupt_pin in a header
      specific to PCI endpoints - linux/pci-epf.h. In order to allow for use of
      this enum from PCI host code in a future commit, move its definition to
      linux/pci.h & include that from linux/pci-epf.h.
      
      Additionally we add a PCI_NUM_INTX macro which indicates the number of PCI
      INTx interrupts, and will be used alongside enum pci_interrupt_pin in
      further patches.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      [bhelgaas: move enum pci_interrupt_pin outside #ifdef CONFIG_PCI]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      b352baf1
  23. 15 8月, 2017 1 次提交
  24. 11 8月, 2017 1 次提交
  25. 04 8月, 2017 1 次提交
  26. 02 8月, 2017 1 次提交
    • M
      PCI: Add pci_reset_function_locked() · a477b9cd
      Marc Zyngier 提交于
      The implementation of PCI workarounds may require that the device is reset
      from its probe function.  This implies that the PCI device lock is already
      held, and makes calling pci_reset_function() impossible (since it will
      itself try to take that lock).
      
      Add pci_reset_function_locked(), which is the equivalent of
      pci_reset_function(), except that it requires the PCI device lock to be
      already held by the caller.
      Tested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      [bhelgaas: folded in fix for conflict with 52354b9d ("PCI: Remove
      __pci_dev_reset() and pci_dev_reset()")]
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org	# 4.11: 52354b9d: PCI: Remove __pci_dev_reset() and pci_dev_reset()
      Cc: stable@vger.kernel.org	# 4.11
      a477b9cd
  27. 01 8月, 2017 1 次提交
  28. 03 7月, 2017 4 次提交
  29. 29 6月, 2017 4 次提交
    • L
      PCI: Make pci_register_host_bridge() PCI core internal · cea9bc0b
      Lorenzo Pieralisi 提交于
      With the introduction of pci_scan_root_bus_bridge() there is no need to
      export pci_register_host_bridge() to other kernel subsystems other than the
      PCI compilation unit that needs it.
      
      Make pci_register_host_bridge() static to its compilation unit and convert
      the existing drivers usage over to pci_scan_root_bus_bridge().
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      cea9bc0b
    • L
      PCI: Add pci_scan_root_bus_bridge() interface · 1228c4b6
      Lorenzo Pieralisi 提交于
      The current pci_scan_root_bus() interface is made up of two main code
      paths:
      
        - pci_create_root_bus()
        - pci_scan_child_bus()
      
      pci_create_root_bus() is a wrapper function that allows to create a struct
      pci_host_bridge structure, initialize it with the passed parameters and
      register it with the kernel.
      
      As the struct pci_host_bridge require additional struct members,
      pci_create_root_bus() parameters list has grown in time, making it unwieldy
      to add further parameters to it in case the struct pci_host_bridge gains
      more members fields to augment its functionality.
      
      Since PCI core code provides functions to allocate struct pci_host_bridge,
      instead of forcing the pci_create_root_bus() interface to add new
      parameters to cater for new struct pci_host_bridge functionality, it is
      more suitable to add an interface in PCI core code to scan a PCI bus
      straight from a struct pci_host_bridge created and customized by each
      specific PCI host controller driver.
      
      Add a pci_scan_root_bus_bridge() function to allow PCI host controller
      drivers to create and initialize struct pci_host_bridge and scan the
      resulting bus.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      1228c4b6
    • L
      PCI: Add devm_pci_alloc_host_bridge() interface · 5c3f18cc
      Lorenzo Pieralisi 提交于
      Struct pci_host_bridge can be allocated by PCI host bridge drivers which
      usually allocate and map memory through devm managed interfaces.
      
      Add a devm version for the pci_alloc_host_bridge() interface to simplify
      PCI host controller driver porting and simplify the driver failure paths.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      5c3f18cc
    • L
      PCI: Add pci_free_host_bridge() interface · dff79b91
      Lorenzo Pieralisi 提交于
      Commit a52d1443 ("PCI: Export host bridge registration interface")
      exported the pci_alloc_host_bridge() interface so that PCI host controllers
      drivers can make use of it.
      
      Introduce pci_alloc_host_bridge() kernel counterpart to free the host
      bridge data structures, pci_free_host_bridge(), export it and update kernel
      functions releasing host bridge objects allocated memory to make use of it.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      dff79b91
  30. 28 6月, 2017 2 次提交