mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
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 of788d259
, 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 as788d259
. 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>
This commit is contained in:
parent
5c94b2a5e5
commit
f40eb921da
3 changed files with 47 additions and 0 deletions
|
@ -151,6 +151,7 @@ typedef struct sPAPRDRConnector {
|
|||
bool configured;
|
||||
|
||||
bool awaiting_release;
|
||||
bool signalled;
|
||||
|
||||
/* device pointer, via link property */
|
||||
DeviceState *dev;
|
||||
|
@ -188,6 +189,7 @@ typedef struct sPAPRDRConnectorClass {
|
|||
spapr_drc_detach_cb *detach_cb,
|
||||
void *detach_cb_opaque, Error **errp);
|
||||
bool (*release_pending)(sPAPRDRConnector *drc);
|
||||
void (*set_signalled)(sPAPRDRConnector *drc);
|
||||
} sPAPRDRConnectorClass;
|
||||
|
||||
sPAPRDRConnector *spapr_dr_connector_new(Object *owner,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue