DynamicTablesPkg: Support EL2 virtual timer in ArmGenericTimerParser

When edk2 runs as a kvmtool guest with nested virtualization enabled,
the Arm architectural timer DT node contains five interrupt specifiers.
The fifth interrupt describes the EL2 virtual timer.

ArmGenericTimerParser currently expects exactly four timer interrupts.
It therefore asserts when parsing the timer node generated for a nested
virtualization guest.

Determine the number of interrupt specifiers present in the DT and
populate each architectural timer entry only when it is available.
Add support for the EL2 virtual timer and use it to populate the
VirtualPL2Timer fields in the generated GTDT information.

Tested as a KVM guest at EL1 and EL2, with both E2H==0 and E2H==1.

Signed-off-by: Marc Zyngier <maz@kernel.org>
[Varshit Pandya: Rewrite commit message for clarity.]
Ref: https://edk2.groups.io/g/devel/message/122008
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
2 files changed