Files
EDK2-fork/ArmPlatformPkg/PeilessSec/AArch64/ArchPeilessSec.c
Ard Biesheuvel 81549ad5e5 ArmPlatformPkg/Sec: Remove EL1 timer setup when booting at EL2
Even though the UEFI spec mentions that the EL1PCTEN and EL1PCEN bits in
CNTHCTL_EL2 must be set, this is not a requirement that applies to the
UEFI implementation, but a requirement that applies to the firmware
running at EL2 in cases where UEFI executes at EL1. (Note that the same
paragraphs mentions that CNTFRQ must be programmed with the timer
frequency, and this is only permitted at EL3).

Setting these bits has no effect when executing at EL2, and it is the
OS's job to reason about how to configure lower exception levels.

So drop the initialization of CNTHCTL_EL2.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-05-28 19:09:22 +00:00

26 lines
471 B
C

/** @file
Copyright (c) 2011-2017, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "PeilessSec.h"
#include <AArch64/AArch64.h>
/**
Architecture specific initialization routine.
**/
VOID
ArchInitialize (
VOID
)
{
if (ArmReadCurrentEL () == AARCH64_EL2) {
// Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
ArmWriteHcr (ARM_HCR_TGE);
}
}