From patchwork Mon Jul 6 09:59:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 491525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 97A66140DB5 for ; Mon, 6 Jul 2015 20:03:42 +1000 (AEST) Received: from localhost ([::1]:49837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3FU-0003MY-Ik for incoming@patchwork.ozlabs.org; Mon, 06 Jul 2015 06:03:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3Bk-0005Ze-Lf for qemu-devel@nongnu.org; Mon, 06 Jul 2015 05:59:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZC3Bi-0003Qw-D9 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 05:59:48 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3Bi-0003HN-6P for qemu-devel@nongnu.org; Mon, 06 Jul 2015 05:59:46 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZC3BX-0007h8-R4 for qemu-devel@nongnu.org; Mon, 06 Jul 2015 10:59:35 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 6 Jul 2015 10:59:30 +0100 Message-Id: <1436176775-29545-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1436176775-29545-1-git-send-email-peter.maydell@linaro.org> References: <1436176775-29545-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 2/7] Fix interval interrupt of cadence ttc when timer is in decrement mode 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 From: Johannes Schlatow The interval interrupt is not set if the timer is in decrement mode. This is because x >=0 and x < interval after leaving the while-loop. Signed-off-by: Johannes Schlatow Message-id: 20150630135821.51f3b4fd@johanness-latitude Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell --- hw/timer/cadence_ttc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index d46db3c..35bc880 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -208,15 +208,14 @@ static void cadence_timer_sync(CadenceTimerState *s) s->reg_intr |= (2 << i); } } + if ((x < 0) || (x >= interval)) { + s->reg_intr |= (s->reg_count & COUNTER_CTRL_INT) ? + COUNTER_INTR_IV : COUNTER_INTR_OV; + } while (x < 0) { x += interval; } s->reg_value = (uint32_t)(x % interval); - - if (s->reg_value != x) { - s->reg_intr |= (s->reg_count & COUNTER_CTRL_INT) ? - COUNTER_INTR_IV : COUNTER_INTR_OV; - } cadence_timer_update(s); }