1. 15 Jan, 2014 1 commit
    • Alex Williamson's avatar
      vfio-pci: Use pci "try" reset interface · 890ed578
      Alex Williamson authored
      PCI resets will attempt to take the device_lock for any device to be
      reset.  This is a problem if that lock is already held, for instance
      in the device remove path.  It's not sufficient to simply kill the
      user process or skip the reset if called after .remove as a race could
      result in the same deadlock.  Instead, we handle all resets as "best
      effort" using the PCI "try" reset interfaces.  This prevents the user
      from being able to induce a deadlock by triggering a reset.
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      890ed578
  2. 14 Jan, 2014 4 commits
    • Alex Williamson's avatar
      PCI: Add pci_try_reset_function(), pci_try_reset_slot(), pci_try_reset_bus() · 61cf16d8
      Alex Williamson authored
      When doing a function/slot/bus reset PCI grabs the device_lock for each
      device to block things like suspend and driver probes, but call paths exist
      where this lock may already be held.  This creates an opportunity for
      deadlock.  For instance, vfio allows userspace to issue resets so long as
      it owns the device(s).  If a driver unbind .remove callback races with
      userspace issuing a reset, we have a deadlock as userspace gets stuck
      waiting on device_lock while another thread has device_lock and waits for
      .remove to complete.  To resolve this, we can make a version of the reset
      interfaces which use trylock.  With this, we can safely attempt a reset and
      return error to userspace if there is contention.
      
      [bhelgaas: the deadlock happens when A (userspace) has a file descriptor for
      the device, and B waits in this path:
      
        driver_detach
          device_lock                     # take device_lock
          __device_release_driver
            pci_device_remove             # pci_bus_type.remove
              vfio_pci_remove             # pci_driver .remove
                vfio_del_group_dev
                  wait_event(vfio.release_q, !vfio_dev_present)   # wait (holding device_lock)
      
      Now B is stuck until A gives up the file descriptor.  If A tries to acquire
      device_lock for any reason, we deadlock because A is waiting for B to release
      the lock, and B is waiting for A to release the file descriptor.]
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      61cf16d8
    • Bjorn Helgaas's avatar
      Merge branch 'pci/ifndefs' into next · a870614a
      Bjorn Helgaas authored
      * pci/ifndefs:
        PCI: Cleanup pci.h whitespace
        PCI: Reorder so actual code comes before stubs
      a870614a
    • Bjorn Helgaas's avatar
      PCI: Cleanup pci.h whitespace · 2ee546c4
      Bjorn Helgaas authored
      Put empty or trivial inline stub functions on one line when they fit.  No
      functional change.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      2ee546c4
    • Bjorn Helgaas's avatar
      PCI: Reorder so actual code comes before stubs · 4c859804
      Bjorn Helgaas authored
      Consistently use the:
      
          #ifdef CONFIG_PCI_FOO
          int pci_foo(...);
          #else
          static inline int pci_foo(...) { return -1; }
          #endif
      
      pattern, instead of sometimes using "#ifndef CONFIG_PCI_FOO".
      
      No functional change.
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      4c859804
  3. 13 Jan, 2014 9 commits
  4. 10 Jan, 2014 5 commits
    • Stephen Hemminger's avatar
      PCI: Remove unused ID-Based Ordering support · 7c2dd2d7
      Stephen Hemminger authored
      My philosophy is unused code is dead code.  And dead code is subject to bit
      rot and is a likely source of bugs.  Use it or lose it.
      
      This reverts b48d4425 ("PCI: add ID-based ordering enable/disable
      support"), removing these interfaces:
      
          pci_enable_ido()
          pci_disable_ido()
      
      [bhelgaas: split to separate patch, also remove prototypes from pci.h]
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      7c2dd2d7
    • Stephen Hemminger's avatar
      PCI: Remove unused Optimized Buffer Flush/Fill support · ecc86356
      Stephen Hemminger authored
      My philosophy is unused code is dead code.  And dead code is subject to bit
      rot and is a likely source of bugs.  Use it or lose it.
      
      This reverts 48a92a81 ("PCI: add OBFF enable/disable support"),
      removing these interfaces:
      
          pci_enable_obff()
          pci_disable_obff()
      
      [bhelgaas: split to separate patch, also remove prototypes from pci.h]
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      ecc86356
    • Stephen Hemminger's avatar
      PCI: Remove unused Latency Tolerance Reporting support · 3ea8197e
      Stephen Hemminger authored
      My philosophy is unused code is dead code.  And dead code is subject to bit
      rot and is a likely source of bugs.  Use it or lose it.
      
      This reverts 51c2e0a7 ("PCI: add latency tolerance reporting
      enable/disable support"), removing these interfaces:
      
          pci_enable_ltr()
          pci_disable_ltr()
          pci_set_ltr()
      
      [bhelgaas: split to separate patch, also remove prototypes from pci.h]
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      3ea8197e
    • Bjorn Helgaas's avatar
      Merge branch 'pci/resource' into next · 96702be5
      Bjorn Helgaas authored
      * pci/resource:
        PCI: Allocate 64-bit BARs above 4G when possible
        PCI: Enforce bus address limits in resource allocation
        PCI: Split out bridge window override of minimum allocation address
        agp/ati: Use PCI_COMMAND instead of hard-coded 4
        agp/intel: Use CPU physical address, not bus address, for ioremap()
        agp/intel: Use pci_bus_address() to get GTTADR bus address
        agp/intel: Use pci_bus_address() to get MMADR bus address
        agp/intel: Support 64-bit GMADR
        agp/intel: Rename gtt_bus_addr to gtt_phys_addr
        drm/i915: Rename gtt_bus_addr to gtt_phys_addr
        agp: Use pci_resource_start() to get CPU physical address for BAR
        agp: Support 64-bit APBASE
        PCI: Add pci_bus_address() to get bus address of a BAR
        PCI: Convert pcibios_resource_to_bus() to take a pci_bus, not a pci_dev
        PCI: Change pci_bus_region addresses to dma_addr_t
      96702be5
    • Stephen Hemminger's avatar
      PCI: Removed unused parts of Page Request Interface support · b340cacc
      Stephen Hemminger authored
      My philosophy is unused code is dead code.  And dead code is subject to bit
      rot and is a likely source of bugs.  Use it or lose it.
      
      This reverts parts of c320b976 ("PCI: Add implementation for PRI
      capability"), removing these interfaces:
      
          pci_pri_enabled()
          pci_pri_stopped()
          pci_pri_status()
      
      [bhelgaas: split to separate patch]
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      CC: Joerg Roedel <joro@8bytes.org>
      b340cacc
  5. 08 Jan, 2014 4 commits
  6. 07 Jan, 2014 13 commits
  7. 04 Jan, 2014 4 commits