From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czTOP-0002vg-EU for qemu-devel@nongnu.org; Sat, 15 Apr 2017 15:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czTOL-0003lc-Fs for qemu-devel@nongnu.org; Sat, 15 Apr 2017 15:29:57 -0400 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]:33591) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1czTOL-0003l6-C9 for qemu-devel@nongnu.org; Sat, 15 Apr 2017 15:29:53 -0400 Received: by mail-yw0-x242.google.com with SMTP id l189so7780727ywb.0 for ; Sat, 15 Apr 2017 12:29:53 -0700 (PDT) From: Pranith Kumar Date: Sat, 15 Apr 2017 15:29:30 -0400 Message-Id: <20170415192930.1443-1-bobby.prani@gmail.com> Subject: [Qemu-devel] [PATCH] timer.h: Provide monotonic time for ARM guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Cao jin , Michael Tokarev , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Edgar E. Iglesias" , "open list:All patches CC here" Tested and confirmed that the stretch i386 debian qcow2 image on a raspberry pi 2 works. Fixes: LP#: 893208 Signed-off-by: Pranith Kumar --- include/qemu/timer.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index e1742f2f3d..14c9558da4 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -1015,6 +1015,16 @@ static inline int64_t cpu_get_host_ticks(void) return cur - ofs; } +#elif defined(__arm__) || defined(__aarch64__) + +/* ARM does not have a user-space readble cycle counter available. + * This is a compromise to get monotonically increasing time. + */ +static inline int64_t cpu_get_host_ticks(void) +{ + return get_clock(); +} + #else /* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing value. This will be -- 2.11.0