[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] hw/ppc/prep_systemio: Set IOMap IRQ in ResetExit() handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 2/2] hw/ppc/prep_systemio: Set IOMap IRQ in ResetExit() handler |
Date: |
Fri, 10 Jan 2025 18:32:17 +0100 |
Since the IOMap output IRQ is created in prep_systemio_realize(),
it can not yet be wired before the device is realized, thus
it is not reset properly. Fix by moving the qemu_set_irq() call
in the ResetExit handler.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ppc/prep_systemio.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
index 7cbf7e4eecd..87f412891e2 100644
--- a/hw/ppc/prep_systemio.c
+++ b/hw/ppc/prep_systemio.c
@@ -260,8 +260,6 @@ static void prep_systemio_realize(DeviceState *dev, Error
**errp)
qdev_init_gpio_out(dev, &s->non_contiguous_io_map_irq, 1);
s->iomap_type = PORT0850_IOMAP_NONCONTIGUOUS;
- qemu_set_irq(s->non_contiguous_io_map_irq,
- s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS);
s->softreset_irq = qdev_get_gpio_in(DEVICE(s->cpu), PPC6xx_INPUT_HRESET);
isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s,
@@ -273,6 +271,14 @@ static void prep_systemio_realize(DeviceState *dev, Error
**errp)
&s->ppc_parity_mem);
}
+static void prep_systemio_reset_exit(Object *obj, ResetType type)
+{
+ PrepSystemIoState *s = PREP_SYSTEMIO(obj);
+
+ qemu_set_irq(s->non_contiguous_io_map_irq,
+ s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS);
+}
+
static const VMStateDescription vmstate_prep_systemio = {
.name = "prep_systemio",
.version_id = 1,
@@ -295,10 +301,12 @@ static const Property prep_systemio_properties[] = {
static void prep_systemio_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->realize = prep_systemio_realize;
dc->vmsd = &vmstate_prep_systemio;
device_class_set_props(dc, prep_systemio_properties);
+ rc->phases.exit = prep_systemio_reset_exit;
}
static const TypeInfo prep_systemio800_info = {
--
2.47.1