• Geert Uytterhoeven's avatar
    ARM: shmobile: rcar-gen2: Make sure CNTVOFF is initialized on CA7/15 · 3fd45a13
    Geert Uytterhoeven authored
    On Cortex-A7, the arch timer CNTVOFF register is uninitialized.
    Ideally it should be initialized by the boot loader, but it isn't.
    
    For the boot CPU, CNTVOFF is initialized by Linux since commit
    9ce3fa68 ("ARM: shmobile: rcar-gen2: Add CA7 arch_timer
    initialization for r8a7794").
    For secondary CPU cores, no such initialization is done.
    
    Hence when enabling SMP on r8a7794, the kernel log is spammed with:
    
        WARNING: Underflow in clocksource 'arch_sys_counter' observed, time update ignored.
    	     Please report this, consider using a different clocksource, if possible.
    	     Your kernel is probably still fine.
    
    As Marc Zyngier pointed out that Cortex-A15 and Cortex-A7 are similar with
    respect to CNTVOFF, we have been very lucky this just worked on R-Car
    Gen2 SoCs with Cortex-A15 cores.
    
    To fix this:
      - Move the existing inline asm code to initialize CNTVOFF to an
        assembler source file (adding comments and replacing hardcoded
        constants by definitions in the process), so it can be reused,
      - Perform the initialization of CNTVOFF on the boot CPU (Cortex-A15 or
        Cortex-A7) on all R-Car Gen2 and RZ/G1 parts,
      - Wrap the standard secondary_startup() routine inside a routine which
        initializes CNTVOFF.
    
    Based on patches by Hisashi Nakamura in the BSP.
    Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: default avatarFabrizio Castro <fabrizio.castro@bp.renesas.com>
    Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
    3fd45a13
headsmp-apmu.S 1 KB