[edk2-devel] [edk2-devel202105 PATCH v2 1/1] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3

Laszlo Ersek lersek at redhat.com
Tue May 25 11:55:11 UTC 2021


Hi Sami,

On 05/24/21 15:01, Sami Mujawar wrote:
> From: Andreas Sandberg <andreas.sandberg at arm.com>
> 
> Bugzilla: 3415 (https://bugzilla.tianocore.org/show_bug.cgi?id=3415)
> 
> The GICv3 architecture supports up to 1020 ordinary interrupt
> lines. The actual number of interrupts supported is described by the
> ITLinesNumber field in the GICD_TYPER register. The total number of
> implemented registers is normally calculated as
> 32*(ITLinesNumber+1). However, maximum value (0x1f) is a special case
> since that would indicate that 1024 interrupts are implemented.
> 
> Add handling for this special case in ArmGicGetMaxNumInterrupts.
> 
> Signed-off-by: Andreas Sandberg <andreas.sandberg at arm.com>
> Signed-off-by: Joey Gouly <joey.gouly at arm.com>
> Signed-off-by: Sami Mujawar <sami.mujawar at arm.com>
> Reviewed-by: Ard Biesheuvel <ardb at kernel.org>
> ---
> The changes can be seen at:
> https://github.com/samimujawar/edk2/tree/1396_gic_max_num_intr_v2
> 
> Notes:
>     v2:
>       - Fix comment style.                                   [Laszlo]
>       - Updated comment style.                               [Sami]
> 
>  ArmPkg/Drivers/ArmGic/ArmGicLib.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

I think this patch should be merged really soon, as long as Ard agrees.

Thanks,
Laszlo

> 
> diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> index 6b01c88206ad8adef3100dd44c0d57660db77783..bd4b5edb903f3846f4f0e431f93e001f01cd9e7d 100644
> --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
> @@ -1,6 +1,6 @@
>  /** @file
>  *
> -*  Copyright (c) 2011-2018, ARM Limited. All rights reserved.
> +*  Copyright (c) 2011-2021, Arm Limited. All rights reserved.
>  *
>  *  SPDX-License-Identifier: BSD-2-Clause-Patent
>  *
> @@ -120,7 +120,14 @@ ArmGicGetMaxNumInterrupts (
>    IN  INTN          GicDistributorBase
>    )
>  {
> -  return 32 * ((MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F) + 1);
> +  UINTN ItLines;
> +
> +  ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F;
> +
> +  //
> +  // Interrupt ID 1020-1023 are reserved.
> +  //
> +  return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1);
>  }
>  
>  VOID
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75563): https://edk2.groups.io/g/devel/message/75563
Mute This Topic: https://groups.io/mt/83051437/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list