qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: BALATON Zoltan <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Bernhard Beschow <shentey@gmail.com>,
	philmd@redhat.com
Subject: Re: [PATCH 3/5] hw/ppc/pegasos2: Fix PCI interrupt routing
Date: Fri, 24 Feb 2023 14:04:06 -0300	[thread overview]
Message-ID: <9b070e09-6479-62b7-6cd6-8acbae164047@gmail.com> (raw)
In-Reply-To: <c046d77c20875c8cd8bfdc79b4619a98ffd0bf33.1677004415.git.balaton@eik.bme.hu>



On 2/21/23 15:44, BALATON Zoltan wrote:
> According to the PegasosII schematics the PCI interrupt lines are
> connected to both the gpp pins of the Mv64361 north bridge and the
> PINT pins of the VT8231 south bridge so guests can get interrupts from
> either of these. So far we only had the MV64361 connections which
> worked for on board devices but for additional PCI devices (such as
> network or sound card added with -device) guest OSes expect interrupt
> from the ISA IRQ 9 where the firmware routes these PCI interrupts in
> VT8231 ISA bridge. After the previous patches we can now model this
> and also remove the board specific connection from mv64361. Also
> configure routing of these lines when using Virtual Open Firmware to
> match board firmware for guests that expect this.
> 
> This fixes PCI interrupts on pegasos2 under Linux, MorphOS and AmigaOS.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

