From patchwork Fri Mar 18 20:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 8623731 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC93A9F44D for ; Fri, 18 Mar 2016 20:57:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24569202BE for ; Fri, 18 Mar 2016 20:57:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B0A72028D for ; Fri, 18 Mar 2016 20:57:18 +0000 (UTC) Received: from localhost ([::1]:46263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ah1SP-0006FH-4U for patchwork-qemu-devel@patchwork.kernel.org; Fri, 18 Mar 2016 16:57:17 -0400 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 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id DC1E360286; Fri, 18 Mar 2016 20:57:02 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C762060269; Fri, 18 Mar 2016 20:57:02 +0000 (UTC) Received: from keeshans.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cov@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BF2C460222; Fri, 18 Mar 2016 20:57:01 +0000 (UTC) From: Christopher Covington To: qemu-devel@nongnu.org Date: Fri, 18 Mar 2016 16:56:39 -0400 Message-Id: <1458334599-9857-1-git-send-email-cov@codeaurora.org> X-Mailer: git-send-email 1.8.1.1 In-Reply-To: <20160311091553.26911.633.malone@chaenomeles.canonical.com> References: <20160311091553.26911.633.malone@chaenomeles.canonical.com> X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 198.145.29.96 Cc: Peter Maydell , Zack Callendish , 893208@bugs.launchpad.net, Christopher Covington Subject: [Qemu-devel] [RFC] Use cpu_get_icount as cpu_get_host_ticks fallback 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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