aboutsummaryrefslogtreecommitdiff
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
authorDamien Hedde <damien.hedde@greensocs.com>2020-01-30 16:02:03 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-01-30 16:02:03 +0000
commit70804c83f2914acaca74c1789a6b869bd5d1ea67 (patch)
tree226ed71ebdbbd302f7fd66b98a49fb32b4df2d7e /hw/core/qdev.c
parentf703a04ce558ac3c7c0587a2d919c39efb8ca3ba (diff)
hw/core/qdev: add trace events to help with resettable transition
Adds trace events to reset procedure and when updating the parent bus of a device. Signed-off-by: Damien Hedde <damien.hedde@greensocs.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200123132823.1117486-3-damien.hedde@greensocs.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r--hw/core/qdev.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 00230eecb7..29e8c6b8df 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -38,6 +38,7 @@
#include "hw/boards.h"
#include "hw/sysbus.h"
#include "migration/vmstate.h"
+#include "trace.h"
bool qdev_hotplug = false;
static bool qdev_hot_added = false;
@@ -98,7 +99,11 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
bool replugging = dev->parent_bus != NULL;
if (replugging) {
- /* Keep a reference to the device while it's not plugged into
+ trace_qdev_update_parent_bus(dev, object_get_typename(OBJECT(dev)),
+ dev->parent_bus, object_get_typename(OBJECT(dev->parent_bus)),
+ OBJECT(bus), object_get_typename(OBJECT(bus)));
+ /*
+ * Keep a reference to the device while it's not plugged into
* any bus, to avoid it potentially evaporating when it is
* dereffed in bus_remove_child().
*/
@@ -296,6 +301,18 @@ HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
return hotplug_ctrl;
}
+static int qdev_prereset(DeviceState *dev, void *opaque)
+{
+ trace_qdev_reset_tree(dev, object_get_typename(OBJECT(dev)));
+ return 0;
+}
+
+static int qbus_prereset(BusState *bus, void *opaque)
+{
+ trace_qbus_reset_tree(bus, object_get_typename(OBJECT(bus)));
+ return 0;
+}
+
static int qdev_reset_one(DeviceState *dev, void *opaque)
{
device_legacy_reset(dev);
@@ -306,6 +323,7 @@ static int qdev_reset_one(DeviceState *dev, void *opaque)
static int qbus_reset_one(BusState *bus, void *opaque)
{
BusClass *bc = BUS_GET_CLASS(bus);
+ trace_qbus_reset(bus, object_get_typename(OBJECT(bus)));
if (bc->reset) {
bc->reset(bus);
}
@@ -314,7 +332,9 @@ static int qbus_reset_one(BusState *bus, void *opaque)
void qdev_reset_all(DeviceState *dev)
{
- qdev_walk_children(dev, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
+ trace_qdev_reset_all(dev, object_get_typename(OBJECT(dev)));
+ qdev_walk_children(dev, qdev_prereset, qbus_prereset,
+ qdev_reset_one, qbus_reset_one, NULL);
}
void qdev_reset_all_fn(void *opaque)
@@ -324,7 +344,9 @@ void qdev_reset_all_fn(void *opaque)
void qbus_reset_all(BusState *bus)
{
- qbus_walk_children(bus, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
+ trace_qbus_reset_all(bus, object_get_typename(OBJECT(bus)));
+ qbus_walk_children(bus, qdev_prereset, qbus_prereset,
+ qdev_reset_one, qbus_reset_one, NULL);
}
void qbus_reset_all_fn(void *opaque)
@@ -1105,6 +1127,7 @@ void device_legacy_reset(DeviceState *dev)
{
DeviceClass *klass = DEVICE_GET_CLASS(dev);
+ trace_qdev_reset(dev, object_get_typename(OBJECT(dev)));
if (klass->reset) {
klass->reset(dev);
}