ArmVirtPkg/PrePi: Don't clear HCR_EL2 fields when setting TGE

HCR_EL2 may contain fields that should be preserved (such as E2H, which
may be RES1 for all intents and purposes other than reading back the
register). So preserve the existing value when setting the TGE bit.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Ard Biesheuvel 2024-11-15 12:12:32 +01:00 committed by mergify[bot]
parent f60a839480
commit 91171b6b94

View File

@ -17,6 +17,6 @@ ArchInitialize (
{
if (ArmReadCurrentEL () == AARCH64_EL2) {
// Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
ArmWriteHcr (ARM_HCR_TGE);
ArmWriteHcr (ArmReadHcr () | ARM_HCR_TGE);
}
}