public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal
@ 2021-10-11 21:40 Ashish Singhal
  2021-10-11 22:24 ` Ard Biesheuvel
  0 siblings, 1 reply; 9+ messages in thread
From: Ashish Singhal @ 2021-10-11 21:40 UTC (permalink / raw)
  To: devel, leif, ardb+tianocore; +Cc: Ashish Singhal

In an interrupt handler for the timers, it is important that
software clears the interrupt before deactivating the interrupt
in the GIC. Otherwise the GIC will re-signal the same interrupt
again.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 ArmPkg/Drivers/TimerDxe/TimerDxe.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 0370620fae..46e5bbf287 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -300,10 +300,6 @@ 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) {
 
@@ -335,6 +331,11 @@ TimerInterruptHandler (
     ArmInstructionSynchronizationBarrier ();
   }
 
+  // In an interrupt handler for the timers, it is important that software clears the interrupt
+  // before deactivating the interrupt in the GIC. Otherwise the GIC will re-signal the same
+  // interrupt again.
+  gInterrupt->EndOfInterrupt (gInterrupt, Source);
+
   gBS->RestoreTPL (OriginalTPL);
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-10-14  4:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-11 21:40 [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal Ashish Singhal
2021-10-11 22:24 ` Ard Biesheuvel
     [not found]   ` <87h7dmpqn2.wl-maz@kernel.org>
2021-10-12 14:56     ` Ashish Singhal
2021-10-12 15:38       ` Ashish Singhal
2021-10-13  2:32         ` [edk2-devel] " Jeff Fan
2021-10-14  4:54           ` Ashish Singhal
     [not found]       ` <87czoap7rg.wl-maz@kernel.org>
2021-10-12 16:11         ` Ashish Singhal
     [not found]           ` <87bl3up5t2.wl-maz@kernel.org>
2021-10-12 16:32             ` Ashish Singhal
2021-10-12 17:07               ` Ashish Singhal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox