diff mbox series

[v3,07/11] hw/sh4/r2d: Realize IDE controller before accessing it

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

Commit Message

Philippe Mathieu-Daudé Feb. 8, 2024, 6:12 p.m. UTC
We should not wire IRQs on unrealized device.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sh4/r2d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell Feb. 9, 2024, 11:30 a.m. UTC | #1
On Thu, 8 Feb 2024 at 18:14, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> We should not wire IRQs on unrealized device.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  hw/sh4/r2d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Yoshinori Sato Feb. 12, 2024, 12:48 p.m. UTC | #2
On Fri, 09 Feb 2024 03:12:40 +0900,
Philippe Mathieu-Daudé wrote:
> 
> We should not wire IRQs on unrealized device.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  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);
> -- 
> 2.41.0
> 

Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Guenter Roeck May 3, 2024, 9:34 p.m. UTC | #3
Hi,

On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>

qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
and sh4eb emulations. Error log is as follows.

ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
ata1.00: 16384 sectors, multi 16: LBA48
ata1.00: configured for PIO
scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
ata1: lost interrupt (Status 0x58)

[ and more similar errors ]

qemu command line:

qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
	-snapshot -drive file=rootfs.ext2,format=raw,if=ide \
	-append "root=/dev/sda console=ttySC1,115200 noiotrap" \
	-serial null -serial stdio -monitor null -nographic -no-reboot

Bisect points to this patch (see below). Reverting it fixes the problem.

Guenter

---
bisect log:

