From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlbPG-0007qs-Df for qemu-devel@nongnu.org; Fri, 13 Jan 2012 02:18:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlbPF-0004Rr-5g for qemu-devel@nongnu.org; Fri, 13 Jan 2012 02:18:34 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:39626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlbPE-0004RV-Sh for qemu-devel@nongnu.org; Fri, 13 Jan 2012 02:18:33 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1; format=flowed Received: from euspt1 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0LXQ002KS6YSZN20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 13 Jan 2012 07:18:28 +0000 (GMT) Received: from [106.109.8.195] by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LXQ002DI6YRNI@spt1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 13 Jan 2012 07:18:28 +0000 (GMT) Date: Fri, 13 Jan 2012 11:18:23 +0400 From: Evgeny Voevodin In-reply-to: <1323103220-1636-2-git-send-email-peter.maydell@linaro.org> Message-id: <4F0FDABF.4070303@samsung.com> References: <1323103220-1636-1-git-send-email-peter.maydell@linaro.org> <1323103220-1636-2-git-send-email-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH 1/7] hw/arm_mptimer.c: Turn ARM MPcore private timers into qdev devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Bill Carson , Dmitry Solodkiy , qemu-devel@nongnu.org, patches@linaro.org On 12/05/2011 08:40 PM, Peter Maydell wrote: > -/* Return conversion factor from mpcore timer ticks to qemu timer ticks. */ > -static inline uint32_t mpcore_timer_scale(mpcore_timer_state *s) > -{ > - return (((s->control>> 8)& 0xff) + 1) * 10; > -} Dear Peter, could you please explain why such a conversion used to gain qemu ticks from mpcore timer ticks, actually why to multiply by 10? AFAIK by default to get timer ticks QEMU uses host's time. Also cortex documentation says that mpcore timer tick interval should be calculated in this way: ((prescaler + 1) * (load + 1))/freq Later mpcore_timer_reload uses this code to update QEMU ticks: > - s->tick += (int64_t)s->count * mpcore_timer_scale(s); I see that equation has transformed to: (prescaler * load) * 10 As I understand, this means that arm core internal timer is working at frequency 10 times less (in ideal) then host. -- Kind regards, Evgeny Voevodin, Leading Software Engineer, ASWG, Moscow R&D center, Samsung Electronics e-mail: e.voevodin@samsung.com