From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBm1E-0002gv-Og for qemu-devel@nongnu.org; Sun, 05 Jul 2015 11:39:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBm1A-0006qN-P8 for qemu-devel@nongnu.org; Sun, 05 Jul 2015 11:39:48 -0400 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]:36668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBm1A-0006qD-GT for qemu-devel@nongnu.org; Sun, 05 Jul 2015 11:39:44 -0400 Received: by lagc2 with SMTP id c2so129092313lag.3 for ; Sun, 05 Jul 2015 08:39:43 -0700 (PDT) From: Dmitry Osipenko Date: Sun, 5 Jul 2015 18:39:02 +0300 Message-Id: <1436110742-6190-3-git-send-email-digetx@gmail.com> In-Reply-To: <1436110742-6190-1-git-send-email-digetx@gmail.com> References: <1435877531-24983-1-git-send-email-digetx@gmail.com> <1436110742-6190-1-git-send-email-digetx@gmail.com> Subject: [Qemu-devel] [PATCH v2 2/2] arm_mptimer: Respect IT bit state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , Peter Maydell Cc: Paolo Bonzini , QEMU Developers Timer should fire interrupt only if IT(interrupt enable) bit state of control register is enabled and timer should update IRQ status on IT bit change as it would mask/unmask the interrupt line. Signed-off-by: Dmitry Osipenko --- v2: Added missed IRQ status update on control register write as per Peter Crosthwaite comment. hw/timer/arm_mptimer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 0e132b1..22fa46e 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -38,7 +38,7 @@ static inline int get_current_cpu(ARMMPTimerState *s) static inline void timerblock_update_irq(TimerBlock *tb) { - qemu_set_irq(tb->irq, tb->status); + qemu_set_irq(tb->irq, tb->status && (tb->control & 4)); } /* Return conversion factor from mpcore timer ticks to qemu timer ticks. */ @@ -122,6 +122,9 @@ static void timerblock_write(void *opaque, hwaddr addr, case 8: /* Control. */ old = tb->control; tb->control = value; + if ((old & 4) != (value & 4)) { + timerblock_update_irq(tb); + } if (value & 1) { if ((old & 1) && (tb->count != 0)) { /* Do nothing if timer is ticking right now. */ -- 2.4.4