From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ah1SI-0006Al-2X for qemu-devel@nongnu.org; Fri, 18 Mar 2016 16:57:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ah1SD-0005L5-0I for qemu-devel@nongnu.org; Fri, 18 Mar 2016 16:57:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:36915) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ah1SC-0005Kz-Qw for qemu-devel@nongnu.org; Fri, 18 Mar 2016 16:57:04 -0400 From: Christopher Covington Date: Fri, 18 Mar 2016 16:56:39 -0400 Message-Id: <1458334599-9857-1-git-send-email-cov@codeaurora.org> In-Reply-To: <20160311091553.26911.633.malone@chaenomeles.canonical.com> References: <20160311091553.26911.633.malone@chaenomeles.canonical.com> Subject: [Qemu-devel] [RFC] Use cpu_get_icount as cpu_get_host_ticks fallback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Zack Callendish , 893208@bugs.launchpad.net, Christopher Covington The previous increment-on-read fallback didn't increment fast enough for some versions of grub. https://bugs.launchpad.net/qemu-linaro/+bug/893208 Signed-off-by: Christopher Covington --- I unfortunately don't have the opportunity to fully test this right now, but I'm sending it out nevertheless on the off chance that someone else might. --- include/qemu/timer.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index d0946cb..60c6dd6 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -998,13 +998,12 @@ static inline int64_t cpu_get_host_ticks(void) } #else -/* The host CPU doesn't have an easily accessible cycle counter. - Just return a monotonically increasing value. This will be - totally wrong, but hopefully better than nothing. */ +/* The host CPU doesn't have an easily accessible cycle counter, so just return + the instruction count. This may make the CPU look like it has an IPC of + exactly 1, but that shouldn't cause any functional problems. */ static inline int64_t cpu_get_host_ticks (void) { - static int64_t ticks = 0; - return ticks++; + return cpu_get_icount(); } #endif -- Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project