]> git.proxmox.com Git - mirror_edk2.git/commit - ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 6 Feb 2018 11:58:12 +0000 (11:58 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 6 Feb 2018 18:59:34 +0000 (18:59 +0000)
commit61a7b0ec634fa3288f47929ba3ced05ff48de739
tree597a7053190dce09820a3f054dbd0bd361cb5052
parente537d8781784edaaecdb68b302a80694f862cb61
ArmPkg/Gic: force GIC driver to run before CPU arch protocol driver

Currently, the GIC driver has a static dependency on the CPU arch protocol
driver, so it can register its IRQ handler at init time. This means there
is a window between dispatch of the CPU driver and dispatch of the GIC
driver where any unexpected GIC state may trigger an interrupt which we
are not set up to handle yet. Note that this is even the case if we enter
UEFI with interrupts disabled at the CPU, given that any TPL manipulation
involving TPL_HIGH_LEVEL will unconditionally enable IRQs at the CPU side
regardless of whether they were enabled to begin with (but only as soon as
the CPU arch protocol is actually installed)

So let's reorder the GIC driver with the CPU driver, and let it run its
initialization that puts the GIC into a known state before enabling
interrupts. Move its installation of its IRQ handler to a protocol notify
callback on the CPU arch protocol so that it runs as soon as it becomes
available.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
ArmPkg/ArmPkg.dec
ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
ArmPkg/Drivers/ArmGic/ArmGicDxe.h
ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
ArmPkg/Drivers/CpuDxe/CpuDxe.inf