public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Evan Lloyd <Evan.Lloyd@arm.com>, "Cohen, Eugene" <eugene@hp.com>,
	 "edk2-devel@lists.01.org" <edk2-devel@ml01.01.org>,
	Heyi Guo <heyi.guo@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH] ArmPkg: Fix double GIC EIOR write per interrupt
Date: Mon, 8 Aug 2016 13:51:20 +0200	[thread overview]
Message-ID: <CAKv+Gu-bU_rU1FaZ=9_L5FKAP8S9jp8GXjVqxLoZyVX6p9tyEg@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu89ga-zpP+WUw=hXNYVH+r_SaQ=7R=fDVLLQkq3uctyfg@mail.gmail.com>

On 8 August 2016 at 13:08, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 8 August 2016 at 13:06, Alexei Fedorov <Alexei.Fedorov@arm.com> wrote:
>> Timer's pending interrupt is cleared  HARDWARE_INTERRUPT_HANDLER TimerInterruptHandler()  in when timer is re-programmed for the next shot.
>
> Yes, that is the timer side.
>
>> Does it mean that TimerDxe driver is part EFI_HARDWARE_INTERRUPT_PROTOCOL?
>>
>
> No. The peripheral and the GIC each have their own mask and enable
> registers for the interrupt. That is exactly why the comment describes
> in detail which part is the responsibility of the GIC, and which is
> the responsibility of the peripheral.
>

... and actually, looking at TimerInterruptHandler (), I don't see the
point of re-enabling the interrupt early, given that

308: OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);

disables interrupts globally, and only re-enables them on line 346, at
which point the mTimerNotifyFunction() has already returned.

So I propose we simply do

diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 1169d426b255..f0fcb05757ac 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -308,10 +308,7 @@ TimerInterruptHandler (
   OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);

   // Check if the timer interrupt is active
-  if ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {
-
-    // Signal end of interrupt early to help avoid losing subsequent
ticks from long duration handlers
-    gInterrupt->EndOfInterrupt (gInterrupt, Source);
+  while ((ArmGenericTimerGetTimerCtrlReg () ) & ARM_ARCH_TIMER_ISTATUS) {

     if (mTimerNotifyFunction) {
       mTimerNotifyFunction (mTimerPeriod * mElapsedPeriod);

so that if the condition exists that we know will trigger the
interrupt immediately as soon as we unmask it, we simply enter the
loop again just like we would when taking the [nested] interrupt.

@Heyi: any thoughts?

-- 
Ard.


  reply	other threads:[~2016-08-08 11:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 16:59 [PATCH] ArmPkg: Fix double GIC EIOR write per interrupt evan.lloyd
2016-08-06  8:24 ` Ard Biesheuvel
2016-08-08 10:25   ` Alexei Fedorov
2016-08-08 10:32     ` Ard Biesheuvel
2016-08-08 10:40       ` Alexei Fedorov
2016-08-08 10:44         ` Ard Biesheuvel
2016-08-08 10:48           ` Alexei Fedorov
2016-08-08 10:49             ` Ard Biesheuvel
2016-08-08 10:56               ` Alexei Fedorov
2016-08-08 10:58                 ` Ard Biesheuvel
2016-08-08 11:06                   ` Alexei Fedorov
2016-08-08 11:08                     ` Ard Biesheuvel
2016-08-08 11:51                       ` Ard Biesheuvel [this message]
2016-08-08 13:22                         ` Cohen, Eugene
2016-08-08 13:42                           ` Ard Biesheuvel
2016-08-08 13:50                             ` Ard Biesheuvel
2016-08-10 17:38                               ` Evan Lloyd
2016-08-10 19:34                                 ` Cohen, Eugene
2016-08-10 20:31                                   ` Evan Lloyd
2016-08-10 21:06                                     ` Cohen, Eugene

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='CAKv+Gu-bU_rU1FaZ=9_L5FKAP8S9jp8GXjVqxLoZyVX6p9tyEg@mail.gmail.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