From nobody Wed Nov 5 00:16:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500887020496127.07405053470552; Mon, 24 Jul 2017 02:03:40 -0700 (PDT) Received: from localhost ([::1]:53639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZH8-0000ZM-9Q for importer@patchew.org; Mon, 24 Jul 2017 05:03:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZGE-0000Dn-Uo for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:02:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZZGB-0004hS-QX for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:02:43 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:51252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZGB-0004fg-4u for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:02:39 -0400 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 24 Jul 2017 09:01:17 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6O92BLq084181; Mon, 24 Jul 2017 17:02:11 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017072417021216-4675138 ; Mon, 24 Jul 2017 17:02:12 +0800 X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170724170117 From: Peng Hao To: mst@redhat.com, pbonzini@redhat.com Date: Tue, 25 Jul 2017 01:15:40 +0800 Message-Id: <1500916540-33510-1-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-24 17:02:13, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-24 17:02:11, Serialize complete at 2017-07-24 17:02:11 X-MAIL: mse01.zte.com.cn v6O92BLq084181 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 202.103.147.172 Subject: [Qemu-devel] [PATCH] rtc: fix a infinite loop in windows vm startup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Hao , Liu Yi , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When a windows vm starts, periodic timer of rtc will stop several times. windows kernel will check whether REG_A_UIP is changed. REG_C's interrupt flags will not be cleared when periodic timer stops and the update timer will switch to alarm timer. So the expiration time of alarm timer is very long and REG_A_UIP will not vary.At last windows kernel will repeat to=20 check REG_A_UIP all the time. Signed-off-by: Peng Hao Signed-off-by: Liu Yi --- hw/timer/mc146818rtc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 1b8d3d7..aa55fae 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -457,6 +457,8 @@ static void rtc_update_timer(void *opaque) if ((new_irqs & s->cmos_data[RTC_REG_B]) !=3D 0) { s->cmos_data[RTC_REG_C] |=3D REG_C_IRQF; qemu_irq_raise(s->irq); + } else if (s->cmos_data[RTC_REG_B] & REG_B_UIE =3D=3D 0) { + cmos_data[RTC_REG_C] &=3D ~REG_C_UF; } check_update_timer(s); } @@ -559,7 +561,7 @@ static void cmos_ioport_write(void *opaque, hwaddr addr, s->cmos_data[RTC_REG_C] |=3D REG_C_IRQF; qemu_irq_raise(s->irq); } else { - s->cmos_data[RTC_REG_C] &=3D ~REG_C_IRQF; + s->cmos_data[RTC_REG_C] &=3D ~(REG_C_UF | REG_C_IRQF); qemu_irq_lower(s->irq); } s->cmos_data[RTC_REG_B] =3D data; --=20 1.8.3.1