All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Thomas Huth" <thuth@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-ppc@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
	qemu-arm@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>
Subject: Re: [PATCH v2 7/7] hw: Simplify using sysbus_init_irqs() [manual]
Date: Thu, 1 Jun 2023 12:34:20 +0200	[thread overview]
Message-ID: <de455326-5fee-db23-07c5-40941c1ccc8a@linaro.org> (raw)
In-Reply-To: <CAFEAcA8wgaEJd03G8gNtFOUFT0jpm=KLfaZSjeYcOgvTYdvhJQ@mail.gmail.com>

On 1/6/23 12:19, Peter Maydell wrote:
> On Thu, 1 Jun 2023 at 10:48, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Audit the sysbus_init_irq() calls and manually convert
>> to sysbus_init_irqs() when a loop is involved.
>>
>> In omap2_intc_init(), the parent_intr[] array contains
>> 2 elements: use ARRAY_SIZE() to iterate over.
>>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
>> diff --git a/hw/timer/renesas_tmr.c b/hw/timer/renesas_tmr.c
>> index c15f654738..dd2929d6e7 100644
>> --- a/hw/timer/renesas_tmr.c
>> +++ b/hw/timer/renesas_tmr.c
>> @@ -428,17 +428,14 @@ static void rtmr_init(Object *obj)
>>   {
>>       SysBusDevice *d = SYS_BUS_DEVICE(obj);
>>       RTMRState *tmr = RTMR(obj);
>> -    int i;
>>
>>       memory_region_init_io(&tmr->memory, OBJECT(tmr), &tmr_ops,
>>                             tmr, "renesas-tmr", 0x10);
>>       sysbus_init_mmio(d, &tmr->memory);
>>
>> -    for (i = 0; i < ARRAY_SIZE(tmr->ovi); i++) {
>> -        sysbus_init_irq(d, &tmr->cmia[i]);
>> -        sysbus_init_irq(d, &tmr->cmib[i]);
>> -        sysbus_init_irq(d, &tmr->ovi[i]);
>> -    }
>> +    sysbus_init_irqs(d, tmr->cmia, ARRAY_SIZE(tmr->cmia));
>> +    sysbus_init_irqs(d, tmr->cmib, ARRAY_SIZE(tmr->cmib));
>> +    sysbus_init_irqs(d, tmr->ovi, ARRAY_SIZE(tmr->ovi));
> 
> Doesn't this change the order of the IRQs? Previously
> we had channel 0 CMIA, channel 0 CMIA, channel 0 OVI,
> channel 1 CMIA, channel 1 CMIB, channel 1 OVI. Now
> we have channel 0 CMIA, channel 1 CMIA, channel 0 CMIB,
> channel 1 CMIB, channel 0 OVI, channel 1 OVI. So they'll
> get miswired in the board code now...

Oops, good catch. Good case to show the sysbus_init_irq() is
fragile. At least named_gpio are clearer.

I'm surprised because v1 series passed CI, but looking closer
the RX tests isn't run. And now I see commit e5d402b28f
("tests/acceptance: disable machine_rx_gdbsim on GitLab").

"Hopefully we can re-enable both
     once the serial timing patches have been added."

Alex, are these patches in the tree now?


      reply	other threads:[~2023-06-01 10:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  9:46 [PATCH v2 0/7] hw/sysbus: Add sysbus_init_irqs and reduce SYSBUS_DEVICE_GPIO_IRQ scope Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 1/7] hw/arm/xlnx-versal: Do not open-code sysbus_connect_irq() Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 2/7] hw/usb/xlnx: Do not open-code sysbus_pass_irq() Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 3/7] hw/sysbus: Introduce sysbus_init_irqs() Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 4/7] hw/usb/hcd-xhci: Use sysbus_init_irqs() Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 5/7] hw/sysbus: Make SYSBUS_DEVICE_GPIO_IRQ API internal Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 6/7] hw: Simplify using sysbus_init_irqs() [automatic] Philippe Mathieu-Daudé
2023-06-01  9:46 ` [PATCH v2 7/7] hw: Simplify using sysbus_init_irqs() [manual] Philippe Mathieu-Daudé
2023-06-01 10:19   ` Peter Maydell
2023-06-01 10:34     ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de455326-5fee-db23-07c5-40941c1ccc8a@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.