[PATCH 09/10] arm64: move from arm_generic to arm_arch_timer

Will Deacon will.deacon at arm.com
Fri Nov 30 14:36:02 EST 2012


On Fri, Nov 30, 2012 at 05:46:07PM +0000, Mark Rutland wrote:
> The arch_timer driver supports a superset of the functionality of the
> arm_generic driver, and is not tied to a particular arch.
> 
> This patch moves arm64 to use the arch_timer driver, gaining additional
> functionality in doing so, and removes the (now unused) arm_generic
> driver. Timer-related hooks specific to arm64 are moved into
> arch/arm64/kernel/time.c.
> 
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Acked-by: Catalin Marinas <catalin.marinas at arm.com>
> Acked-by: Marc Zyngier <marc.zyngier at arm.com>

[...]

> +static inline void __cpuinit arch_counter_enable_user_access(void)
> +{
> +       u32 cntkctl;
> +
> +       /* Disable user access to the timers and the virtual counter. */
> +       asm volatile("mrs       %0, cntkctl_el1" : "=r" (cntkctl));
> +       cntkctl &= ~((3 << 8) | (1 << 1));
> +
> +       /* Enable user access to the physical counter and frequency. */
> +       cntkctl |= 1;
> +       asm volatile("msr       cntkctl_el1, %0" : : "r" (cntkctl));
> +}

We need to be careful here as I have some patches pending which change the
vdso to use the virtual counter, rather than the physical one (updating
drivers/clocksource/arm_generic.c in the process).

*Hopefully* we'll conflict and the fixup will do the right thing, but I
thought I'd better raise it in case the vdso and the timer driver get
out-of-sync and we start SIGILLing userspace!

Take a look at my aarch64/vdso branch.

Will



More information about the linux-arm-kernel mailing list