From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiMbV-0000EI-Na for qemu-devel@nongnu.org; Sat, 03 Oct 2015 09:11:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiMbS-0001jx-FR for qemu-devel@nongnu.org; Sat, 03 Oct 2015 09:11:57 -0400 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:34417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiMbS-0001jc-84 for qemu-devel@nongnu.org; Sat, 03 Oct 2015 09:11:54 -0400 Received: by labzv5 with SMTP id zv5so105416369lab.1 for ; Sat, 03 Oct 2015 06:11:50 -0700 (PDT) References: <1436128000-16262-1-git-send-email-crosthwaite.peter@gmail.com> <559997FB.4030301@gmail.com> From: Dmitry Osipenko Message-ID: <560FD3FF.3040206@gmail.com> Date: Sat, 3 Oct 2015 16:11:28 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v1 0/2] ARM MPTimer fixes and refactoring List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , "qemu-devel@nongnu.org Developers" , Peter Crosthwaite 20.09.2015 20:48, Peter Crosthwaite пишет: > On Sun, Jul 5, 2015 at 1:58 PM, Peter Crosthwaite > wrote: >> On Sun, Jul 5, 2015 at 1:47 PM, Dmitry Osipenko wrote: >>> 05.07.2015 23:26, Peter Crosthwaite пишет: >>> >>>> Hi Dmitry, >>>> >>>> Based on my comment earlier, this is what I came up with RE consolidation >>>> of >>>> those arm_mptimer code paths that were giving you problems. I have not >>>> done the >>>> interrupt mask fix, as that one from your series is reasonably >>>> independent. >>>> >>>> Regards, >>>> Peter >>>> >>>> Peter Crosthwaite (2): >>>> timer: arm_mp: Factor out timer value calculation >>>> timer: arm_mp: consolidate control and counter write logic >>>> >>>> hw/timer/arm_mptimer.c | 73 >>>> +++++++++++++++++++++++++++++--------------------- >>>> 1 file changed, 42 insertions(+), 31 deletions(-) >>>> >>> >>> Hi Peter, thanks a lot! Generally, I don't have any trouble with currently >>> missed functionality, just noticed it while was hacking my NVIDIA Tegra2 >>> emulation pet-project and decided to contribute =). >>> >>> It looks like you are trying to duplicate what generic ptimer is already >>> doing, isn't it? >>> >> >> Yes, ptimer was probably the correct way to do this in the first >> place. Some of the new code structures introduced in this patch series >> are directly applicable though for that conversion effort. >> > > I looked into doing this with ptimer, and pitmer doesn't really play > nice with periodic down counters. You could do the subtractions > against an up counter with the load value but that seems just as > complex as the current solution IMO. The hardest part is setting the > counter value on an already running timer. > > The alternative is to patch ptimer to handle down timers. > > Regards, > Peter > Hmm, I think you missed something. Ptimer is doing downcount, not up. ptimer_get_count() might be a misnomer, it returns current timer value (it goes down to 0), not a passed ticks count number. Ptimer also should handle reloading of a running timer just fine with ptimer_set_count(), don't see any trouble here. Anyway, I'll try to re-implement MPtimer using ptimer ASAP and see how it really fits. -- Dmitry