qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v4 08/12] qdev: Add memory hot unplug support for bu


From: Tang Chen
Subject: [Qemu-devel] [PATCH v4 08/12] qdev: Add memory hot unplug support for bus-less devices.
Date: Thu, 16 Oct 2014 12:44:22 +0800

From: Hu Tao <address@hidden>

Implement bus-less device hot-remove in qdev_unplug().
For now, only pc-dimm is bus-less device, but this is generic handling
that applies to other devices.

Signed-off-by: Hu Tao <address@hidden>
Signed-off-by: Tang Chen <address@hidden>
---
 hw/core/qdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fcb1638..01d89a8 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -228,6 +228,14 @@ void qdev_unplug(DeviceState *dev, Error **errp)
 
     if (dev->parent_bus && dev->parent_bus->hotplug_handler) {
         hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp);
+    } else if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
+        HotplugHandler *hotplug_ctrl;
+        MachineState *machine = MACHINE(qdev_get_machine());
+        MachineClass *mc = MACHINE_GET_CLASS(machine);
+
+        hotplug_ctrl = mc->get_hotplug_handler(machine, dev);
+        if (hotplug_ctrl)
+            hotplug_handler_unplug(hotplug_ctrl, dev, errp);
     } else {
         assert(dc->unplug != NULL);
         if (dc->unplug(dev) < 0) { /* legacy handler */
-- 
1.8.4.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]