1. 15 1月, 2014 2 次提交
    • B
      PCI: Fix pci_check_and_unmask_intx() comment typos · ebd50b93
      Bjorn Helgaas 提交于
      Fix typos in pci_check_and_unmask_intx() function comment.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      ebd50b93
    • A
      PCI: Add pci_try_reset_function(), pci_try_reset_slot(), pci_try_reset_bus() · 61cf16d8
      Alex Williamson 提交于
      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: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      61cf16d8
  2. 14 1月, 2014 1 次提交
  3. 11 1月, 2014 3 次提交
  4. 18 12月, 2013 3 次提交
  5. 03 12月, 2013 1 次提交
  6. 15 11月, 2013 1 次提交
  7. 08 11月, 2013 1 次提交
  8. 06 11月, 2013 2 次提交
    • B
      PCI: Drop warning about drivers that don't use pci_set_master() · fbeeb822
      Bjorn Helgaas 提交于
      f41f064c ("PCI: Workaround missing pci_set_master in pci drivers") made
      pci_enable_bridge() turn on bus mastering if the driver hadn't done so
      already.  It also added a warning in this case.  But there's no reason to
      warn about it unless it's actually a problem to enable bus mastering here.
      
      This patch drops the warning because I'm not aware of any such problem.
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      CC: Paul Bolle <pebolle@tiscali.nl>
      fbeeb822
    • Y
      PCI: Workaround missing pci_set_master in pci drivers · cf3e1feb
      Yinghai Lu 提交于
      Ben Herrenschmidt found that commit 928bea96 ("PCI: Delay enabling
      bridges until they're needed") breaks PCI in some powerpc environments.
      
      The reason is that the PCIe port driver will call pci_enable_device() on
      the bridge, so the device is enabled, but skips pci_set_master because
      pcie_port_auto and no acpi on powerpc.
      
      Because of that, pci_enable_bridge() later on (called as a result of the
      child device driver doing pci_enable_device) will see the bridge as
      already enabled and will not call pci_set_master() on it.
      
      Fixed by add checking in pci_enable_bridge, and call pci_set_master
      if driver skip that.
      
      That will make the code more robot and wade off problem for missing
      pci_set_master in drivers.
      Reported-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cf3e1feb
  9. 30 10月, 2013 1 次提交
  10. 29 9月, 2013 1 次提交
    • Y
      PCI: Workaround missing pci_set_master in pci drivers · f41f064c
      Yinghai Lu 提交于
      Ben Herrenschmidt found that commit 928bea96 ("PCI: Delay enabling
      bridges until they're needed") breaks PCI in some powerpc environments.
      
      The reason is that the PCIe port driver will call pci_enable_device() on
      the bridge, so the device is enabled, but skips pci_set_master because
      pcie_port_auto and no acpi on powerpc.
      
      Because of that, pci_enable_bridge() later on (called as a result of the
      child device driver doing pci_enable_device) will see the bridge as
      already enabled and will not call pci_set_master() on it.
      
      Fixed by add checking in pci_enable_bridge, and call pci_set_master
      if driver skip that.
      
      That will make the code more robot and wade off problem for missing
      pci_set_master in drivers.
      Reported-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f41f064c
  11. 26 9月, 2013 1 次提交
  12. 25 9月, 2013 1 次提交
  13. 28 8月, 2013 1 次提交
  14. 23 8月, 2013 2 次提交
  15. 16 8月, 2013 1 次提交
  16. 15 8月, 2013 5 次提交
    • A
      PCI: Tune secondary bus reset timing · de0c548c
      Alex Williamson 提交于
      The PCI spec indicates that with stable power, reset needs to be
      asserted for a minimum of 1ms (Trst).  We should be able to assume
      stable power for a Hot Reset, but we add another millisecond as
      a fudge factor to make sure the reset is seen on the bus for at least
      a full 1ms.
      
      After reset is de-asserted we must wait for devices to complete
      initialization.  The specs refer to this as "recovery time" (Trhfa).
      For PCI this is 2^25 clock cycles or 2^26 for PCI-X.  For minimum
      bus speeds, both of those come to 1s.  PCIe "softens" this
      requirement with the Configuration Request Retry Status (CRS)
      completion status.  Theoretically we could use CRS to shorten the
      wait time.  We don't make use of that here, using a fixed 1s delay
      to allow devices to re-initialize.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      de0c548c
    • A
      PCI: Wake-up devices before saving config space for reset · a6cbaade
      Alex Williamson 提交于
      Devices come out of reset in D0.  Restoring a device to a different
      post-reset state takes more smarts than our simple config space
      restore, which can leave devices in an inconsistent state.  For
      example, if a device is reset in D3, but the restore doesn't
      successfully return the device to D3, then the actual state of the
      device and dev->current_state are contradictory.  Put everything
      in D0 going into the reset, then we don't need to do anything
      special on the way out.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      a6cbaade
    • A
      PCI: Add pci_reset_slot() and pci_reset_bus() · 090a3c53
      Alex Williamson 提交于
      Sometimes pci_reset_function() is not sufficient.  We have cases where
      devices do not support any kind of reset, but there might be multiple
      functions on the bus preventing pci_reset_function() from doing a
      secondary bus reset.  We also have cases where a device will advertise
      that it supports a PM reset, but really does nothing on D3hot->D0
      (graphics cards are notorious for this).  These devices often also
      have more than one function, so even blacklisting PM reset for them
      wouldn't allow a secondary bus reset through pci_reset_function().
      
      If a driver supports multiple devices it should have the ability to
      induce a bus reset when it needs to.  This patch provides that ability
      through pci_reset_slot() and pci_reset_bus().  It's the caller's
      responsibility when using these interfaces to understand that all of
      the devices in or below the slot (or on or below the bus) will be
      reset and therefore should be under control of the caller.  PCI state
      of all the affected devices is saved and restored around these resets,
      but internal state of all of the affected devices is reset (which
      should be the intention).
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      090a3c53
    • A
      PCI: Split out pci_dev lock/unlock and save/restore · 77cb985a
      Alex Williamson 提交于
      Only cosmetic code changes to existing paths.  Expand the comment in
      the new pci_dev_save_and_disable() function since there's a lot
      hidden in that Command register write.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      77cb985a
    • A
      PCI: Add slot reset option to pci_dev_reset() · 608c3881
      Alex Williamson 提交于
      If the hotplug controller provides a way to reset a slot, use that
      before a direct parent bus reset.  Like the bus reset option, this is
      only available when a single pci_dev occupies the slot.
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      608c3881
  17. 13 8月, 2013 1 次提交
  18. 10 8月, 2013 1 次提交
  19. 02 8月, 2013 1 次提交
  20. 31 7月, 2013 1 次提交
  21. 26 7月, 2013 3 次提交
  22. 27 6月, 2013 1 次提交
  23. 19 6月, 2013 1 次提交
  24. 05 6月, 2013 1 次提交
  25. 29 5月, 2013 1 次提交
  26. 16 4月, 2013 2 次提交