qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
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>,
	Bernhard Beschow <shentey@gmail.com>,
	Peter Maydell <peter.maydell@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:27:50 +0100	[thread overview]
Message-ID: <a496276e-24fb-e2bc-fbdf-ace9ef7f361f@linaro.org> (raw)
In-Reply-To: <0fd9eac9174a840054c511fbc015048929c7bc40.1677445307.git.balaton@eik.bme.hu>

On 25/2/23 19:11, BALATON Zoltan wrote:
> 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(+)

> +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) {

the ISA IRQ is stored in 4-bit so will always be in range.

> +        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);
> +    }
> +}




  reply	other threads:[~2023-02-26 22:28 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é [this message]
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
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=a496276e-24fb-e2bc-fbdf-ace9ef7f361f@linaro.org \
    --to=philmd@linaro.org \
    --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=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).