From: Marc Zyngier Date: Tue, 6 Mar 2018 13:00:35 +0000 (+0000) Subject: ArmPkg/TimerDxe: Always perform an EOI, even for spurious interrupts X-Git-Tag: edk2-stable201903~2241 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=5e3719aeaef198f36808a5e53a1f5bb23762e3a5 ArmPkg/TimerDxe: Always perform an EOI, even for spurious interrupts The generic timer driver only EOIs the timer interrupt if the ISTATUS bit is set. This is completely fine if you pretend that spurious interrupts do not exist. But as a matter of fact, they do, and the first one will leave the interrupt activated at the GIC level, making sure that no other interrupt can make it anymore. Making sure that each interrupt Ack is paired with an EOI is the way to go. Oh, and enabling the interrupt each time it is taken is completely pointless. We entered this function for a good reason... Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marc Zyngier Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c index 2416c90f55..33d7c92222 100644 --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c @@ -306,12 +306,13 @@ TimerInterruptHandler ( // OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); + // Signal end of interrupt early to help avoid losing subsequent ticks + // from long duration handlers + gInterrupt->EndOfInterrupt (gInterrupt, Source); + // Check if the timer interrupt is active if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) { - // Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers - gInterrupt->EndOfInterrupt (gInterrupt, Source); - if (mTimerNotifyFunction) { mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod); } @@ -339,9 +340,6 @@ TimerInterruptHandler ( ArmGenericTimerEnableTimer (); } - // Enable timer interrupts - gInterrupt->EnableInterruptSource (gInterrupt, Source); - gBS->RestoreTPL (OriginalTPL); }