From: David Gibson <david@gibson.dropbear.id.au>
To: Thomas Huth <thuth@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-devel@nongnu.org,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Greg Kurz <groug@kaod.org>,
qemu-ppc@nongnu.org, clg@kaod.org, edgar.iglesias@gmail.com
Subject: Re: [PATCH] hw/ppc/ppc4xx_pci: Fix ppc4xx_pci_map_irq() for recent Linux kernels
Date: Wed, 20 Oct 2021 15:15:26 +1100 [thread overview]
Message-ID: <YW+X3hZ02B/mosyi@yekko> (raw)
In-Reply-To: <20211019091817.469003-1-thuth@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]
On Tue, Oct 19, 2021 at 11:18:17AM +0200, Thomas Huth wrote:
65;6402;1c> Recent Linux kernels are accessing the PCI device in slot 0 that
> represents the PCI host bridge. This causes ppc4xx_pci_map_irq()
> to return -1 which causes an assert() later:
>
> hw/pci/pci.c:262: pci_bus_change_irq_level: Assertion `irq_num >= 0' failed.
>
> Thus we should allocate an IRQ line for the device in slot 0, too.
> To avoid changes to the outside of ppc4xx_pci.c, we map it to
> the internal IRQ number 4 which will then happily be ignored since
> ppc440_bamboo.c does not wire it up.
>
> With these changes it is now possible again to use recent Linux
> kernels for the bamboo board.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Applied to ppc-for-6.2, thanks.
> ---
> hw/ppc/ppc4xx_pci.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
> index 8147ba6f94..304a29349c 100644
> --- a/hw/ppc/ppc4xx_pci.c
> +++ b/hw/ppc/ppc4xx_pci.c
> @@ -48,12 +48,14 @@ OBJECT_DECLARE_SIMPLE_TYPE(PPC4xxPCIState, PPC4xx_PCI_HOST_BRIDGE)
> #define PPC4xx_PCI_NR_PMMS 3
> #define PPC4xx_PCI_NR_PTMS 2
>
> +#define PPC4xx_PCI_NUM_DEVS 5
> +
> struct PPC4xxPCIState {
> PCIHostState parent_obj;
>
> struct PCIMasterMap pmm[PPC4xx_PCI_NR_PMMS];
> struct PCITargetMap ptm[PPC4xx_PCI_NR_PTMS];
> - qemu_irq irq[PCI_NUM_PINS];
> + qemu_irq irq[PPC4xx_PCI_NUM_DEVS];
>
> MemoryRegion container;
> MemoryRegion iomem;
> @@ -246,7 +248,7 @@ static int ppc4xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
>
> trace_ppc4xx_pci_map_irq(pci_dev->devfn, irq_num, slot);
>
> - return slot - 1;
> + return slot > 0 ? slot - 1 : PPC4xx_PCI_NUM_DEVS - 1;
> }
>
> static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)
> @@ -254,7 +256,7 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)
> qemu_irq *pci_irqs = opaque;
>
> trace_ppc4xx_pci_set_irq(irq_num);
> - assert(irq_num >= 0);
> + assert(irq_num >= 0 && irq_num < PPC4xx_PCI_NUM_DEVS);
> qemu_set_irq(pci_irqs[irq_num], level);
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2021-10-20 4:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 9:18 [PATCH] hw/ppc/ppc4xx_pci: Fix ppc4xx_pci_map_irq() for recent Linux kernels Thomas Huth
2021-10-19 14:45 ` Cédric Le Goater
2021-10-20 4:15 ` David Gibson [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=YW+X3hZ02B/mosyi@yekko \
--to=david@gibson.dropbear.id.au \
--cc=christophe.leroy@csgroup.eu \
--cc=clg@kaod.org \
--cc=edgar.iglesias@gmail.com \
--cc=groug@kaod.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/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.