[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 10/17] spapr: Use unplug_request for PCI hot unplug
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 10/17] spapr: Use unplug_request for PCI hot unplug |
Date: |
Tue, 11 Jul 2017 14:39:10 +1000 |
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 <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
---
hw/ppc/spapr_pci.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 49c8db8..cc1588d 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1388,8 +1388,8 @@ static uint32_t spapr_phb_get_pci_drc_index(sPAPRPHBState
*phb,
return spapr_drc_index(drc);
}
-static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,
- DeviceState *plugged_dev, Error **errp)
+static void spapr_pci_plug(HotplugHandler *plug_handler,
+ DeviceState *plugged_dev, Error **errp)
{
sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(DEVICE(plug_handler));
PCIDevice *pdev = PCI_DEVICE(plugged_dev);
@@ -1469,8 +1469,8 @@ out:
}
}
-static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
- DeviceState *plugged_dev, Error **errp)
+static void spapr_pci_unplug_request(HotplugHandler *plug_handler,
+ DeviceState *plugged_dev, Error **errp)
{
sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(DEVICE(plug_handler));
PCIDevice *pdev = PCI_DEVICE(plugged_dev);
@@ -1485,6 +1485,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler
*plug_handler,
}
g_assert(drc);
+ g_assert(drc->dev == plugged_dev);
drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
if (!drck->release_pending(drc)) {
@@ -1972,8 +1973,8 @@ static void spapr_phb_class_init(ObjectClass *klass, void
*data)
/* Supported by TYPE_SPAPR_MACHINE */
dc->user_creatable = true;
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
- hp->plug = spapr_phb_hot_plug_child;
- hp->unplug = spapr_phb_hot_unplug_child;
+ hp->plug = spapr_pci_plug;
+ hp->unplug_request = spapr_pci_unplug_request;
}
static const TypeInfo spapr_phb_info = {
--
2.9.4
- [Qemu-ppc] [PULL 00/17] ppc-for-2.10 queue 20170711, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 01/17] spapr: make spapr_populate_hotplug_cpu_dt() static, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 03/17] spapr: fix bogus function name in comment, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 12/17] target/ppc: Add debug function for radix mmu translation, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 11/17] target/ppc: Refactor tcg radix mmu code, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 07/17] spapr: Uniform DRC reset paths, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 14/17] spapr: Only report host/guest IOMMU page size mismatches on KVM, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 17/17] spapr: populate device tree depending on XIVE_EXPLOIT option, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 13/17] spapr: fix memory hotplug error path, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 10/17] spapr: Use unplug_request for PCI hot unplug,
David Gibson <=
- [Qemu-ppc] [PULL 09/17] spapr: Remove unnecessary differences between hotplug and coldplug paths, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 16/17] spapr: introduce the XIVE_EXPLOIT option in CAS, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 15/17] ppc/kvm: have the "family" CPU alias to point to TYPE_HOST_POWERPC_CPU, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 02/17] spapr: refresh "platform-specific" hcalls comment, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 04/17] spapr: fix migration to pseries machine < 2.8, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 06/17] spapr: Leave DR-indicator management to the guest, David Gibson, 2017/07/11
- [Qemu-ppc] [PULL 08/17] spapr: Add DRC release method, David Gibson, 2017/07/11