From patchwork Wed Sep 2 07:49:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Kauer X-Patchwork-Id: 32816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4C950B6EDF for ; Wed, 2 Sep 2009 17:46:53 +1000 (EST) Received: from localhost ([127.0.0.1]:35493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MikYG-0002d1-U4 for incoming@patchwork.ozlabs.org; Wed, 02 Sep 2009 03:46:44 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MikXo-0002cm-1k for qemu-devel@nongnu.org; Wed, 02 Sep 2009 03:46:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MikXi-0002ca-DT for qemu-devel@nongnu.org; Wed, 02 Sep 2009 03:46:14 -0400 Received: from [199.232.76.173] (port=59905 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MikXi-0002cX-9z for qemu-devel@nongnu.org; Wed, 02 Sep 2009 03:46:10 -0400 Received: from mx20.gnu.org ([199.232.41.8]:11317) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MikXh-0002Yz-QQ for qemu-devel@nongnu.org; Wed, 02 Sep 2009 03:46:09 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MikXf-0004ZT-BK for qemu-devel@nongnu.org; Wed, 02 Sep 2009 03:46:07 -0400 Received: from erwin.inf.tu-dresden.de ([141.76.48.80] helo=chrom.inf.tu-dresden.de) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1MikXd-0001WB-8z for qemu-devel@nongnu.org; Wed, 02 Sep 2009 09:46:05 +0200 Received: from kauer by chrom.inf.tu-dresden.de with local (Exim 4.69) (envelope-from ) id 1MikaX-00026X-5w for qemu-devel@nongnu.org; Wed, 02 Sep 2009 09:49:05 +0200 Date: Wed, 2 Sep 2009 09:49:05 +0200 From: Bernhard Kauer To: qemu-devel@nongnu.org Message-ID: <20090902074905.GB25711@chrom.inf.tu-dresden.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [PATCH] [RESEND] RTC polling mode broken X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The RTC emulation does not set the IRQ flags independent of the IRQ enable bits. The original MC146818A datasheet from 1984 notes: "flag bits in Register C [...] are set independent of the state of the corresponding enable bits in Register B" Similar sections can be found in newer documentation e.g. in rtc82885. Qemu and Bochs set the IRQ flags only if they are enabled, which breaks drivers polling on them. The following patch corrects this for the update-ended-flag in Qemu only. It does not fix the handling of the other flags. Signed-off-by: Bernhard Kauer diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 2022548..2b040a7 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -421,9 +421,10 @@ static void rtc_update_second2(void *opaque) } /* update ended interrupt */ + s->cmos_data[RTC_REG_C] |= REG_C_UF; if (s->cmos_data[RTC_REG_B] & REG_B_UIE) { - s->cmos_data[RTC_REG_C] |= 0x90; - rtc_irq_raise(s->irq); + s->cmos_data[RTC_REG_C] |= REG_C_IRQF; + rtc_irq_raise(s->irq); } /* clear update in progress bit */