public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 0/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload
@ 2018-03-15  7:17 Heyi Guo
  2018-03-15  7:17 ` [PATCH v3 1/1] " Heyi Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Heyi Guo @ 2018-03-15  7:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Leif Lindholm, Ard Biesheuvel, Marc Zyngier

After rebasing to edk2 commit 5e3719a, we found D05 would hang after printing a
lot of "Spurious interrupt" messages. The issue would gone away if we restored
the removal of "enable interrupt source":
  gInterrupt->EnableInterruptSource (gInterrupt, Source);

It can also be fixed if we add a "ISB" after reloading timer compare value, and
we agree that it makes sense to do that.

v3:
- Implement 1 comment from Marc.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>


Heyi Guo (1):
  ArmPkg/TimerDxe: Add ISB for timer compare value reload

 ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4



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

* [PATCH v3 1/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload
  2018-03-15  7:17 [PATCH v3 0/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload Heyi Guo
@ 2018-03-15  7:17 ` Heyi Guo
  2018-03-15  8:08   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Heyi Guo @ 2018-03-15  7:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Heyi Guo, Yi Li, Leif Lindholm, Ard Biesheuvel, Marc Zyngier

If timer interrupt is level sensitive, reloading timer compare
register has a side effect of clearing GIC pending status, so a "ISB"
is needed to make sure this instruction is executed before enabling
CPU IRQ, or else we may get spurious timer interrupts.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
---

Notes:
    v3:
    - Move ISB after enabling timer [Marc]
    
    v2:
    - Use ISB instead of DSB [Marc]
    - Update commit message accordingly.

 ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 33d7c922221f..a3202fa056f3 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -338,6 +338,7 @@ TimerInterruptHandler (
     // Set next compare value
     ArmGenericTimerSetCompareVal (CompareValue);
     ArmGenericTimerEnableTimer ();
+    ArmInstructionSynchronizationBarrier ();
   }
 
   gBS->RestoreTPL (OriginalTPL);
-- 
2.7.4



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

* Re: [PATCH v3 1/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload
  2018-03-15  7:17 ` [PATCH v3 1/1] " Heyi Guo
@ 2018-03-15  8:08   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-03-15  8:08 UTC (permalink / raw)
  To: Heyi Guo; +Cc: edk2-devel@lists.01.org, Yi Li, Leif Lindholm, Marc Zyngier

On 15 March 2018 at 07:17, Heyi Guo <heyi.guo@linaro.org> wrote:
> If timer interrupt is level sensitive, reloading timer compare
> register has a side effect of clearing GIC pending status, so a "ISB"
> is needed to make sure this instruction is executed before enabling
> CPU IRQ, or else we may get spurious timer interrupts.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
> Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>


Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Pushed as ac9b530e6b47

Thanks

> ---
>
> Notes:
>     v3:
>     - Move ISB after enabling timer [Marc]
>
>     v2:
>     - Use ISB instead of DSB [Marc]
>     - Update commit message accordingly.
>
>  ArmPkg/Drivers/TimerDxe/TimerDxe.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
> index 33d7c922221f..a3202fa056f3 100644
> --- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
> +++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
> @@ -338,6 +338,7 @@ TimerInterruptHandler (
>      // Set next compare value
>      ArmGenericTimerSetCompareVal (CompareValue);
>      ArmGenericTimerEnableTimer ();
> +    ArmInstructionSynchronizationBarrier ();
>    }
>
>    gBS->RestoreTPL (OriginalTPL);
> --
> 2.7.4
>


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

end of thread, other threads:[~2018-03-15  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-15  7:17 [PATCH v3 0/1] ArmPkg/TimerDxe: Add ISB for timer compare value reload Heyi Guo
2018-03-15  7:17 ` [PATCH v3 1/1] " Heyi Guo
2018-03-15  8:08   ` Ard Biesheuvel

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