armv8: Initialize CNTFRQ if at highest exception level
authorPeter Hoyes <Peter.Hoyes@arm.com>
Mon, 12 Jul 2021 14:04:21 +0000 (15:04 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 23 Jul 2021 22:53:46 +0000 (18:53 -0400)
commitc48fec6e7c6ba173f42c9e8b70c001862e048220
tree0b9cf7df29c0f751cc53c61c9ed7d6026d1ea518
parentad7e967738a9c639e07cf50b83ffccdf9a8537b0
armv8: Initialize CNTFRQ if at highest exception level

CNTFRQ_EL0 is only writable from the highest supported exception
level on the platform. For Armv8-A, this is typically EL3, but
technically EL2 and EL3 are optional so it may need to be
initialized at EL2 or EL1. For Armv8-R, the highest exception
level is always EL2.

This patch moves the initialization outside of the switch_el
block and uses a new macro branch_if_not_highest_el which
dynamically detects whether it is at the highest supported
exception level.

Linux's docs state that CNTFRQ_EL0 should be initialized by the
bootloader. If not set, the the U-Boot prompt countdown hangs.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
arch/arm/cpu/armv8/start.S
arch/arm/include/asm/macro.h
arch/arm/include/asm/system.h