From patchwork Mon Jul 24 17:32:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Hao X-Patchwork-Id: 9859027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8690A600F5 for ; Mon, 24 Jul 2017 09:22:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 784C128516 for ; Mon, 24 Jul 2017 09:22:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D26D2858A; Mon, 24 Jul 2017 09:22:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DAA2B28590 for ; Mon, 24 Jul 2017 09:22:10 +0000 (UTC) Received: from localhost ([::1]:53694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZZ3-0005yH-V6 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Jul 2017 05:22:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZYT-0005yC-Q0 for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZZYP-0002vu-8i for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:21:33 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:54422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZZYO-0002uv-LI for qemu-devel@nongnu.org; Mon, 24 Jul 2017 05:21:29 -0400 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,20170724171043 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 24 Jul 2017 09:10:43 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v6O9K951047826; Mon, 24 Jul 2017 17:20:09 +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 2017072417201193-4684186 ; Mon, 24 Jul 2017 17:20:11 +0800 From: Peng Hao To: mst@redhat.com, pbonzini@redhat.com Date: Tue, 25 Jul 2017 01:32:37 +0800 Message-Id: <1500917557-34253-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:20:12, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-07-24 17:20:09, Serialize complete at 2017-07-24 17:20:09 X-MAIL: mse01.zte.com.cn v6O9K951047826 X-HQIP: 127.0.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 63.217.80.70 Subject: [Qemu-devel] [PATCH V2] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 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]) != 0) { s->cmos_data[RTC_REG_C] |= REG_C_IRQF; qemu_irq_raise(s->irq); + } else if ((s->cmos_data[RTC_REG_B] & REG_B_UIE) == 0) { + cmos_data[RTC_REG_C] &= ~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] |= REG_C_IRQF; qemu_irq_raise(s->irq); } else { - s->cmos_data[RTC_REG_C] &= ~REG_C_IRQF; + s->cmos_data[RTC_REG_C] &= ~(REG_C_UF | REG_C_IRQF); qemu_irq_lower(s->irq); } s->cmos_data[RTC_REG_B] = data;