linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] pci: bus and slot reset interface
@ 2013-05-08  2:57 Alex Williamson
  2013-05-08  2:57 ` [PATCH v2 1/8] pci: Create pci_reset_bridge_secondary_bus() Alex Williamson
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Alex Williamson @ 2013-05-08  2:57 UTC (permalink / raw)
  To: bhelgaas, linux-pci; +Cc: linux-kernel

v2: Sorry, v1 somehow didn't cc linux-pci.  No code change

We currently support reset of individual functions via the
pci_reset_function() interface.  If a device supports one of the FLR
mechanisms, this works great.  If not, things get a little shady.  We
can do a D3hot->D0 PM reset if the device claims that does a soft
reset, but the definition of a soft reset seems to be left to
interpretation.  We can do a secondary bus reset if the device is
behind a bridge, but this is a function level reset interface, so if
there's anything else on that bus, we're out of luck.  Speaking of out
of luck, guess what happens when we do a secondary bus reset on a port
that supports pciehp surprise removal... we tickle the presence
detection logic and start a hot remove, but the device is locked, so
it doesn't get removed, then it gets added again, but it already
exists... ugh, what a mess.

That seems like an indication that we want to create an interface for
hotplug controllers to participate in a bus reset and prevent such
craziness.  But we don't hotplug a bus, we hotplug a slot.  A bus can
support multiple slots, so depending on the hotplug controller
capabilities, we can potentially do a reset on a slot granularity and
we can avoid spurious hotplug events.  Thus, pci_reset_slot.

We're not always going to have a hotplug controller, in fact pciehp is
the only one I know how to implement a reset_slot interface for (and
it actually has a 1:1 slot:bus interface), so we can try pci_reset_slot
and fall through to pci_reset_bus if needed.

Once we have these we can export them to drivers, because sometimes
those shady parts of pci_reset_function just aren't good enough and we
understand that a reset can affect multiple devices.  VFIO is a driver
that can take advantage of such an interface.  A VFIO user can be in
control of multiple devices.  If they control all of the devices on a
bus or a slot, a bus or slot reset mechanism should be available.
Where we particularly need this is for exposing VGA devices to
userspace.  These fall into the shady area where they claim to support
a PM function reset, but it doesn't actually do anything.  They're
also often not alone on the bus as they support a separate function
for the audio controller.  With this series we can expose a bus reset
interface and get repeatability.

Comments welcome.  Thanks,
Alex

---

Alex Williamson (8):
      pci: Create pci_reset_bridge_secondary_bus()
      pci: Add hotplug_slot_ops.reset_slot()
      pci: Add pci_hp_reset_slot
      pci: Implement reset_slot for pciehp
      pci: Add reset_slot option to pci_dev_reset
      pci: Split out pci_dev lock/unlock and save/restore
      pci: Add slot and bus reset interfaces
      pci: Wake-up devices before save for reset


 drivers/pci/hotplug/pci_hotplug_core.c |   24 ++
 drivers/pci/hotplug/pciehp.h           |    1 
 drivers/pci/hotplug/pciehp_core.c      |   12 +
 drivers/pci/hotplug/pciehp_hpc.c       |   31 +++
 drivers/pci/pci.c                      |  313 +++++++++++++++++++++++++++++---
 include/linux/pci.h                    |    3 
 include/linux/pci_hotplug.h            |   12 +
 7 files changed, 370 insertions(+), 26 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-05-10 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08  2:57 [PATCH v2 0/8] pci: bus and slot reset interface Alex Williamson
2013-05-08  2:57 ` [PATCH v2 1/8] pci: Create pci_reset_bridge_secondary_bus() Alex Williamson
2013-05-08 19:14   ` Don Dutile
2013-05-08 19:30     ` Alex Williamson
2013-05-08  2:57 ` [PATCH v2 2/8] pci: Add hotplug_slot_ops.reset_slot() Alex Williamson
2013-05-08  2:57 ` [PATCH v2 3/8] pci: Add pci_hp_reset_slot Alex Williamson
2013-05-10 21:46   ` Alex Williamson
2013-05-08  2:58 ` [PATCH v2 4/8] pci: Implement reset_slot for pciehp Alex Williamson
2013-05-08  2:58 ` [PATCH v2 5/8] pci: Add reset_slot option to pci_dev_reset Alex Williamson
2013-05-08  2:58 ` [PATCH v2 6/8] pci: Split out pci_dev lock/unlock and save/restore Alex Williamson
2013-05-08  2:58 ` [PATCH v2 7/8] pci: Add slot and bus reset interfaces Alex Williamson
2013-05-08  2:58 ` [PATCH v2 8/8] pci: Wake-up devices before save for reset Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).