[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with irq mapping in qemu v5.2

From: BALATON Zoltan
Subject: Re: Problems with irq mapping in qemu v5.2
Date: Tue, 22 Dec 2020 18:55:19 +0100 (CET)


On Tue, 22 Dec 2020, Guenter Roeck wrote:

commit 459ca8bfa41 ("pci: Assert irqnum is between 0 and bus->nirqs in
pci_bus_change_irq_level") added sanity checks to the interrupt number passed
to pci_bus_change_irq_level(). That makes sense, given that bus->irq_count
is indexed and sized by the number of interrupts.

However, as it turns out, the interrupt number passed to this function
is the _mapped_ interrupt number. The result in assertion failures for various

Examples (I don't know if there are others):

- ppc4xx_pci_map_irq() maps the interrupt number to "slot - 1". Obviously
 that isn't a good thing to do for slot 0, and indeed results in an
 assertion as soon as slot 0 is initialized (presumably that is the root
 bridge). Changing the mapping to "slot" doesn't help because valid slots
 are 0..4, and only four interrupts are allocated.

Is that with sam460ex? This ppc4xx_pci_map_irq appears in ppc4xx-host-bridge and hw/ppc/ppc440_pcix.c (which is used by sam460ex) has a ppc4xx-host-bridge. Other user of it may be the bamboo 440 board where this host bridge appears too. I did not see asserts with sam460ex but I've only tested it with AmigaOS which may use it in an odd way not tripping the check.

- pci_bonito_map_irq() changes the mapping all over the place. Whatever
 it does, it returns numbers starting with 32 for slots 5..12. With
 a total number of 32 interrupts, this again results in an assertion

ppc4xx_pci_map_irq() is definitely buggy. I just don't know what the
correct mapping should be. slot  & 3, maybe ?

The current irq mapping may not match real hardware but unfortunately I don't know what real hardware does, neither for sam460ex nor for bamboo. I've implemented ppc440_pcix mostly by guessing and doing what made clients happy because I could not get docs for that PCI implementation so it's possible there are some bugs left. Since these are IBM parts (PCI parts of 440 SoCs) maybe there's some info available from them (but this is likely board specific) or someone may have some info here. I'm adding the qemu-ppc list in any case, hoping someone knowing PPC440 SoC might read that list. Also the u-boot source of the sam460ex firmware may have some info if somebody knows where to look for it in there.

I don't really have a good solution for pci_bonito_map_irq(). It may not
matter much - I have not been able to boot fuloong_2e since qemu v4.0,
and afaics that is the only platform using it. Maybe it is just completely
broken ?

There were some patches in the past few days on the list improving fuloong2e emulation so that the board's firmware can be used, but I don't know if any of those are relevant. Philippe may know more about that.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]