[edk2-devel] [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal

Ashish Singhal via groups.io posted 1 patch 2 years, 6 months ago
Failed in applying to current master (apply log)
ArmPkg/Drivers/TimerDxe/TimerDxe.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[edk2-devel] [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal
Posted by Ashish Singhal via groups.io 2 years, 6 months ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81766): https://edk2.groups.io/g/devel/message/81766
Mute This Topic: https://groups.io/mt/86248479/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v2] ArmPkg/TimerDxe: Delay End Of Interrupt Signal
Posted by Ard Biesheuvel 2 years, 6 months ago
(+ Marc)

On Mon, 11 Oct 2021 at 23:40, Ashish Singhal <ashishsingha@nvidia.com> wrote:
>
> 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>

Please don't spam us with almost identical versions of the same patch
without even documenting what the difference is.


> ---
>  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
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81780): https://edk2.groups.io/g/devel/message/81780
Mute This Topic: https://groups.io/mt/86248479/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-