Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Aug 2013 01:15:35 +0300
From:      Aleksandr Rybalko <ray@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        "freebsd-arm@freebsd.org" <arm@freebsd.org>, Mark R V Murray <mark@grondar.org>
Subject:   Re: PATCH: get_cyclecount() on ARMv6 and better
Message-ID:  <20130804011535.b87e1f39.ray@freebsd.org>
In-Reply-To: <9342F2DA-2A30-4209-B8C6-A43F194852DA@bsdimp.com>
References:  <78D22A66-86E5-43B1-ABCA-7BF14F8061AB@grondar.org> <20130803145135.38196156.ray@freebsd.org> <E173CC12-0008-408B-B6BC-9FA162051C9F@grondar.org> <9342F2DA-2A30-4209-B8C6-A43F194852DA@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 3 Aug 2013 12:01:14 -0600
Warner Losh <imp@bsdimp.com> wrote:

> 
> On Aug 3, 2013, at 6:26 AM, Mark R V Murray wrote:
> 
> > 
> > On 3 Aug 2013, at 12:51, Aleksandr Rybalko <ray@freebsd.org> wrote:
> >> Hi Mark!
> >> 
> >> Do we setup Performance Monitor Control Register before use that
> >> counter?
> > 
> > I've read up on PNMC register now, an looked for it in the code,
> > and unless it is very well hidden, then NO, we don't set it up.
> > 
> > I've read now what I need to do; where is the best place do do it?
> > I suspect it should be in start-up code right when the ARM is
> > starting up; is that a good guess?
> 
> I'd make a timecounter for this, and put that in its initialization
> code.
> 
> Warner

Since it's PMU register, then better to do PMU driver for it, even if
it will have only one feature - read counter. Otherwise you can't
depend on it, because you can't guarantee that nobody not disable PMU
after use. 

Another potential useful thing, not to close it under #ifdef ARMv6, but
check ARM processor Feature registers.
MRC p15, 0, <Rt>, c0, c1, 2; Read Debug Feature Register 0 
Here is [27:24] bits - Performance monitor model, zero - lack of PMU.
But unfortunately, Cortex-A8 have no such bits, but have CCNT reg. :)

WBW
-- 
Aleksandr Rybalko <ray@freebsd.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130804011535.b87e1f39.ray>