From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9uBG-0004fK-PS for qemu-devel@nongnu.org; Tue, 30 Jun 2015 07:58:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9uBB-0004pp-Mt for qemu-devel@nongnu.org; Tue, 30 Jun 2015 07:58:26 -0400 Received: from bender.ida.ing.tu-bs.de ([134.169.117.232]:55887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9uBB-0004pI-9p for qemu-devel@nongnu.org; Tue, 30 Jun 2015 07:58:21 -0400 Date: Tue, 30 Jun 2015 13:58:21 +0200 From: Johannes Schlatow Message-ID: <20150630135821.51f3b4fd@johanness-latitude> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] Fix interval interrupt of cadence ttc when timer is in decrement mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite 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 --- 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); } -- 2.4.5