[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 09/13] spapr: ensure device trees are always associated
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 09/13] spapr: ensure device trees are always associated with DRC |
Date: |
Fri, 27 May 2016 13:04:54 +1000 |
From: Jianjun Duan <address@hidden>
There are possible racing situations involving hotplug events and
guest migration. For cases where a hotplug event is migrated, or
the guest is in the process of fetching device tree at the time of
migration, we need to ensure the device tree is created and
associated with the corresponding DRC for devices that were
hotplugged on the source, but 'coldplugged' on the target.
Signed-off-by: Jianjun Duan <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr.c | 16 ++++++----------
hw/ppc/spapr_pci.c | 12 +++++-------
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 3b0845f..44e401a 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2136,15 +2136,6 @@ static void spapr_add_lmbs(DeviceState *dev, uint64_t
addr, uint64_t size,
int i, fdt_offset, fdt_size;
void *fdt;
- /*
- * Check for DRC connectors and send hotplug notification to the
- * guest only in case of hotplugged memory. This allows cold plugged
- * memory to be specified at boot time.
- */
- if (!dev->hotplugged) {
- return;
- }
-
for (i = 0; i < nr_lmbs; i++) {
drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_LMB,
addr/SPAPR_MEMORY_BLOCK_SIZE);
@@ -2158,7 +2149,12 @@ static void spapr_add_lmbs(DeviceState *dev, uint64_t
addr, uint64_t size,
drck->attach(drc, dev, fdt, fdt_offset, !dev->hotplugged, errp);
addr += SPAPR_MEMORY_BLOCK_SIZE;
}
- spapr_hotplug_req_add_by_count(SPAPR_DR_CONNECTOR_TYPE_LMB, nr_lmbs);
+ /* send hotplug notification to the
+ * guest only in case of hotplugged memory
+ */
+ if (dev->hotplugged) {
+ spapr_hotplug_req_add_by_count(SPAPR_DR_CONNECTOR_TYPE_LMB, nr_lmbs);
+ }
}
static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index e55b505..91a356f 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1093,13 +1093,11 @@ static void spapr_phb_add_pci_device(sPAPRDRConnector
*drc,
spapr_tce_set_need_vfio(tcet, true);
}
- if (dev->hotplugged) {
- fdt = create_device_tree(&fdt_size);
- fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0);
- if (!fdt_start_offset) {
- error_setg(errp, "Failed to create pci child device tree node");
- goto out;
- }
+ fdt = create_device_tree(&fdt_size);
+ fdt_start_offset = spapr_create_pci_child_dt(phb, pdev, fdt, 0);
+ if (!fdt_start_offset) {
+ error_setg(errp, "Failed to create pci child device tree node");
+ goto out;
}
drck->attach(drc, DEVICE(pdev),
--
2.5.5
- [Qemu-ppc] [PULL 00/13] ppc-for-2.7 queue 20160527, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 02/13] target-ppc: Use movcond in isel, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 07/13] Added negative check for get_image_size(), David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 13/13] MAINTAINERS: Add David Gibson as ppc maintainer, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 04/13] target-ppc: Cleanups to rldinm, rldnm, rldimi, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 03/13] target-ppc: Use 32-bit rotate instead of deposit + 64-bit rotate, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 12/13] spapr_iommu: Move table allocation to helpers, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 06/13] hw/net/spapr_llan: Provide counter with dropped rx frames to the guest, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 09/13] spapr: ensure device trees are always associated with DRC,
David Gibson <=
- [Qemu-ppc] [PULL 01/13] target-ppc: Correct KVM synchronization for ppc_hash64_set_external_hpt(), David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 08/13] PPC/KVM: early validation of vcpu id, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 11/13] spapr_iommu: Finish renaming vfio_accel to need_vfio, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 05/13] hw/net/spapr_llan: Delay flushing of the RX queue while adding new RX buffers, David Gibson, 2016/05/26
- [Qemu-ppc] [PULL 10/13] spapr_pci: Use correct DMA LIOBN when composing the device tree, David Gibson, 2016/05/26
- Re: [Qemu-ppc] [PULL 00/13] ppc-for-2.7 queue 20160527, Peter Maydell, 2016/05/27