]> git.proxmox.com Git - mirror_qemu.git/commit
spapr_drc: enable immediate detach for unsignalled devices
authorMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 31 Mar 2016 22:27:37 +0000 (17:27 -0500)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 5 Apr 2016 00:47:03 +0000 (10:47 +1000)
commitf40eb921da78d7524f4d1d96a5c04c77c4a26a28
tree905906937c94d736658a23b848f954bc743d1a94
parent5c94b2a5e5ef7f91270ce034d2095c6ed924c61d
spapr_drc: enable immediate detach for unsignalled devices

Currently spapr doesn't support "aborting" hotplug of PCI
devices by allowing device_del to immediately remove the
device if we haven't signalled the presence of the device
to the guest.

In the past this wasn't an issue, since we always immediately
signalled device attach and simply relied on full guest-aware
add->remove path for device removal. However, as of 788d259,
we now defer signalling for PCI functions until function 0
is attached, so now we need to deal with these "abort" operations
for cases where a user hotplugs a non-0 function, then opts to
remove it prior hotplugging function 0. Currently they'd have to
reboot before the unplug completed. PCIe multifunction hotplug
does not have this requirement however, so from a management
implementation perspective it would be good to address this within
the same release as 788d259.

We accomplish this by simply adding a 'signalled' flag to track
whether a device hotplug event has been sent to the guest. If it
hasn't, we allow immediate removal under the assumption that the
guest will not be using the device. Devices present at boot/reset
time are also assumed to be 'signalled'.

For CPU/memory/etc, signalling will still happen immediately
as part of device_add, so only PCI functions should be affected.

Cc: bharata@linux.vnet.ibm.com
Cc: david@gibson.dropbear.id.au
Cc: sbhat@linux.vnet.ibm.com
Cc: qemu-ppc@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
[dwg: This fixes a regression where an incorrect hot-add of a non-zero
      function can no longer be backed out until function 0 is added]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_drc.c
hw/ppc/spapr_events.c
include/hw/ppc/spapr_drc.h