Patchwork qdev: Reset hot-plugged devices

login
register
mail settings
Submitter Jan Kiszka
Date July 24, 2011, 4:52 p.m.
Message ID <4E2C4DE1.6010002@web.de>
Download mbox | patch
Permalink /patch/106524/
State New
Headers show

Comments

Jan Kiszka - July 24, 2011, 4:52 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Device models rely on the core invoking their reset handlers after init.
We do this in the cold-plug case, but so far we miss this step after
hot-plug.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

This is also one piece in the puzzle of getting CPU hot-plug work.

 hw/qdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index a0fcd06..404a91e 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -265,6 +265,9 @@  DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
     qdev->opts = opts;
+    if (qdev->hotplugged && qdev->info->reset) {
+        qdev->info->reset(qdev);
+    }
     return qdev;
 }