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: 50708 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74370218EA for ; Mon, 6 Jul 2015 10:04:00 +0000 (UTC) Received: by widjy10 with SMTP id jy10sf50161732wid.3 for ; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=GlRY4Umt+soVERwteE8pX6Uae3a0nD/O035PJ8NblxQ=; b=cyP991hbX83qcQRDgqMqXEqrsb/v8nW1jpTYdkrnL6FBK1/oS/AIC1kbJN9CN/Oav2 YVrv8RsM65tD+eMW63/6OyWG831aN9Xfd1u6K7ZrNH4+gsOsrcFxtS1hraQjvfZEq3TO e9dc8ns2iBbWXjE1W6g+pdMBiFIhy1HFUNKOGbqkiLffEHl5xX6cPXzzTekKhQNFDQ5Z aaNUHozPFRvr5MQWfHA2LWVEloORTV6/t6+d1Tqska4X3SwmzQ7QuECSIr7uZbtOguh3 UP6/SBZmBckkXY+APOeP8L84MUAa5rHHHusBbSx8CI+fZxPJ0VXY5At6J1WuXGqFz+cE CZQA== X-Gm-Message-State: ALoCoQlMX96IP62q/kYn9Hfk8ZBLLVhfbDgqC+ROBve0EbRcdBYRhbcMcVzpSanuN36JyifNpm3E X-Received: by 10.112.14.101 with SMTP id o5mr30032249lbc.3.1436177039746; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.230 with SMTP id y6ls722052lae.20.gmail; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) X-Received: by 10.112.218.67 with SMTP id pe3mr42868642lbc.53.1436177039471; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id ko2si14861612lbb.43.2015.07.06.03.03.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:03:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lazt12 with SMTP id t12so3116959laz.2 for ; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) X-Received: by 10.112.234.200 with SMTP id ug8mr47871395lbc.117.1436177039053; Mon, 06 Jul 2015 03:03:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1614730lbb; Mon, 6 Jul 2015 03:03:57 -0700 (PDT) X-Received: by 10.68.203.197 with SMTP id ks5mr103719382pbc.51.1436177037027; Mon, 06 Jul 2015 03:03:57 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id ca1si28181155pbb.169.2015.07.06.03.03.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 03:03:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZC3Fj-0003MY-4R for patch@linaro.org; Mon, 06 Jul 2015 06:03:55 -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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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); }