From patchwork Mon Jun 10 07:55:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 250189 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 62A342C037B for ; Mon, 10 Jun 2013 18:04:17 +1000 (EST) Received: from localhost ([::1]:53788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulx5K-00078o-PX for incoming@patchwork.ozlabs.org; Mon, 10 Jun 2013 04:04:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulx4z-00075c-NH for qemu-devel@nongnu.org; Mon, 10 Jun 2013 04:04:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ulx4r-0007uL-EF for qemu-devel@nongnu.org; Mon, 10 Jun 2013 04:03:53 -0400 Received: from va3ehsobe010.messaging.microsoft.com ([216.32.180.30]:34549 helo=va3outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulx4i-0007ru-0D; Mon, 10 Jun 2013 04:03:36 -0400 Received: from mail170-va3-R.bigfish.com (10.7.14.250) by VA3EHSOBE011.bigfish.com (10.7.40.61) with Microsoft SMTP Server id 14.1.225.23; Mon, 10 Jun 2013 07:48:32 +0000 Received: from mail170-va3 (localhost [127.0.0.1]) by mail170-va3-R.bigfish.com (Postfix) with ESMTP id 0D105A00F3; Mon, 10 Jun 2013 07:48:32 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6h1082kzz8275bhz2dh2a8h668h839he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh1e23h1155h) Received: from mail170-va3 (localhost.localdomain [127.0.0.1]) by mail170-va3 (MessageSwitch) id 1370850509517731_17823; Mon, 10 Jun 2013 07:48:29 +0000 (UTC) Received: from VA3EHSMHS032.bigfish.com (unknown [10.7.14.233]) by mail170-va3.bigfish.com (Postfix) with ESMTP id 7A499260068; Mon, 10 Jun 2013 07:48:29 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS032.bigfish.com (10.7.99.42) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 10 Jun 2013 07:48:29 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.328.11; Mon, 10 Jun 2013 07:48:28 +0000 Received: from freescale.com ([10.232.15.72]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with SMTP id r5A7mOHL016485; Mon, 10 Jun 2013 00:48:25 -0700 Received: by freescale.com (sSMTP sendmail emulation); Mon, 10 Jun 2013 13:25:20 +0530 From: Bharat Bhushan To: , , , Date: Mon, 10 Jun 2013 13:25:18 +0530 Message-ID: <1370850918-18687-1-git-send-email-Bharat.Bhushan@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 216.32.180.30 Cc: Bharat Bhushan Subject: [Qemu-devel] [PATCH v2]booke: timer: Deactivate timer for target_bit above 61 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 QEMU timer supports a maximum timer of INT64_MAX. So starting timer only for time which is calculated using target_bit < 62 and deactivate/stop timer if the target bit is above 61. This patch also fix the time calculation from target_bit. The code was doing (1 << (target_bit + 1)) while this should be (1ULL << (target_bit + 1)). Signed-off-by: Bharat Bhushan --- v1->v2 - Added "booke: timer:" in patch subject hw/ppc/ppc_booke.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index e41b036..f4eda15 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -133,9 +133,15 @@ static void booke_update_fixed_timer(CPUPPCState *env, ppc_tb_t *tb_env = env->tb_env; uint64_t lapse; uint64_t tb; - uint64_t period = 1 << (target_bit + 1); + uint64_t period; uint64_t now; + /* Deactivate timer for target_bit > 61 */ + if (target_bit > 61) + return; + + period = 1ULL << (target_bit + 1); + now = qemu_get_clock_ns(vm_clock); tb = cpu_ppc_get_tb(tb_env, now, tb_env->tb_offset);