1. 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
  2. 03 7月, 2017 4 次提交
  3. 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
  4. 28 6月, 2017 2 次提交
  5. 17 6月, 2017 1 次提交
  6. 31 5月, 2017 2 次提交
  7. 26 5月, 2017 2 次提交
    • C
      PCI/msi: fix the pci_alloc_irq_vectors_affinity stub · 83b4605b
      Christoph Hellwig 提交于
      We need to return an error for any call that asks for MSI / MSI-X
      vectors only, so that non-trivial fallback logic can work properly.
      
      Also valid dev->irq and use the "correct" errno value based on feedback
      from Linus.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reported-by: NSteven Rostedt <rostedt@goodmis.org>
      Fixes: aff17164 ("PCI: Provide sensible IRQ vector alloc/free routines")
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      83b4605b
    • T
      PCI: Replace the racy recursion prevention · 0b2c2a71
      Thomas Gleixner 提交于
      pci_call_probe() can called recursively when a physcial function is probed
      and the probing creates virtual functions, which are populated via
      pci_bus_add_device() which in turn can end up calling pci_call_probe()
      again.
      
      The code has an interesting way to prevent recursing into the workqueue
      code.  That's accomplished by a check whether the current task runs already
      on the numa node which is associated with the device.
      
      While that works to prevent the recursion into the workqueue code, it's
      racy versus normal execution as there is no guarantee that the node does
      not vanish after the check.
      
      There is another issue with this code. It dereferences cpumask_of_node()
      unconditionally without checking whether the node is available.
      
      Make the detection reliable by:
      
       - Mark a probed device as 'is_probed' in pci_call_probe()
       
       - Check in pci_call_probe for a virtual function. If it's a virtual
         function and the associated physical function device is marked
         'is_probed' then this is a recursive call, so the call can be invoked in
         the calling context.
      
       - Add a check whether the node is online before dereferencing it.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-pci@vger.kernel.org
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/20170524081548.771457199@linutronix.de
      0b2c2a71
  8. 24 5月, 2017 1 次提交
  9. 25 4月, 2017 1 次提交
    • L
      PCI: Implement devm_pci_remap_cfgspace() · 490cb6dd
      Lorenzo Pieralisi 提交于
      The introduction of the pci_remap_cfgspace() interface allows PCI host
      controller drivers to map PCI config space through a dedicated kernel
      interface. Current PCI host controller drivers use the devm_ioremap_*()
      devres interfaces to map PCI configuration space regions so in order to
      update them to the new pci_remap_cfgspace() mapping interface a new set of
      devres interfaces should be implemented so that PCI host controller drivers
      can make use of them.
      
      Introduce two new functions in the PCI kernel layer and Devres
      documentation:
      
      - devm_pci_remap_cfgspace()
      - devm_pci_remap_cfg_resource()
      
      so that PCI host controller drivers can make use of them to map PCI
      configuration space regions.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      490cb6dd
  10. 20 4月, 2017 4 次提交
  11. 19 4月, 2017 4 次提交
  12. 14 4月, 2017 1 次提交
  13. 11 4月, 2017 1 次提交
  14. 04 4月, 2017 1 次提交
  15. 31 3月, 2017 1 次提交
    • L
      PCI: Recognize Thunderbolt devices · 8531e283
      Lukas Wunner 提交于
      Detect on probe whether a PCI device is part of a Thunderbolt controller.
      Intel uses a Vendor-Specific Extended Capability (VSEC) with ID 0x1234
      on such devices.  Detect presence of this VSEC and cache it in a newly
      added is_thunderbolt bit in struct pci_dev.
      
      Also, add a helper to check whether a given PCI device is situated on a
      Thunderbolt daisy chain (i.e., below a PCI device with is_thunderbolt
      set).
      
      The necessity arises from the following:
      
      * If an external Thunderbolt GPU is connected to a dual GPU laptop,
        that GPU is currently registered with vga_switcheroo even though it
        can neither drive the laptop's panel nor be powered off by the
        platform.  To vga_switcheroo it will appear as if two discrete
        GPUs are present.  As a result, when the external GPU is runtime
        suspended, vga_switcheroo will cut power to the internal discrete GPU
        which may not be runtime suspended at all at this moment.  The
        solution is to not register external GPUs with vga_switcheroo, which
        necessitates a way to recognize if they're on a Thunderbolt daisy
        chain.
      
      * Dual GPU MacBook Pros introduced 2011+ can no longer switch external
        DisplayPort ports between GPUs.  (They're no longer just used for DP
        but have become combined DP/Thunderbolt ports.)  The driver to switch
        the ports, drivers/platform/x86/apple-gmux.c, needs to detect presence
        of a Thunderbolt controller and, if found, keep external ports
        permanently switched to the discrete GPU.
      
      v2: Make kerneldoc for pci_is_thunderbolt_attached() more precise,
          drop portion of commit message pertaining to separate series.
          (Bjorn Helgaas)
      
      Cc: Andreas Noever <andreas.noever@gmail.com>
      Cc: Michael Jamet <michael.jamet@intel.com>
      Cc: Tomas Winkler <tomas.winkler@intel.com>
      Cc: Amir Levy <amir.jer.levy@intel.com>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Link: http://patchwork.freedesktop.org/patch/msgid/0ab165a4a35c0b60f29d4c306c653ead14fcd8f9.1489145162.git.lukas@wunner.de
      8531e283
  16. 30 3月, 2017 2 次提交
  17. 10 3月, 2017 1 次提交
  18. 02 3月, 2017 1 次提交
  19. 10 2月, 2017 1 次提交
  20. 21 1月, 2017 1 次提交
  21. 14 1月, 2017 1 次提交
  22. 08 12月, 2016 3 次提交
    • T
      PCI: Export host bridge registration interface · a52d1443
      Thierry Reding 提交于
      Allow PCI host bridge drivers to use the new host bridge interfaces to
      register their host bridge.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      a52d1443
    • T
      PCI: Allow driver-specific data in host bridge · 59094065
      Thierry Reding 提交于
      Provide a way to allocate driver-specific data along with a PCI host bridge
      structure. The bridge's ->private field points to this data.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      59094065
    • A
      PCI: Add pci_register_host_bridge() interface · 37d6a0a6
      Arnd Bergmann 提交于
      Make the existing pci_host_bridge structure a proper device that is usable
      by PCI host drivers in a more standard way. In addition to the existing
      pci_scan_bus(), pci_scan_root_bus(), pci_scan_root_bus_msi(), and
      pci_create_root_bus() interfaces, this unfortunately means having to add
      yet another interface doing basically the same thing, and add some extra
      code in the initial step.
      
      However, this time it's more likely to be extensible enough that we won't
      have to do another one again in the future, and we should be able to reduce
      code much more as a result.
      
      The main idea is to pull the allocation of 'struct pci_host_bridge' out of
      the registration, and let individual host drivers and architecture code
      fill the members before calling the registration function.
      
      There are a number of things we can do based on this:
      
      * Use a single memory allocation for the driver-specific structure
        and the generic PCI host bridge
      * consolidate the contents of driver-specific structures by moving
        them into pci_host_bridge
      * Add a consistent interface for removing a PCI host bridge again
        when unloading a host driver module
      * Replace the architecture specific __weak pcibios_*() functions with
        callbacks in a pci_host_bridge device
      * Move common boilerplate code from host drivers into the generic
        function, based on contents of the structure
      * Extend pci_host_bridge with additional members when needed without
        having to add arguments to pci_scan_*().
      * Move members of struct pci_bus into pci_host_bridge to avoid
        having lots of identical copies.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
      37d6a0a6