Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff9272c1 authored by Nathan Lynch's avatar Nathan Lynch Committed by Matt Wagantall
Browse files

clocksource: arm_arch_timer: Enable counter access for 32-bit ARM



The only difference between arm and arm64's implementations of
arch_counter_set_user_access is that 32-bit ARM does not enable user
access to the virtual counter.  We want to enable this access for the
32-bit ARM VDSO, so copy the arm64 version to the driver itself, and
remove the arch-specific implementations.

Change-Id: Iddeefaba3c9b9e57344c6b2cef27c766a4bd686b
Signed-off-by: default avatarNathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Git-commit: 8b8dde00347ef409b29abd97e5833ffdb4ed7508
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[mattw@codeaurora.org: resolved trivial context conflicts]
Signed-off-by: default avatarMatt Wagantall <mattw@codeaurora.org>
parent 57301a09
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -111,20 +111,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
	asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl));
}

static inline void arch_counter_set_user_access(void)
{
	u32 cntkctl = arch_timer_get_cntkctl();

	/* Disable user access to both physical/virtual counters/timers */
	/* Also disable virtual event stream */
	cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
			| ARCH_TIMER_USR_VT_ACCESS_EN
			| ARCH_TIMER_VIRT_EVT_EN
			| ARCH_TIMER_USR_VCT_ACCESS_EN
			| ARCH_TIMER_USR_PCT_ACCESS_EN);
	arch_timer_set_cntkctl(cntkctl);
}

static inline void arch_timer_evtstrm_enable(int divider)
{
	u32 cntkctl = arch_timer_get_cntkctl();
+0 −17
Original line number Diff line number Diff line
@@ -109,23 +109,6 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)
	asm volatile("msr	cntkctl_el1, %0" : : "r" (cntkctl));
}

static inline void __cpuinit arch_counter_set_user_access(void)
{
	u32 cntkctl = arch_timer_get_cntkctl();

	/* Disable user access to the timers and the physical counter */
	/* Also disable virtual event stream */
	cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
			| ARCH_TIMER_USR_VT_ACCESS_EN
			| ARCH_TIMER_VIRT_EVT_EN
			| ARCH_TIMER_USR_PCT_ACCESS_EN);

	/* Enable user access to the virtual counter */
	cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;

	arch_timer_set_cntkctl(cntkctl);
}

static inline void arch_timer_evtstrm_enable(int divider)
{
	u32 cntkctl = arch_timer_get_cntkctl();
+17 −0
Original line number Diff line number Diff line
@@ -308,6 +308,23 @@ static void __cpuinit __arch_timer_setup(unsigned type,
	clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff);
}

static void arch_counter_set_user_access(void)
{
	u32 cntkctl = arch_timer_get_cntkctl();

	/* Disable user access to the timers and the physical counter */
	/* Also disable virtual event stream */
	cntkctl &= ~(ARCH_TIMER_USR_PT_ACCESS_EN
			| ARCH_TIMER_USR_VT_ACCESS_EN
			| ARCH_TIMER_VIRT_EVT_EN
			| ARCH_TIMER_USR_PCT_ACCESS_EN);

	/* Enable user access to the virtual counter */
	cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;

	arch_timer_set_cntkctl(cntkctl);
}

static int __cpuinit arch_timer_setup(struct clock_event_device *clk)
{
	__arch_timer_setup(ARCH_CP15_TIMER, clk);