]> git.proxmox.com Git - mirror_qemu.git/commit - hw/ppc/spapr_pci.c
spapr: Use unplug_request for PCI hot unplug
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 3 Jul 2017 06:34:28 +0000 (16:34 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 11 Jul 2017 01:04:02 +0000 (11:04 +1000)
commit3340e5c4f28363348a0b3654624ff72ed14aa7cf
treeecd295c2b30c3e3e122c1170f44f70366259bc03
parent5c1da81215c7f4f010fbc0c146945a6f182e5586
spapr: Use unplug_request for PCI hot unplug

AIUI, ->unplug_request in the HotplugHandler is used for "soft"
unplug, where acknowledgement from the guest is required before
completing the unplug, whereas ->unplug is used for "hard" unplug
where qemu unilaterally removes the device, and the guest just has to
cope with its sudden absence.  For spapr we (correctly) use
->unplug_request for CPU and memory hot unplug but we use ->unplug for
PCI.

While I think it might be possible to support "hard" PCI unplug within
the PAPR model, that's not how it actually works now.  Although it's
called from ->unplug, the PCI unplug path will usually just mark the
device for removal, with completion of the unplug delayed until
userspace responds to the unplug notification. If the guest doesn't
respond as expected, that could delay the unplug completion arbitrarily
long.

To reflect that, change the PCI unplug path to be called from
->unplug_request.  We also rename spapr_phb_hot_plug_child() and
spapr_phb_hot_unplug_child() to spapr_pci_plug() and
spapr_pci_unplug_request() to more obviously reflect the callbacks they're
implementing.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
hw/ppc/spapr_pci.c