diff options
author | Leif Lindholm <quic_llindhol@quicinc.com> | 2023-09-19 11:20:25 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-09-19 20:27:55 +0000 |
commit | eb485b6438f488db5300b56949d9dad460c9f2d4 (patch) | |
tree | 022dc24d403d35e215e463919e760f1327e2a264 /ArmVirtPkg/Library | |
parent | baee97670ff0c0391ad2c4fc1f32e2d89ed1a057 (diff) | |
download | edk2-eb485b6438f488db5300b56949d9dad460c9f2d4.zip edk2-eb485b6438f488db5300b56949d9dad460c9f2d4.tar.gz edk2-eb485b6438f488db5300b56949d9dad460c9f2d4.tar.bz2 |
ArmVirtPkg: handle virtual EL2 timer in DT
FEAT_VHE, introduced in ARMv8.1, adds a virtual EL2 timer.
However, this library verifies that exactly 3 or 4 12-byte timer
interrupts are provided in input DT, ASSERTing when the new timer
is added.
Change the assert to >= 36.
Extend the current logic, also initializing PcdArmArchTimerHypVirtIntrNum
if 5 interrupts are provided.
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ArmVirtPkg/Library')
-rw-r--r-- | ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c | 11 | ||||
-rw-r--r-- | ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c index 38dd6c5..c7732a2 100644 --- a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c +++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c @@ -35,6 +35,7 @@ ArmVirtTimerFdtClientLibConstructor ( CONST INTERRUPT_PROPERTY *InterruptProp;
UINT32 PropSize;
INT32 SecIntrNum, IntrNum, VirtIntrNum, HypIntrNum;
+ INT32 HypVirtIntrNum;
RETURN_STATUS PcdStatus;
Status = gBS->LocateProtocol (
@@ -66,10 +67,10 @@ ArmVirtTimerFdtClientLibConstructor ( }
//
- // - interrupts : Interrupt list for secure, non-secure, virtual and
- // hypervisor timers, in that order.
+ // - interrupts : Interrupt list for secure, non-secure, virtual,
+ // hypervisor and hypervisor virtual timers, in that order.
//
- ASSERT (PropSize == 36 || PropSize == 48);
+ ASSERT (PropSize >= 36);
SecIntrNum = SwapBytes32 (InterruptProp[0].Number)
+ (InterruptProp[0].Type ? 16 : 0);
@@ -79,6 +80,8 @@ ArmVirtTimerFdtClientLibConstructor ( + (InterruptProp[2].Type ? 16 : 0);
HypIntrNum = PropSize < 48 ? 0 : SwapBytes32 (InterruptProp[3].Number)
+ (InterruptProp[3].Type ? 16 : 0);
+ HypVirtIntrNum = PropSize < 60 ? 0 : SwapBytes32 (InterruptProp[4].Number)
+ + (InterruptProp[4].Type ? 16 : 0);
DEBUG ((
DEBUG_INFO,
@@ -97,6 +100,8 @@ ArmVirtTimerFdtClientLibConstructor ( ASSERT_RETURN_ERROR (PcdStatus);
PcdStatus = PcdSet32S (PcdArmArchTimerHypIntrNum, HypIntrNum);
ASSERT_RETURN_ERROR (PcdStatus);
+ PcdStatus = PcdSet32S (PcdArmArchTimerHypVirtIntrNum, HypVirtIntrNum);
+ ASSERT_RETURN_ERROR (PcdStatus);
return EFI_SUCCESS;
}
diff --git a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf index 9e6f6f6..f8fc013 100644 --- a/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf +++ b/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf @@ -40,6 +40,7 @@ gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
+ gArmTokenSpaceGuid.PcdArmArchTimerHypVirtIntrNum
[Depex]
gFdtClientProtocolGuid
|