Skip to content

Commit 04bb964

Browse files
fvincenzoRussell King
authored andcommitted
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: Arnd Bergmann <[email protected]> Reported-by: Guenter Roeck <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Vincenzo Frascino <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent ff98a5f commit 04bb964

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm/include/asm/vdso/gettimeofday.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode)
7575
#ifdef CONFIG_ARM_ARCH_TIMER
7676
u64 cycle_now;
7777

78+
if (!clock_mode)
79+
return -EINVAL;
80+
7881
isb();
7982
cycle_now = read_sysreg(CNTVCT);
8083

0 commit comments

Comments
 (0)