From patchwork Mon Nov 21 18:00:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 126885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7BB6DB7212 for ; Tue, 22 Nov 2011 05:01:14 +1100 (EST) Received: from localhost ([::1]:55903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSYB2-00078L-OD for incoming@patchwork.ozlabs.org; Mon, 21 Nov 2011 13:01:08 -0500 Received: from eggs.gnu.org ([140.186.70.92]:45941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSYAk-0006nf-6R for qemu-devel@nongnu.org; Mon, 21 Nov 2011 13:00:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSYAi-0006t0-Jg for qemu-devel@nongnu.org; Mon, 21 Nov 2011 13:00:50 -0500 Received: from mail-qw0-f52.google.com ([209.85.216.52]:57194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSYAi-0006qo-Gf for qemu-devel@nongnu.org; Mon, 21 Nov 2011 13:00:48 -0500 Received: by mail-qw0-f52.google.com with SMTP id z3so498993qad.4 for ; Mon, 21 Nov 2011 10:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=3p+LMcQRHSnBJ65gucmeJ2nWCPtL0jPqttlCjpX7Pak=; b=kerAkdda3WpeFnFHXiwd84Ao+ksKZ0iqv0wUBl5pDpKgaoinsH93/DvDtuJx5EL22c V/ZsWGSL7Y4DrEd6DIigSvnPQVrV24aCh/fxQdimroOaVzXHM0IZ42fby5zSoaxTiNOv kE91LSkTjfZmhQkWMRjo7B/UQkORk9vKIL+70= Received: by 10.229.68.204 with SMTP id w12mr1566128qci.206.1321898448197; Mon, 21 Nov 2011 10:00:48 -0800 (PST) Received: from localhost.localdomain (93-34-207-114.ip51.fastwebnet.it. [93.34.207.114]) by mx.google.com with ESMTPS id dm3sm11194101qab.12.2011.11.21.10.00.46 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Nov 2011 10:00:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 21 Nov 2011 19:00:31 +0100 Message-Id: <1321898431-18449-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.7.1 In-Reply-To: <1321898431-18449-1-git-send-email-pbonzini@redhat.com> References: <1321898431-18449-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.216.52 Subject: [Qemu-devel] [PATCH 4/4] rtc: clear non-PF bits when reinjecting on ack X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When an rtc interrupt is reinjected immediately after being acked, other interrupts should not be reinjected, so do clear their bits. Also, if the periodic interrupts have been disabled before acking, do not reinject, as the guest might get very confused! Signed-off-by: Paolo Bonzini --- hw/mc146818rtc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index b942ce2..5d17cca 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -479,10 +479,13 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr) case RTC_REG_C: ret = s->cmos_data[s->cmos_index]; qemu_irq_lower(s->irq); + s->cmos_data[RTC_REG_C] = 0x00; #ifdef TARGET_I386 if(s->irq_coalesced && + (s->cmos_data[RTC_REG_B] & REG_B_PIE) && s->irq_reinject_on_ack_count < RTC_REINJECT_ON_ACK_COUNT) { s->irq_reinject_on_ack_count++; + s->cmos_data[RTC_REG_C] |= REG_C_IRQF | REG_C_PF; apic_reset_irq_delivered(); DPRINTF_C("cmos: injecting on ack\n"); qemu_irq_raise(s->irq); @@ -491,11 +494,8 @@ static uint32_t cmos_ioport_read(void *opaque, uint32_t addr) DPRINTF_C("cmos: coalesced irqs decreased to %d\n", s->irq_coalesced); } - break; } #endif - - s->cmos_data[RTC_REG_C] = 0x00; break; default: ret = s->cmos_data[s->cmos_index];