From patchwork Tue Jun 30 11:58:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schlatow X-Patchwork-Id: 489739 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 182B91402AB for ; Wed, 1 Jul 2015 00:28:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ida.ing.tu-bs.de header.i=@ida.ing.tu-bs.de header.b=tFi102S3; dkim-atps=neutral Received: from localhost ([::1]:47299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9wWS-0002Dx-Pu for incoming@patchwork.ozlabs.org; Tue, 30 Jun 2015 10:28:28 -0400 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 Received: from localhost (localhost.localdomain [127.0.0.1]) by bender.ida.ing.tu-bs.de (8.14.4/8.14.4) with ESMTP id t5UBwJ85001190; Tue, 30 Jun 2015 13:58:19 +0200 Authentication-Results: bender.ida.ing.tu-bs.de (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=ida.ing.tu-bs.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ida.ing.tu-bs.de; h=content-transfer-encoding:content-type:content-type :mime-version:x-mailer:message-id:subject:subject:from:from:date :date:received:received; s=ida1; t=1435665493; bh=eluOha34H5qkoB v9Vn4cER2N0gKOle9MZo9oDAvuUqo=; b=tFi102S3SASh8FpCLkJx8kAjiEwnyb TRpIedUvsznKShQbpzuUg37lN85MDIbw8nmvU4ivWnYAkP5V2pJw+MsFj4HB3xlh ynPIo6V0zdxiVbUTXnVWoWPw3sKR0WAzy9xsp7FCdONSSj3HWqqM/VoavgwBHOY9 mnVRgdCfQEDrk= X-Virus-Scanned: amavisd-new at ida.ing.tu-bs.de Received: from bender.ida.ing.tu-bs.de ([127.0.0.1]) by localhost (bender.ida.ing.tu-bs.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NOj-cVMVB8sL; Tue, 30 Jun 2015 13:58:13 +0200 (CEST) Received: from johanness-latitude (dhcp139.event.etc.tu-bs.de [134.169.60.139]) (authenticated bits=0) by bender.ida.ing.tu-bs.de (8.14.4/8.14.4/RX) with ESMTP id t5UBw9Lj001176 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 30 Jun 2015 13:58:10 +0200 Date: Tue, 30 Jun 2015 13:58:21 +0200 From: Johannes Schlatow To: qemu-devel@nongnu.org Message-ID: <20150630135821.51f3b4fd@johanness-latitude> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-unknown-linux-gnu) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 134.169.117.232 X-Mailman-Approved-At: Tue, 30 Jun 2015 10:27:52 -0400 Cc: Peter Crosthwaite Subject: [Qemu-devel] [PATCH] 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 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 Reviewed-by: Peter Crosthwaite --- 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); }