public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ashish Singhal" <ashishsingha@nvidia.com>
To: <devel@edk2.groups.io>, <leif@nuviainc.com>, <ardb+tianocore@kernel.org>
Cc: Ashish Singhal <ashishsingha@nvidia.com>
Subject: [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal
Date: Mon, 11 Oct 2021 15:40:42 -0600	[thread overview]
Message-ID: <a56ee2ea10b5a50f2d9c024c886cf3a37cb9de80.1633988382.git.ashishsingha@nvidia.com> (raw)

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


             reply	other threads:[~2021-10-11 21:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 21:40 Ashish Singhal [this message]
2021-10-11 22:24 ` [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a56ee2ea10b5a50f2d9c024c886cf3a37cb9de80.1633988382.git.ashishsingha@nvidia.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox