]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/TimerDxe: Always perform an EOI, even for spurious interrupts
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 6 Mar 2018 13:00:35 +0000 (13:00 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 6 Mar 2018 14:37:39 +0000 (14:37 +0000)
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 <marc.zyngier@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmPkg/Drivers/TimerDxe/TimerDxe.c

index 2416c90f5545495367a835b5a6753d30e868c878..33d7c922221fa18c8f1ac7353487a60c77437d0c 100644 (file)
@@ -306,12 +306,13 @@ TimerInterruptHandler (
   //\r
   OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
 \r
+  // Signal end of interrupt early to help avoid losing subsequent ticks\r
+  // from long duration handlers\r
+  gInterrupt->EndOfInterrupt (gInterrupt, Source);\r
+\r
   // Check if the timer interrupt is active\r
   if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {\r
 \r
-    // Signal end of interrupt early to help avoid losing subsequent ticks from long duration handlers\r
-    gInterrupt->EndOfInterrupt (gInterrupt, Source);\r
-\r
     if (mTimerNotifyFunction) {\r
       mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod);\r
     }\r
@@ -339,9 +340,6 @@ TimerInterruptHandler (
     ArmGenericTimerEnableTimer ();\r
   }\r
 \r
-  // Enable timer interrupts\r
-  gInterrupt->EnableInterruptSource (gInterrupt, Source);\r
-\r
   gBS->RestoreTPL (OriginalTPL);\r
 }\r
 \r