Skip to contentSkip to conversation

qdev: Reset hot-plugged devices

PATCH Superseded Jan Kiszka 2 participants 3 messages Jul 24, 2011 – Jul 29, 2011

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qdev: Reset hot-plugged devices

From: Jan Kiszka <[email protected]>

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.

---

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(-)
hw/qdev.c +3 -0
index a0fcd06..404a91e 100644
@@ -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;
 }
 
Signature · 1 line
1.7.3.4
author
#1 lore raw

PATCH v2 1/1 qdev: Reset hot-plugged devices

From: Jan Kiszka <[email protected]>

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.

---

Changes in v2:
- move reset to qdev_init in case the device is created by the hot-plugged one (composed devices)

 hw/qdev.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/qdev.c +3 -0
index a0fcd06..b4ea8e1 100644
@@ -289,6 +289,9 @@ int qdev_init(DeviceState *dev)
                                        dev->alias_required_for_version);
     }
     dev->state = DEV_STATE_INITIALIZED;
+    if (dev->hotplugged && dev->info->reset) {
+        dev->info->reset(dev);
+    }
     return 0;
 }
 
Signature · 1 line
1.7.3.4
#2 lore raw
Quoted 7 lines · Jan Kiszka

From: Jan Kiszka<[email protected]>

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.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 23 lines

---

Changes in v2:
- move reset to qdev_init in case the device is created by the hot-plugged one (composed devices)

  hw/qdev.c |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
hw/qdev.c +3 -0
index a0fcd06..b4ea8e1 100644
@@ -289,6 +289,9 @@ int qdev_init(DeviceState *dev)
                                         dev->alias_required_for_version);
      }
      dev->state = DEV_STATE_INITIALIZED;
+    if (dev->hotplugged&&  dev->info->reset) {
+        dev->info->reset(dev);
+    }
      return 0;
  }