diff mbox series

[v4,07/12] hw/sh4/r2d: Realize IDE controller before accessing it

Message ID 20240213130341.1793-8-philmd@linaro.org
State Superseded
Headers show
Series hw: Strengthen SysBus & QBus API | expand

Commit Message

Philippe Mathieu-Daudé Feb. 13, 2024, 1:03 p.m. UTC
We should not wire IRQs on unrealized device.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 hw/sh4/r2d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev Oct. 22, 2024, 2:53 p.m. UTC | #1
On 13.02.2024 16:03, Philippe Mathieu-Daudé wrote:
> We should not wire IRQs on unrealized device.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> ---
>   hw/sh4/r2d.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
> index e9f316a6ce..c73e8f49b8 100644
> --- a/hw/sh4/r2d.c
> +++ b/hw/sh4/r2d.c
> @@ -285,9 +285,9 @@ static void r2d_init(MachineState *machine)
>       dinfo = drive_get(IF_IDE, 0, 0);
>       dev = qdev_new("mmio-ide");
>       busdev = SYS_BUS_DEVICE(dev);
> -    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
>       qdev_prop_set_uint32(dev, "shift", 1);
>       sysbus_realize_and_unref(busdev, &error_fatal);
> +    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
>       sysbus_mmio_map(busdev, 0, 0x14001000);
>       sysbus_mmio_map(busdev, 1, 0x1400080c);
>       mmio_ide_init_drives(dev, dinfo, NULL);

Should we pick this up for stable-9.0 & -9.1 series?

Thanks,

/mjt
Bernhard Beschow Oct. 22, 2024, 6:52 p.m. UTC | #2
Am 22. Oktober 2024 14:53:31 UTC schrieb Michael Tokarev <mjt@tls.msk.ru>:
>On 13.02.2024 16:03, Philippe Mathieu-Daudé wrote:
>> We should not wire IRQs on unrealized device.
>> 
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>> Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
>> ---
>>   hw/sh4/r2d.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
>> index e9f316a6ce..c73e8f49b8 100644
>> --- a/hw/sh4/r2d.c
>> +++ b/hw/sh4/r2d.c
>> @@ -285,9 +285,9 @@ static void r2d_init(MachineState *machine)
>>       dinfo = drive_get(IF_IDE, 0, 0);
>>       dev = qdev_new("mmio-ide");
>>       busdev = SYS_BUS_DEVICE(dev);
>> -    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
>>       qdev_prop_set_uint32(dev, "shift", 1);
>>       sysbus_realize_and_unref(busdev, &error_fatal);
>> +    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
>>       sysbus_mmio_map(busdev, 0, 0x14001000);
>>       sysbus_mmio_map(busdev, 1, 0x1400080c);
>>       mmio_ide_init_drives(dev, dinfo, NULL);
>
>Should we pick this up for stable-9.0 & -9.1 series?

IMO yes, because it fixes a regression.

Best regards,
Bernhard

>
>Thanks,
>
>/mjt
diff mbox series

Patch

diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index e9f316a6ce..c73e8f49b8 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -285,9 +285,9 @@  static void r2d_init(MachineState *machine)
     dinfo = drive_get(IF_IDE, 0, 0);
     dev = qdev_new("mmio-ide");
     busdev = SYS_BUS_DEVICE(dev);
-    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
     qdev_prop_set_uint32(dev, "shift", 1);
     sysbus_realize_and_unref(busdev, &error_fatal);
+    sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
     sysbus_mmio_map(busdev, 0, 0x14001000);
     sysbus_mmio_map(busdev, 1, 0x1400080c);
     mmio_ide_init_drives(dev, dinfo, NULL);