aarch64: Implement cpu_init_arch()

When the boot-wrapper is entered at EL2 it does not initialise
CNTFRQ_EL0, and in future it may need to initialize other CPU state
regardless of the exeption level it was entered at.

Use a common cpu_init_arch() function to initialize CPU state regardless
of the exception level the boot-wrapper was entered at.

This change means that the boot-wrapper can only be used when enetered
at the highest implemented exception level, as accesses to CNTFRQ_EL0
will be UNDEFINED at lower exception levels. However, the boot-wrapper
only supports being booted at the highest implemented exception level,
as the comment at the top of boot.S describes:

| The boot-wrapper must be entered from the reset vector at the
| highest implemented exception level.

... so this should not adversely affect any supported configuration.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cc: Akos Denke <akos.denke@arm.com>
Cc: Luca Fancellu <luca.fancellu@arm.com>
2 files changed