PATCH: get_cyclecount() on ARMv6 and better
Aleksandr Rybalko
ray at freebsd.org
Sat Aug 3 22:15:42 UTC 2013
On Sat, 3 Aug 2013 12:01:14 -0600
Warner Losh <imp at 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 at 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 at freebsd.org>
More information about the freebsd-arm
mailing list