From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ulwnm-0002Xv-HD for qemu-devel@nongnu.org; Mon, 10 Jun 2013 03:46:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ulwni-0001kB-7E for qemu-devel@nongnu.org; Mon, 10 Jun 2013 03:46:06 -0400 From: Bharat Bhushan Date: Mon, 10 Jun 2013 13:22:31 +0530 Message-ID: <1370850751-18650-1-git-send-email-Bharat.Bhushan@freescale.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH] Deactivate timer for target_bit above 61 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de, scottwood@freescale.com Cc: Bharat Bhushan 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 --- 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); -- 1.7.0.4