Commit 04bb9642 authored by Vincenzo Frascino's avatar Vincenzo Frascino Committed by Russell King

ARM: 8947/1: Fix __arch_get_hw_counter() access to CNTVCT

__arch_get_hw_counter() should check clock_mode to see if it can access
CNTVCT. With the conversion to unified vDSO this check has been left out.

This causes on imx v6 and v7 (imx_v6_v7_defconfig) and other platforms to
hang at boot during the execution of the init process as per below:

[   19.976852] Run /sbin/init as init process
[   20.044931] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x00000004

Fix the problem verifying that clock_mode is set coherently before
accessing CNTVCT.
Investigated-by: default avatarArnd Bergmann <arnd@arndb.de>
Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent ff98a5f6
...@@ -75,6 +75,9 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode) ...@@ -75,6 +75,9 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode)
#ifdef CONFIG_ARM_ARCH_TIMER #ifdef CONFIG_ARM_ARCH_TIMER
u64 cycle_now; u64 cycle_now;
if (!clock_mode)
return -EINVAL;
isb(); isb();
cycle_now = read_sysreg(CNTVCT); cycle_now = read_sysreg(CNTVCT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment