[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] hw/pci-host/prep: Fix PCI swizzling in map_irq()
From: |
Mark Cave-Ayland |
Subject: |
Re: [PATCH 3/4] hw/pci-host/prep: Fix PCI swizzling in map_irq() |
Date: |
Mon, 12 Oct 2020 10:37:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 12/10/2020 08:19, Philippe Mathieu-Daudé wrote:
> In commit a01d8cadadf we changed the number of IRQs to 4 but
> forgot to update the map_irq() function. Do it now.
>
> Fixes: a01d8cadadf ("Fix memory corruption ... in PreP emulation")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Cc: Jocelyn Mayer <l_indien@magic.fr>
> Cc: Julian Seward <julian@valgrind.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/pci-host/prep.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
> index 064593d1e52..2224135fedb 100644
> --- a/hw/pci-host/prep.c
> +++ b/hw/pci-host/prep.c
> @@ -195,7 +195,7 @@ static const MemoryRegionOps raven_io_ops = {
>
> static int raven_map_irq(PCIDevice *pci_dev, int irq_num)
> {
> - return (irq_num + (pci_dev->devfn >> 3)) & 1;
> + return (irq_num + (pci_dev->devfn >> 3)) & 3;
> }
>
> static void raven_set_irq(void *opaque, int irq_num, int level)
It feels like this should also have a corresponding change in OpenBIOS for
consistency, even though technically because of the OR on IRQ 15 it doesn't
really
matter. The relevant part in OpenBIOS can be found here:
https://git.qemu.org/?p=openbios.git;a=blob;f=drivers/pci.c;h=34ae69a907b6312a3a7ab218afe8ba9efded1df7;hb=7f28286f5cb1ca682e3ba0a8706d8884f12bc49e#l2001
and in particular this section:
/* Use the same "physical" routing as QEMU's raven_map_irq() although
ultimately all 4 PCI interrupts are ORd to IRQ 15 as indicated
by the PReP specification */
props[(*ncells)++] = arch->irqs[((intno - 1) + (addr >> 11)) & 1];
ATB,
Mark.