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 2E626C7EE30 for ; Wed, 1 Mar 2023 22:47:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXVE6-00031g-Qx; Wed, 01 Mar 2023 17:47:10 -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 1pXVE4-00030r-Lp; Wed, 01 Mar 2023 17:47:08 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXVE2-0008Ro-NJ; Wed, 01 Mar 2023 17:47:08 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 9DE6A7462DB; Wed, 1 Mar 2023 23:47:01 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5ED6B7457E7; Wed, 1 Mar 2023 23:47:01 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 5C290745706; Wed, 1 Mar 2023 23:47:01 +0100 (CET) Date: Wed, 1 Mar 2023 23:47:01 +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: Message-ID: <20eb7e98-aedb-1528-8ba0-806b93b123ea@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> <418dd5ca-cabc-fb91-6437-63bece1dfe1b@eik.bme.hu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3866299591-951860295-1677710821=:23145" Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, 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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3866299591-951860295-1677710821=:23145 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Wed, 1 Mar 2023, David Woodhouse wrote: > On Wed, 2023-03-01 at 19:01 +0100, BALATON Zoltan wrote: >> >>> 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. > > > Happy for you to do the rest of the typing ... :) I don't mind the typing but this is quite a bit more involved than I expected. You've lost me at the vmstate stuff which I don't quite know how to change or test. If these were stored as bits in an ISW1 register as described by the docs I've looked at now then no change in migration would be needed but this isn't how it seems to be in QEMU so I give up on that in this case. Could you please do the typing then? Thank you, BALATON Zoltan > So, *ideally* I think you need to introduce a new field in the > PICCommonState which records the status of the LTIM bit. And fix up the > vmstate_pic_common in hw/intc/i8259_common.c to save and restore that > (with versioning for upgrade/downgrade). > > Then you find those places which currently check the bit for the > specific pin in s->elcr, and make them something like: > > --- a/hw/intc/i8259.c > +++ b/hw/intc/i8259.c > @@ -133,7 +133,7 @@ static void pic_set_irq(void *opaque, int irq, int level) > } > #endif > > - if (s->elcr & mask) { > + if (s->ltim || (s->elcr & mask)) { > /* level triggered */ > if (level) { > s->irr |= mask; > > It *might* be that you should make the LTIM behaviour optional, so that > only certain incarnations of the i8259 actually get it at all and it > *wouldn't* take effect if a guest tried to set it, which is what the > PIIX3 datasheet implies. But I suspect we can get away without that. > > --3866299591-951860295-1677710821=:23145--