[PATCH v1] Ftrace: arm/arm64: Define a new arm/arm64 trace clock source based on CNTPCT/CNTPCT_EL0 register.

Amit Tomer amittomer25 at gmail.com
Thu Oct 29 06:47:31 PDT 2015


> Regardless of the host, you cannot know whether it is safe to access
> in a guest. It could bring down the system.
>
> The host kernel could safely access the physical counter were it booted
> at EL2, because it could grant itself access.

May be I am totally wrong here but it doesn't look to be good . if
Linux image does not boot at hyp mode,
there is no way to use arch timers, Not true?

But I could see even if Linux image booted in EL1 has the access to
Physical timer/counters that is
been allowed by firmware it self.

ENTRY(armv8_switch_to_el1)
        switch_el x0, 0f, 1f, 0f
0:      ret
1:
        /* Initialize Generic Timers */
        mrs     x0, cnthctl_el2
        orr     x0, x0, #0x3            /* Enable EL1 access to timers */
        msr     cnthctl_el2, x0
        msr     cntvoff_el2, x0
        mrs     x0, cntkctl_el1
        orr     x0, x0, #0x3            /* Enable EL0 access to timers */
        msr     cntkctl_el1, x0

Sorry, if it's just all stupid.

Thanks,
Amit.



More information about the linux-arm-kernel mailing list