From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfCRc-0000B4-LM for qemu-devel@nongnu.org; Thu, 24 Sep 2015 15:44:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfCRZ-0007LN-Do for qemu-devel@nongnu.org; Thu, 24 Sep 2015 15:44:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfCRZ-0007LJ-98 for qemu-devel@nongnu.org; Thu, 24 Sep 2015 15:44:37 -0400 From: Christopher Covington Date: Thu, 24 Sep 2015 15:43:44 -0400 Message-Id: <1443123824-26866-1-git-send-email-cov@codeaurora.org> In-Reply-To: <1430417667-4245-5-git-send-email-christopher.covington@linaro.org> References: <1430417667-4245-5-git-send-email-christopher.covington@linaro.org> Subject: [Qemu-devel] [PATCH] target-arm: Use common CPU cycle infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, crosthwaitepeter@gmail.com, Christopher Covington , alistair.francis@xilinx.com cpu_get_ticks() provides a common interface across targets for calculating CPU cycles. Using this fixes PMCCNTR reads when -icount is specified (previously a non-increasing value was returned). Signed-off-by: Christopher Covington --- target-arm/helper.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 7dc49cb..32923fb 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -729,8 +729,7 @@ void pmccntr_sync(CPUARMState *env) { uint64_t temp_ticks; - temp_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL), - get_ticks_per_sec(), 1000000); + temp_ticks = cpu_get_ticks(); if (env->cp15.c9_pmcr & PMCRD) { /* Increment once every 64 processor clock cycles */ @@ -768,8 +767,7 @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri) return env->cp15.c15_ccnt; } - total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL), - get_ticks_per_sec(), 1000000); + total_ticks = cpu_get_ticks(); if (env->cp15.c9_pmcr & PMCRD) { /* Increment once every 64 processor clock cycles */ @@ -789,8 +787,7 @@ static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri, return; } - total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL), - get_ticks_per_sec(), 1000000); + total_ticks = cpu_get_ticks(); if (env->cp15.c9_pmcr & PMCRD) { /* Increment once every 64 processor clock cycles */ -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project