Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8651EC6FA9D for ; Wed, 1 Mar 2023 18:02:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXQlj-0005va-Ec; Wed, 01 Mar 2023 13:01:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXQlV-0005qA-Nv; Wed, 01 Mar 2023 13:01:22 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXQlT-0002I5-0u; Wed, 01 Mar 2023 13:01:21 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 98554746335; Wed, 1 Mar 2023 19:01:12 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5E951746324; Wed, 1 Mar 2023 19:01:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 5C8677457E7; Wed, 1 Mar 2023 19:01:12 +0100 (CET) Date: Wed, 1 Mar 2023 19:01:12 +0100 (CET) From: BALATON Zoltan To: David Woodhouse cc: Bernhard Beschow , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Gerd Hoffmann , Daniel Henrique Barboza , Peter Maydell , philmd@linaro.org, ReneEngel80@emailn.de Subject: Re: [PATCH v5 5/7] hw/isa/vt82c686: Work around missing level sensitive irq in i8259 model In-Reply-To: <859e28fd61203c35e30fce505f0101886a54e654.camel@infradead.org> Message-ID: <418dd5ca-cabc-fb91-6437-63bece1dfe1b@eik.bme.hu> References: <6502f6bd-029c-25a8-49ec-e61784c64db5@eik.bme.hu> <943866390436e3c8828fea3e8cec117ae8553887.camel@infradead.org> <1c9daa28-b4b0-5227-ea94-90035a8bed7a@eik.bme.hu> <859e28fd61203c35e30fce505f0101886a54e654.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Wed, 1 Mar 2023, David Woodhouse wrote: > On Wed, 2023-03-01 at 14:18 +0100, BALATON Zoltan wrote: >>> Are you sure the PIC ELCR is actually set for the lines you're having >>> trouble with? Is that something the Pegasos SmartFirmware would have >>> done, and MorphOS is expecting to inherit but isn't actually setting up >>> for itself? >> >> No, it works with other guests like Linux and AmigaOS that use PIC as set >> up by the firmware but MorphOS tries to use it in level sensitive mode and >> likely has an IRQ handler which expects this to work. This is where I've >> debugged it and came to this workaround: >> >> https://lists.nongnu.org/archive/html/qemu-ppc/2023-02/msg00403.html >> >> When booting MorphOS with -d unimp I see these logs: >> >> i8259: level sensitive irq not supported >> i8259: level sensitive irq not supported >> >> which is I guess when it tries to set it for both PICs. (If you want to >> try this MorphOS iso is downloadable and instructions how to boot it is >> here: http://zero.eik.bme.hu/~balaton/qemu/amiga/#morphos > > > Wow. Even looking at the PIIX3 datasheet from 1996, That 'Edge/Level > Bank Select (LTIM)' bit was documented as 'This bit is disabled. Its > function is replaced by the Edge/Level Triggerede Control (ELCR) > Registers. > > We've been able to set the edge/level on a per-pin basis ever since the > ELCR was introduced with the IBM PS/2, I think. > > It isn't a *correct* fix without a little bit more typing, but does > this make it work? > > diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c > index 17910f3bcb..36ebcff025 100644 > --- a/hw/intc/i8259.c > +++ b/hw/intc/i8259.c > @@ -246,6 +246,7 @@ static void pic_ioport_write(void *opaque, hwaddr addr64, > if (val & 0x08) { > qemu_log_mask(LOG_UNIMP, > "i8259: level sensitive irq not supported\n"); > + s->elcr = 0xff; This works too. I guess the log can be then removed too. Could you submit a proper patch or you want me to do that so we can drop the workaround for it? Thanks for looking into it. Regards, BALATON Zoltan > } > } else if (val & 0x08) { > if (val & 0x04) { > > > >