All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Bernhard Beschow <shentey@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	 Gerd Hoffmann <kraxel@redhat.com>,
	 Daniel Henrique Barboza <danielhb413@gmail.com>,
	 Peter Maydell <peter.maydell@linaro.org>,
	philmd@linaro.org,  ReneEngel80@emailn.de
Subject: Re: [PATCH v5 5/7] hw/isa/vt82c686: Work around missing level sensitive irq in i8259 model
Date: Wed, 1 Mar 2023 12:27:45 +0100 (CET)	[thread overview]
Message-ID: <6502f6bd-029c-25a8-49ec-e61784c64db5@eik.bme.hu> (raw)
In-Reply-To: <CC88085A-C269-4BCF-8CFD-EB3B457533C9@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]

On Wed, 1 Mar 2023, Bernhard Beschow wrote:
> Am 1. März 2023 00:17:11 UTC schrieb BALATON Zoltan <balaton@eik.bme.hu>:
>> MorphOS sets the ISA PIC to level sensitive mode but QEMU does not
>> support that so this causes a freeze if multiple devices try to raise
>> a shared interrupt. Work around it by lowering the interrupt before
>> raising it again if it is already raised. This could be reverted when
>> the i8259 model is fixed.
>>
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>> hw/isa/vt82c686.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
>> index 018a119964..3e44a51f92 100644
>> --- a/hw/isa/vt82c686.c
>> +++ b/hw/isa/vt82c686.c
>> @@ -549,6 +549,7 @@ struct ViaISAState {
>>     PCIDevice dev;
>>     qemu_irq cpu_intr;
>>     qemu_irq *isa_irqs_in;
>> +    uint16_t isa_irqs_state;
>>     ViaSuperIOState via_sio;
>>     MC146818RtcState rtc;
>>     PCIIDEState ide;
>> @@ -636,6 +637,14 @@ static void via_isa_set_pci_irq(void *opaque, int irq_num, int level)
>>             pic_level |= pci_bus_get_irq_level(bus, i);
>>         }
>>     }
>> +    /* FIXME: workaround for i8259: level sensitive irq not supported */
>> +    if ((s->isa_irqs_state & BIT(pic_irq)) && pic_level) {
>> +        qemu_irq_lower(s->isa_irqs_in[pic_irq]);
>> +    } else if (pic_level) {
>> +        s->isa_irqs_state |= BIT(pic_irq);
>> +    } else {
>> +        s->isa_irqs_state &= ~BIT(pic_irq);
>> +    }
>
> Let's not clutter the device model with workarounds which quickly snowball into unmaintainable code. Please fix the i8259 instead.

Do you have an idea how? I don't know PC hardware well so it's not likely 
I can do that in one day and breaking PIC model would affect a lot of 
machines among them some production critical ones. Adding this workaround 
here only affects pegasos2 and the only partially modeled likely not used 
fuloong2e board (which is mostly there because it was there before and 
good to keep it to be able to test this device model with another machine) 
and I can test these two but not all the others using i8259. So I think 
for this release this is the best we can do and if somebody more 
knowledgeable about PC hardware fixes the i8259 PIC model later this can 
be easily reverted. It's not a big clutter so unless you can show this 
breaks something I'd rather have it to keep MorphOS usable on pegasos2 
with sound and network or USB. If you can prove this breaks something we 
could drop it but not based on opinion or feelengs only some evidence.

Regards,
BALATON Zoltan

>>     /* Now we change the pic irq level according to the via irq mappings. */
>>     qemu_set_irq(s->isa_irqs_in[pic_irq], pic_level);
>> }
>
>

  reply	other threads:[~2023-03-01 11:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  0:17 [PATCH v5 0/7] Pegasos2 fixes and audio output support BALATON Zoltan
2023-03-01  0:17 ` [PATCH v5 1/7] hw/display/sm501: Add debug property to control pixman usage BALATON Zoltan
2023-03-02 21:51   ` BALATON Zoltan
2023-03-01  0:17 ` [PATCH v5 2/7] Revert "hw/isa/vt82c686: Remove intermediate IRQ forwarder" BALATON Zoltan
2023-03-01  0:33   ` BALATON Zoltan
2023-03-01  6:43     ` Bernhard Beschow
2023-03-01 11:17       ` BALATON Zoltan
2023-03-02 10:41     ` Philippe Mathieu-Daudé
2023-03-02 10:44       ` Philippe Mathieu-Daudé
2023-03-02 12:37       ` BALATON Zoltan
2023-03-02 12:46         ` Philippe Mathieu-Daudé
2023-03-01  0:17 ` [PATCH v5 3/7] hw/isa/vt82c686: Implement PCI IRQ routing BALATON Zoltan
2023-03-01  6:38   ` Bernhard Beschow
2023-03-01 11:15     ` BALATON Zoltan
2023-03-01 21:08       ` Bernhard Beschow
2023-03-01 21:27         ` BALATON Zoltan
2023-03-01  0:17 ` [PATCH v5 4/7] hw/ppc/pegasos2: Fix PCI interrupt routing BALATON Zoltan
2023-03-03  9:17   ` Daniel Henrique Barboza
2023-03-01  0:17 ` [PATCH v5 5/7] hw/isa/vt82c686: Work around missing level sensitive irq in i8259 model BALATON Zoltan
2023-03-01  6:49   ` Bernhard Beschow
2023-03-01 11:27     ` BALATON Zoltan [this message]
2023-03-01 11:52       ` David Woodhouse
2023-03-01 13:18         ` BALATON Zoltan
2023-03-01 14:05           ` David Woodhouse
2023-03-01 18:01             ` BALATON Zoltan
2023-03-01 21:53               ` David Woodhouse
2023-03-01 22:47                 ` BALATON Zoltan
2023-03-02  8:59                   ` David Woodhouse
2023-03-02  9:06                     ` [PATCH] hw/intc/i8259: Implement legacy LTIM Edge/Level Bank Select David Woodhouse
2023-03-02  9:58                       ` David Woodhouse
2023-03-02 12:35                       ` BALATON Zoltan
2023-03-02 21:46                     ` [PATCH v5 5/7] hw/isa/vt82c686: Work around missing level sensitive irq in i8259 model BALATON Zoltan
2023-03-01 20:58             ` Bernhard Beschow
2023-03-01  0:17 ` [PATCH v5 6/7] hw/usb/vt82c686-uhci-pci: Use PCI IRQ routing BALATON Zoltan
2023-03-01  0:17 ` [PATCH v5 7/7] hw/audio/via-ac97: Basic implementation of audio playback BALATON Zoltan
2023-03-02 21:59   ` BALATON Zoltan
2023-03-03  6:57   ` Volker Rümelin

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=6502f6bd-029c-25a8-49ec-e61784c64db5@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=ReneEngel80@emailn.de \
    --cc=danielhb413@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@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 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.