qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: BALATON Zoltan <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Daniel Henrique Barboza <danielhb413@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	philmd@linaro.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	ReneEngel80@emailn.de
Subject: Re: [PATCH v3 4/8] hw/isa/vt82c686: Implement PCI IRQ routing
Date: Sun, 26 Feb 2023 23:06:36 +0000	[thread overview]
Message-ID: <F86A8AF3-8D69-497A-ADD1-688D2B4FED03@gmail.com> (raw)
In-Reply-To: <0fd9eac9174a840054c511fbc015048929c7bc40.1677445307.git.balaton@eik.bme.hu>



Am 25. Februar 2023 18:11:49 UTC schrieb BALATON Zoltan <balaton@eik.bme.hu>:
>From: Bernhard Beschow <shentey@gmail.com>
>
>The real VIA south bridges implement a PCI IRQ router which is configured
>by the BIOS or the OS. In order to respect these configurations, QEMU
>needs to implement it as well.
>
>Note: The implementation was taken from piix4_set_irq() in hw/isa/piix4.
>
>Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>[balaton: declare gpio inputs instead of changing pci bus irqs so it can
> be connected in board code; remove some empty lines]
>Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>Tested-by: Rene Engel <ReneEngel80@emailn.de>
>---
> hw/isa/vt82c686.c | 39 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
>diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
>index 3f9bd0c04d..4025f9bcdc 100644
>--- a/hw/isa/vt82c686.c
>+++ b/hw/isa/vt82c686.c
>@@ -604,6 +604,44 @@ static void via_isa_request_i8259_irq(void *opaque, int irq, int level)
>     qemu_set_irq(s->cpu_intr, level);
> }
> 
>+static int via_isa_get_pci_irq(const ViaISAState *s, int irq_num)
>+{
>+    switch (irq_num) {
>+    case 0:
>+        return s->dev.config[0x55] >> 4;
>+    case 1:
>+        return s->dev.config[0x56] & 0xf;
>+    case 2:
>+        return s->dev.config[0x56] >> 4;
>+    case 3:
>+        return s->dev.config[0x57] >> 4;
>+    }
>+    return 0;
>+}
>+
>+static void via_isa_set_pci_irq(void *opaque, int irq_num, int level)
>+{
>+    ViaISAState *s = opaque;
>+    PCIBus *bus = pci_get_bus(&s->dev);
>+    int pic_irq;
>+
>+    /* now we change the pic irq level according to the via irq mappings */
>+    /* XXX: optimize */
>+    pic_irq = via_isa_get_pci_irq(s, irq_num);
>+    if (pic_irq < ISA_NUM_IRQS) {
>+        int i, pic_level;
>+
>+        /* The pic level is the logical OR of all the PCI irqs mapped to it. */
>+        pic_level = 0;
>+        for (i = 0; i < PCI_NUM_PINS; i++) {
>+            if (pic_irq == via_isa_get_pci_irq(s, i)) {
>+                pic_level |= pci_bus_get_irq_level(bus, i);
>+            }
>+        }
>+        qemu_set_irq(s->isa_irqs[pic_irq], pic_level);
>+    }
>+}
>+
> static void via_isa_realize(PCIDevice *d, Error **errp)
> {
>     ViaISAState *s = VIA_ISA(d);
>@@ -614,6 +652,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp)
>     int i;
> 
>     qdev_init_gpio_out(dev, &s->cpu_intr, 1);
>+    qdev_init_gpio_in_named(dev, via_isa_set_pci_irq, "pirq", PCI_NUM_PINS);

This line is a Pegasos2 specific addition for fixing its IRQ handling. Since this code must also work with the Fuloong2e board we should aim for a minimal changeset here which renders this line out of scope.

Let's keep the two series separate since now I need to watch two series for comments. Please use Based-on: tag next time instead.

Thanks,
Bernhard

>     isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1);
>     isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d),
>                           errp);


  parent reply	other threads:[~2023-02-26 23:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-26 21:01 [PATCH v3 0/8] Pegasos2 fixes and audio output support BALATON Zoltan
2022-01-23 20:40 ` [PATCH v3 8/8] hw/audio/via-ac97: Basic implementation of audio playback BALATON Zoltan
2022-01-25 19:48 ` [PATCH v3 7/8] hw/audio/ac97: Split off some definitions to a header BALATON Zoltan
2023-02-26 22:20   ` Philippe Mathieu-Daudé
2023-02-15 15:35 ` [PATCH v3 1/8] hw/display/sm501: Implement more 2D raster operations BALATON Zoltan
2023-02-16 20:27 ` [PATCH v3 5/8] hw/ppc/pegasos2: Fix PCI interrupt routing BALATON Zoltan
2023-02-26 22:51   ` Bernhard Beschow
2023-02-26 23:39     ` BALATON Zoltan
2023-02-25 18:11 ` [PATCH v3 4/8] hw/isa/vt82c686: Implement PCI IRQ routing BALATON Zoltan
2023-02-26 22:27   ` Philippe Mathieu-Daudé
2023-02-26 22:47     ` BALATON Zoltan
2023-02-26 23:10     ` Bernhard Beschow
2023-02-26 23:37       ` BALATON Zoltan
2023-02-27  8:21         ` Bernhard Beschow
2023-02-27 11:05           ` BALATON Zoltan
2023-02-26 23:58       ` BALATON Zoltan
2023-02-27  8:35         ` Bernhard Beschow
2023-02-27 11:08           ` BALATON Zoltan
2023-02-26 23:06   ` Bernhard Beschow [this message]
2023-02-26 23:33     ` BALATON Zoltan
2023-02-27  8:13       ` Bernhard Beschow
2023-02-27 11:01         ` BALATON Zoltan
2023-02-27 11:12           ` BALATON Zoltan
2023-02-27 12:57             ` BALATON Zoltan
2023-02-27 16:52               ` Bernhard Beschow
2023-03-01 20:59                 ` Mark Cave-Ayland
2023-03-01 21:16                   ` BALATON Zoltan
2023-03-02  2:14                   ` BALATON Zoltan
2023-02-25 18:19 ` [PATCH v3 6/8] hw/usb/vt82c686-uhci-pci: Use " BALATON Zoltan
2023-02-25 21:35 ` [PATCH v3 2/8] hw/display/sm501: Add fallbacks to pixman routines BALATON Zoltan
2023-02-25 22:46 ` [PATCH v3 3/8] hw/display/sm501: Add debug property to control pixman usage BALATON Zoltan
2023-02-27 13:34 ` [PATCH v3 0/8] Pegasos2 fixes and audio output support BALATON Zoltan

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=F86A8AF3-8D69-497A-ADD1-688D2B4FED03@gmail.com \
    --to=shentey@gmail.com \
    --cc=ReneEngel80@emailn.de \
    --cc=balaton@eik.bme.hu \
    --cc=danielhb413@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).