[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH] hw/timer/mc146818rtc: Fix introspection problem
From: |
Thomas Huth |
Subject: |
[Qemu-ppc] [PATCH] hw/timer/mc146818rtc: Fix introspection problem |
Date: |
Thu, 19 Jul 2018 16:23:23 +0200 |
There is currently a funny problem with the "mc146818rtc" device:
1) Start QEMU like this:
qemu-system-ppc64 -M pseries -S
2) At the HMP monitor, enter "info qom-tree". Note that there is an
entry for "/rtc (spapr-rtc)".
3) Introspect the mc146818rtc device like this:
device_add mc146818rtc,help
4) Run "info qom-tree" again. The "/rtc" entry is gone now!
The rtc_finalize() function of the mc146818rtc device has two bugs: First,
it tries to remove a "rtc" property, while the rtc_realizefn() added a
"rtc-time" property instead. And second, it should be done in an unrealize
function, not in a finalize function, to avoid that this causes problems
during introspection.
Fixes: 654a36d857ff949e0d1989904b76f53fded9dc83
Signed-off-by: Thomas Huth <address@hidden>
---
hw/timer/mc146818rtc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 6f1f723..c0c6a72 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -1001,6 +1001,11 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
qdev_init_gpio_out(dev, &s->irq, 1);
}
+static void rtc_unrealize(DeviceState *dev, Error **errp)
+{
+ object_property_del(qdev_get_machine(), "rtc-time", errp);
+}
+
ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq
intercept_irq)
{
DeviceState *dev;
@@ -1045,6 +1050,7 @@ static void rtc_class_initfn(ObjectClass *klass, void
*data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = rtc_realizefn;
+ dc->unrealize = rtc_unrealize;
dc->reset = rtc_resetdev;
dc->vmsd = &vmstate_rtc;
dc->props = mc146818rtc_properties;
@@ -1052,17 +1058,11 @@ static void rtc_class_initfn(ObjectClass *klass, void
*data)
dc->user_creatable = false;
}
-static void rtc_finalize(Object *obj)
-{
- object_property_del(qdev_get_machine(), "rtc", NULL);
-}
-
static const TypeInfo mc146818rtc_info = {
.name = TYPE_MC146818_RTC,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(RTCState),
.class_init = rtc_class_initfn,
- .instance_finalize = rtc_finalize,
};
static void mc146818rtc_register_types(void)
--
1.8.3.1
- [Qemu-ppc] [PATCH] hw/timer/mc146818rtc: Fix introspection problem,
Thomas Huth <=