public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: Robbie King <robbiek@xsightlabs.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	 Sami Mujawar <sami.mujawar@arm.com>
Subject: Re: [PATCH] ArmPkg/Drivers: ArmGicIsInterruptEnabled returns incorrect value
Date: Fri, 1 Jul 2022 17:16:00 +0200	[thread overview]
Message-ID: <CAMj1kXH12g7m-G5_pVEgZ2dXzv5BG=OJbWuBBnj4YSiSyCRUWg@mail.gmail.com> (raw)
In-Reply-To: <20220701150617.61224-1-robbiek@xsightlabs.com>

On Fri, 1 Jul 2022 at 17:07, Robbie King <robbiek@xsightlabs.com> wrote:
>
> The issue appears to have been introduced by:
>
> 41fb5d46 : ArmPkg/ArmGic: Use the GIC Redistributor instead of GIC Distributor for GICv3
>
> The changes to ArmGicIsInterruptEnabled() introduced the error where the Boolean
> result is assigned to Interrupts, but then the bit position check is performed
> again (against the computed Boolean result instead of the interrupt mask) during
> the return statement.
>
> Fix removes erroneous test and relies on boolean test made at return.
>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Robbie King <robbiek@xsightlabs.com>

Nice find! How did you spot this? Through inspection? Or due to an
actual failure?

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

I'll go and queue this up, thanks.

> ---
>  ArmPkg/Drivers/ArmGic/ArmGicLib.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> index 58ab45f812..dd3670c7cc 100644
> --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> @@ -366,10 +366,9 @@ ArmGicIsInterruptEnabled (
>        FeaturePcdGet (PcdArmGicV3WithV2Legacy) ||
>        SourceIsSpi (Source))
>    {
> -    Interrupts = ((MmioRead32 (
> -                     GicDistributorBase + ARM_GIC_ICDISER + (4 * RegOffset)
> -                     )
> -                   & (1 << RegShift)) != 0);
> +    Interrupts = MmioRead32 (
> +                   GicDistributorBase + ARM_GIC_ICDISER + (4 * RegOffset)
> +                   );
>    } else {
>      GicCpuRedistributorBase = GicGetCpuRedistributorBase (
>                                  GicRedistributorBase,
> --
> 2.17.1
>

  reply	other threads:[~2022-07-01 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 15:06 [PATCH] ArmPkg/Drivers: ArmGicIsInterruptEnabled returns incorrect value Robbie King
2022-07-01 15:16 ` Ard Biesheuvel [this message]
2022-07-01 15:28   ` Robbie King

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='CAMj1kXH12g7m-G5_pVEgZ2dXzv5BG=OJbWuBBnj4YSiSyCRUWg@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