>   hw/pci-host/mv64361.c |  4 ----
>   hw/ppc/pegasos2.c     | 26 +++++++++++++++++++++++++-
>   2 files changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/pci-host/mv64361.c b/hw/pci-host/mv64361.c
> index f43f33fbd9..3d9132f989 100644
> --- a/hw/pci-host/mv64361.c
> +++ b/hw/pci-host/mv64361.c
> @@ -874,10 +874,6 @@ static void mv64361_realize(DeviceState *dev, Error **errp)
>       }
>       sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->cpu_irq);
>       qdev_init_gpio_in_named(dev, mv64361_gpp_irq, "gpp", 32);
> -    /* FIXME: PCI IRQ connections may be board specific */
> -    for (i = 0; i < PCI_NUM_PINS; i++) {
> -        s->pci[1].irq[i] = qdev_get_gpio_in_named(dev, "gpp", 12 + i);
> -    }
>   }
>   
>   static void mv64361_reset(DeviceState *dev)
> diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
> index a9563f4fb2..4e1476673b 100644
> --- a/hw/ppc/pegasos2.c
> +++ b/hw/ppc/pegasos2.c
> @@ -74,6 +74,8 @@ struct Pegasos2MachineState {
>       MachineState parent_obj;
>       PowerPCCPU *cpu;
>       DeviceState *mv;
> +    qemu_irq mv_pirq[PCI_NUM_PINS];
> +    qemu_irq via_pirq[PCI_NUM_PINS];
>       Vof *vof;
>       void *fdt_blob;
>       uint64_t kernel_addr;
> @@ -96,6 +98,15 @@ static void pegasos2_cpu_reset(void *opaque)
>       }
>   }
>   
> +static void pegasos2_pci_irq(void *opaque, int n, int level)
> +{
> +    Pegasos2MachineState *pm = opaque;
> +
> +    /* PCI interrupt lines are connected to both MV64361 and VT8231 */
> +    qemu_set_irq(pm->mv_pirq[n], level);
> +    qemu_set_irq(pm->via_pirq[n], level);
> +}
> +
>   static void pegasos2_init(MachineState *machine)
>   {
>       Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine);
> @@ -107,7 +118,7 @@ static void pegasos2_init(MachineState *machine)
>       I2CBus *i2c_bus;
>       const char *fwname = machine->firmware ?: PROM_FILENAME;
>       char *filename;
> -    int sz;
> +    int i, sz;
>       uint8_t *spd_data;
>   
>       /* init CPU */
> @@ -157,11 +168,18 @@ static void pegasos2_init(MachineState *machine)
>       /* Marvell Discovery II system controller */
>       pm->mv = DEVICE(sysbus_create_simple(TYPE_MV64361, -1,
>                             qdev_get_gpio_in(DEVICE(pm->cpu), PPC6xx_INPUT_INT)));
> +    for (i = 0; i < PCI_NUM_PINS; i++) {
> +        pm->mv_pirq[i] = qdev_get_gpio_in_named(pm->mv, "gpp", 12 + i);
> +    }
>       pci_bus = mv64361_get_pci_bus(pm->mv, 1);
> +    pci_bus_irqs(pci_bus, pegasos2_pci_irq, pm, PCI_NUM_PINS);
>   
>       /* VIA VT8231 South Bridge (multifunction PCI device) */
>       via = OBJECT(pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0),
>                                                    true, TYPE_VT8231_ISA));
> +    for (i = 0; i < PCI_NUM_PINS; i++) {
> +        pm->via_pirq[i] = qdev_get_gpio_in_named(DEVICE(via), "pirq", i);
> +    }
>       object_property_add_alias(OBJECT(machine), "rtc-time",
>                                 object_resolve_path_component(via, "rtc"),
>                                 "date");
> @@ -268,6 +286,12 @@ static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason)
>                                 PCI_INTERRUPT_LINE, 2, 0x9);
>       pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
>                                 0x50, 1, 0x2);
> +    pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
> +                              0x55, 1, 0x90);
> +    pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
> +                              0x56, 1, 0x99);
> +    pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
> +                              0x57, 1, 0x90);
>   
>       pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 1) << 8) |
>                                 PCI_INTERRUPT_LINE, 2, 0x109);


  reply	other threads:[~2023-02-24 17:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 18:44 [PATCH 0/5] Pegasos2 fixes and audio output support BALATON Zoltan
2023-02-21 18:44 ` [PATCH 1/5] hw/isa/vt82c686: Implement interrupt routing in via_isa_set_irq BALATON Zoltan
2023-02-21 18:44 ` [PATCH 2/5] hw/isa/vt82c686: Implement PIRQ pins BALATON Zoltan
2023-02-21 18:44 ` [PATCH 3/5] hw/ppc/pegasos2: Fix PCI interrupt routing BALATON Zoltan
2023-02-24 17:04   ` Daniel Henrique Barboza [this message]
2023-02-25 19:34   ` Philippe Mathieu-Daudé
2023-02-25 20:19     ` BALATON Zoltan
2023-02-26 22:22     ` BALATON Zoltan
2023-02-21 18:44 ` [PATCH 4/5] hw/audio/ac97: Split off some definitions to a header BALATON Zoltan
2023-02-25 19:35   ` Philippe Mathieu-Daudé
2023-02-26 22:17     ` BALATON Zoltan
2023-02-21 18:44 ` [PATCH 5/5] hw/audio/via-ac97: Basic implementation of audio playback BALATON Zoltan
2023-02-23 19:40   ` Volker Rümelin
2023-02-24  9:53     ` Bernhard Beschow
2023-02-24 12:26       ` BALATON Zoltan
2023-02-24 13:05       ` BALATON Zoltan
2023-02-24 17:14         ` Daniel Henrique Barboza
2023-02-24 21:08           ` BALATON Zoltan
2023-02-25  8:58             ` Daniel Henrique Barboza
2023-02-22 15:38 ` [PATCH 0/5] Pegasos2 fixes and audio output support Bernhard Beschow
2023-02-22 18:56   ` Bernhard Beschow
2023-02-22 19:25     ` BALATON Zoltan
2023-02-22 20:59       ` Bernhard Beschow
2023-02-22 21:12         ` BALATON Zoltan
2023-02-22 22:20           ` Bernhard Beschow
2023-02-22 23:00             ` BALATON Zoltan
2023-02-23  9:13               ` Bernhard Beschow
2023-02-23 12:33                 ` BALATON Zoltan
2023-02-23 13:17                   ` Bernhard Beschow
2023-02-23 14:23                     ` BALATON Zoltan
2023-02-23 20:28                       ` Bernhard Beschow
2023-03-01 13:49                 ` Mark Cave-Ayland
2023-03-01 19:24                   ` BALATON Zoltan
2023-03-01 20:53                     ` Bernhard Beschow
2023-03-01 21:05                       ` BALATON Zoltan
2023-03-01 13:42           ` Mark Cave-Ayland
2023-03-01 19:21             ` BALATON Zoltan
2023-02-22 22:23         ` BALATON Zoltan
2023-02-23  0:43           ` BALATON Zoltan
2023-03-01 13:47             ` Mark Cave-Ayland

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=9b070e09-6479-62b7-6cd6-8acbae164047@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=kraxel@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=shentey@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).