# bad: [c25df57ae8f9fe1c72eee2dab37d76d904ac382e] Update version for 9.0.0 release
# good: [1600b9f46b1bd08b00fe86c46ef6dbb48cbe10d6] Update version for v8.2.0 release
git bisect start 'v9.0.0' 'v8.2.0'
# good: [62357c047a5abc6ede992159ed7c0aaaeb50617a] Merge tag 'qemu-sparc-20240213' of https://github.com/mcayland/qemu into staging
git bisect good 62357c047a5abc6ede992159ed7c0aaaeb50617a
# bad: [d65f1ed7de1559534d0a1fabca5bdd81c594c7ca] docs/acpi/bits: add some clarity and details while also improving formating
git bisect bad d65f1ed7de1559534d0a1fabca5bdd81c594c7ca
# bad: [99e1c1137b6f339be1e4b76e243ad7b7c3d3cb8c] hw/i386/pc: Populate RTC attribute directly
git bisect bad 99e1c1137b6f339be1e4b76e243ad7b7c3d3cb8c
# bad: [760b4dcdddba4a40b9fa0eb78fdfc7eda7cb83d0] Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
git bisect bad 760b4dcdddba4a40b9fa0eb78fdfc7eda7cb83d0
# good: [f2b4a98930c122648e9dc494e49cea5dffbcc2be] target/arm: Allow access to SPSR_hyp from hyp mode
git bisect good f2b4a98930c122648e9dc494e49cea5dffbcc2be
# bad: [1a8e2f58c5dd721086284f827326b370d19ad9eb] hw/i386/q35: Use DEVICE() cast macro with PCIDevice object
git bisect bad 1a8e2f58c5dd721086284f827326b370d19ad9eb
# good: [59ae6bcddc3651b55b96c2bf05a6cd4312e46d10] hw/ppc/prep: Realize ISA bridge before accessing it
git bisect good 59ae6bcddc3651b55b96c2bf05a6cd4312e46d10
# bad: [7ed9a5f626a6c932a8c869a91e6a8b3e2029f5ef] hw/intc/grlib_irqmp: implements the multiprocessor status register
git bisect bad 7ed9a5f626a6c932a8c869a91e6a8b3e2029f5ef
# bad: [d08b7af3f7f27f6f3da8446756bf0b9352026b1d] target/sparc: Provide hint about CPUSPARCState::irq_manager member
git bisect bad d08b7af3f7f27f6f3da8446756bf0b9352026b1d
# bad: [5e37bc4997c32a1c9a6621a060462c84df9f1b8f] hw/dma: Pass parent object to i8257_dma_init()
git bisect bad 5e37bc4997c32a1c9a6621a060462c84df9f1b8f
# bad: [3c5f86a22686ef475a8259c0d8ee714f61c770c9] hw/sh4/r2d: Realize IDE controller before accessing it
git bisect bad 3c5f86a22686ef475a8259c0d8ee714f61c770c9
# good: [fc432ba0f58343c8912b80e9056315bb9bd8df92] hw/misc/macio: Realize IDE controller before accessing it
git bisect good fc432ba0f58343c8912b80e9056315bb9bd8df92
# first bad commit: [3c5f86a22686ef475a8259c0d8ee714f61c770c9] hw/sh4/r2d: Realize IDE controller before accessing it
Thomas Huth Oct. 11, 2024, 8:23 a.m. UTC | #4
On 03/05/2024 23.34, Guenter Roeck wrote:
> Hi,
> 
> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
> 
> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
> and sh4eb emulations. Error log is as follows.
> 
> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
> ata1.00: 16384 sectors, multi 16: LBA48
> ata1.00: configured for PIO
> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
> sd 0:0:0:0: [sda] Write Protect is off
> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> ata1: lost interrupt (Status 0x58)
> 
> [ and more similar errors ]
> 
> qemu command line:
> 
> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
> 	-snapshot -drive file=rootfs.ext2,format=raw,if=ide \
> 	-append "root=/dev/sda console=ttySC1,115200 noiotrap" \
> 	-serial null -serial stdio -monitor null -nographic -no-reboot
> 
> Bisect points to this patch (see below). Reverting it fixes the problem.

  Hi Philippe!

Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py is 
failing (which is not run by default, that's why nobody noticed), and 
bisection took me to the same result that Guenter already reported.

So unless you have a clue how to fix it in a better way, I think we should 
revert this patch?

  Thomas
Philippe Mathieu-Daudé Oct. 11, 2024, 10:48 p.m. UTC | #5
On 11/10/24 05:23, Thomas Huth wrote:
> On 03/05/2024 23.34, Guenter Roeck wrote:
>> Hi,
>>
>> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
>>
>> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
>> and sh4eb emulations. Error log is as follows.
>>
>> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
>> ata1.00: 16384 sectors, multi 16: LBA48
>> ata1.00: configured for PIO
>> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 
>> ANSI: 5
>> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
>> sd 0:0:0:0: [sda] Write Protect is off
>> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't 
>> support DPO or FUA
>> ata1: lost interrupt (Status 0x58)
>>
>> [ and more similar errors ]
>>
>> qemu command line:
>>
>> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
>>     -snapshot -drive file=rootfs.ext2,format=raw,if=ide \
>>     -append "root=/dev/sda console=ttySC1,115200 noiotrap" \
>>     -serial null -serial stdio -monitor null -nographic -no-reboot
>>
>> Bisect points to this patch (see below). Reverting it fixes the problem.

Sorry Guenter for missing your email :(

> 
>   Hi Philippe!
> 
> Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py 
> is failing (which is not run by default, that's why nobody noticed), and 
> bisection took me to the same result that Guenter already reported.

"not run by default" because flaky.

Having a quick look, the problem seems hw/ide/core.c uses non-QOM
shortcuts. In particular ide_bus_init_output_irq() expects a preset
IRQ. Not something trivial to fix.

> 
> So unless you have a clue how to fix it in a better way, I think we 
> should revert this patch?

This patch is what we want long term, and reveals a long standing issue.
I'm not objecting in reverting it short term (I doubt I'll have time to
look at it right now).

Regards,

Phil.
Thomas Huth Oct. 12, 2024, 9:40 a.m. UTC | #6
On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote:
> On 11/10/24 05:23, Thomas Huth wrote:
>> On 03/05/2024 23.34, Guenter Roeck wrote:
>>> Hi,
>>>
>>> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
>>>
>>> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
>>> and sh4eb emulations. Error log is as follows.
>>>
>>> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
>>> ata1.00: 16384 sectors, multi 16: LBA48
>>> ata1.00: configured for PIO
>>> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
>>> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
>>> sd 0:0:0:0: [sda] Write Protect is off
>>> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't 
>>> support DPO or FUA
>>> ata1: lost interrupt (Status 0x58)
>>>
>>> [ and more similar errors ]
>>>
>>> qemu command line:
>>>
>>> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
>>>     -snapshot -drive file=rootfs.ext2,format=raw,if=ide \
>>>     -append "root=/dev/sda console=ttySC1,115200 noiotrap" \
>>>     -serial null -serial stdio -monitor null -nographic -no-reboot
>>>
>>> Bisect points to this patch (see below). Reverting it fixes the problem.
> 
> Sorry Guenter for missing your email :(
> 
>>
>>   Hi Philippe!
>>
>> Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py 
>> is failing (which is not run by default, that's why nobody noticed), and 
>> bisection took me to the same result that Guenter already reported.
> 
> "not run by default" because flaky.
> 
> Having a quick look, the problem seems hw/ide/core.c uses non-QOM
> shortcuts. In particular ide_bus_init_output_irq() expects a preset
> IRQ. Not something trivial to fix.

I wonder whether the other spots that use ide_bus_init_output_irq() or 
similar constructs are broken now, too. Bernhard apparently already fixed 
(reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf.

But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ?

  Thomas
Bernhard Beschow Oct. 12, 2024, 2:06 p.m. UTC | #7
Am 12. Oktober 2024 09:40:27 UTC schrieb Thomas Huth <thuth@redhat.com>:
>On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote:
>> On 11/10/24 05:23, Thomas Huth wrote:
>>> On 03/05/2024 23.34, Guenter Roeck wrote:
>>>> Hi,
>>>> 
>>>> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
>>>> 
>>>> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
>>>> and sh4eb emulations. Error log is as follows.
>>>> 
>>>> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
>>>> ata1.00: 16384 sectors, multi 16: LBA48
>>>> ata1.00: configured for PIO
>>>> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
>>>> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
>>>> sd 0:0:0:0: [sda] Write Protect is off
>>>> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
>>>> ata1: lost interrupt (Status 0x58)
>>>> 
>>>> [ and more similar errors ]
>>>> 
>>>> qemu command line:
>>>> 
>>>> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
>>>>     -snapshot -drive file=rootfs.ext2,format=raw,if=ide \
>>>>     -append "root=/dev/sda console=ttySC1,115200 noiotrap" \
>>>>     -serial null -serial stdio -monitor null -nographic -no-reboot
>>>> 
>>>> Bisect points to this patch (see below). Reverting it fixes the problem.
>> 
>> Sorry Guenter for missing your email :(
>> 
>>> 
>>>   Hi Philippe!
>>> 
>>> Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py is failing (which is not run by default, that's why nobody noticed), and bisection took me to the same result that Guenter already reported.
>> 
>> "not run by default" because flaky.
>> 
>> Having a quick look, the problem seems hw/ide/core.c uses non-QOM
>> shortcuts. In particular ide_bus_init_output_irq() expects a preset
>> IRQ. Not something trivial to fix.
>
>I wonder whether the other spots that use ide_bus_init_output_irq() or similar constructs are broken now, too. Bernhard apparently already fixed (reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf.
>
>But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ?

There is an indirection going on in pmac_ide_irq() which triggers real_*_irq. These get wired via sysbus API after realize() while ide_bus_init_output_irq() wires to pmac_ide_irq(). So fc432ba0f58343c8912b80e9056315bb9bd8df92 seems safe to me (haven't tested it though).

Best regards,
Bernhard

>
> Thomas
>
Guenter Roeck Oct. 13, 2024, 4:53 a.m. UTC | #8
On 10/12/24 07:06, Bernhard Beschow wrote:
> 
> 
> Am 12. Oktober 2024 09:40:27 UTC schrieb Thomas Huth <thuth@redhat.com>:
>> On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote:
>>> On 11/10/24 05:23, Thomas Huth wrote:
>>>> On 03/05/2024 23.34, Guenter Roeck wrote:
>>>>> Hi,
>>>>>
>>>>> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
>>>>>
>>>>> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
>>>>> and sh4eb emulations. Error log is as follows.
>>>>>
>>>>> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
>>>>> ata1.00: 16384 sectors, multi 16: LBA48
>>>>> ata1.00: configured for PIO
>>>>> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
>>>>> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
>>>>> sd 0:0:0:0: [sda] Write Protect is off
>>>>> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
>>>>> ata1: lost interrupt (Status 0x58)
>>>>>
>>>>> [ and more similar errors ]
>>>>>
>>>>> qemu command line:
>>>>>
>>>>> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
>>>>>      -snapshot -drive file=rootfs.ext2,format=raw,if=ide \
>>>>>      -append "root=/dev/sda console=ttySC1,115200 noiotrap" \
>>>>>      -serial null -serial stdio -monitor null -nographic -no-reboot
>>>>>
>>>>> Bisect points to this patch (see below). Reverting it fixes the problem.
>>>
>>> Sorry Guenter for missing your email :(
>>>
>>>>
>>>>    Hi Philippe!
>>>>
>>>> Today I noticed that our sh4 test from tests/avocado/tuxrun_baselines.py is failing (which is not run by default, that's why nobody noticed), and bisection took me to the same result that Guenter already reported.
>>>
>>> "not run by default" because flaky.
>>>
>>> Having a quick look, the problem seems hw/ide/core.c uses non-QOM
>>> shortcuts. In particular ide_bus_init_output_irq() expects a preset
>>> IRQ. Not something trivial to fix.
>>
>> I wonder whether the other spots that use ide_bus_init_output_irq() or similar constructs are broken now, too. Bernhard apparently already fixed (reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf.
>>
>> But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ?
> 
> There is an indirection going on in pmac_ide_irq() which triggers real_*_irq. These get wired via sysbus API after realize() while ide_bus_init_output_irq() wires to pmac_ide_irq(). So fc432ba0f58343c8912b80e9056315bb9bd8df92 seems safe to me (haven't tested it though).
> 

Not sure if that answers the question, but booting from ide works
for both mac99 and g3beige emulations.

Guenter
Thomas Huth Oct. 13, 2024, 5:18 a.m. UTC | #9
On 13/10/2024 06.53, Guenter Roeck wrote:
> On 10/12/24 07:06, Bernhard Beschow wrote:
>>
>>
>> Am 12. Oktober 2024 09:40:27 UTC schrieb Thomas Huth <thuth@redhat.com>:
>>> On 12/10/2024 00.48, Philippe Mathieu-Daudé wrote:
>>>> On 11/10/24 05:23, Thomas Huth wrote:
>>>>> On 03/05/2024 23.34, Guenter Roeck wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Thu, Feb 08, 2024 at 07:12:40PM +0100, 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>
>>>>>>
>>>>>> qemu 9.0 fails to boot Linux from ide/ata drives with the sh4
>>>>>> and sh4eb emulations. Error log is as follows.
>>>>>>
>>>>>> ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
>>>>>> ata1.00: 16384 sectors, multi 16: LBA48
>>>>>> ata1.00: configured for PIO
>>>>>> scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 
>>>>>> ANSI: 5
>>>>>> sd 0:0:0:0: [sda] 16384 512-byte logical blocks: (8.39 MB/8.00 MiB)
>>>>>> sd 0:0:0:0: [sda] Write Protect is off
>>>>>> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't 
>>>>>> support DPO or FUA
>>>>>> ata1: lost interrupt (Status 0x58)
>>>>>>
>>>>>> [ and more similar errors ]
>>>>>>
>>>>>> qemu command line:
>>>>>>
>>>>>> qemu-system-sh4eb -M r2d -kernel arch/sh/boot/zImage \
>>>>>>      -snapshot -drive file=rootfs.ext2,format=raw,if=ide \
>>>>>>      -append "root=/dev/sda console=ttySC1,115200 noiotrap" \
>>>>>>      -serial null -serial stdio -monitor null -nographic -no-reboot
>>>>>>
>>>>>> Bisect points to this patch (see below). Reverting it fixes the problem.
>>>>
>>>> Sorry Guenter for missing your email :(
>>>>
>>>>>
>>>>>    Hi Philippe!
>>>>>
>>>>> Today I noticed that our sh4 test from tests/avocado/ 
>>>>> tuxrun_baselines.py is failing (which is not run by default, that's why 
>>>>> nobody noticed), and bisection took me to the same result that Guenter 
>>>>> already reported.
>>>>
>>>> "not run by default" because flaky.
>>>>
>>>> Having a quick look, the problem seems hw/ide/core.c uses non-QOM
>>>> shortcuts. In particular ide_bus_init_output_irq() expects a preset
>>>> IRQ. Not something trivial to fix.
>>>
>>> I wonder whether the other spots that use ide_bus_init_output_irq() or 
>>> similar constructs are broken now, too. Bernhard apparently already fixed 
>>> (reverted) one in commit 143f3fd3d8b51d6526c8ea80e8a2a085f6f01cdf.
>>>
>>> But what about fc432ba0f58343c8912b80e9056315bb9bd8df92 ?
>>
>> There is an indirection going on in pmac_ide_irq() which triggers 
>> real_*_irq. These get wired via sysbus API after realize() while 
>> ide_bus_init_output_irq() wires to pmac_ide_irq(). So 
>> fc432ba0f58343c8912b80e9056315bb9bd8df92 seems safe to me (haven't tested 
>> it though).
>>
> 
> Not sure if that answers the question, but booting from ide works
> for both mac99 and g3beige emulations.

Ok, thank you both, that sounds like we should be safe with macio IDE, indeed!

  Thomas
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);