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

Joey Gouly posted 1 patch 3 years, 1 month ago
Failed in applying to current master (apply log)
ArmPkg/Drivers/ArmGic/ArmGicLib.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
[edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Joey Gouly 3 years, 1 month ago
From: Andreas Sandberg <andreas.sandberg@arm.com>

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@arm.com>
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
---

The changes can be seen at https://github.com/jgouly/edk2/tree/1396_gic_max_num_intr_v1

 ArmPkg/Drivers/ArmGic/ArmGicLib.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
index 6b01c88206ad8adef3100dd44c0d57660db77783..c4996970eb299776552fe7b54f34fd5a68afff29 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,12 @@ 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
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Joey Gouly 2 years, 11 months ago
>From: Joey Gouly <joey.gouly@arm.com>
> Sent: 09 March 2021 16:45
> Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3 
 
Hi,

A little ping on this. Can someone take a look?

There was a similar patch here, that addressed the same issue https://edk2.groups.io/g/devel/topic/82327316#74401 so I think it would be good get this in.

Thanks,
Joey

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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Laszlo Ersek 2 years, 11 months ago
On 05/21/21 12:49, Joey Gouly wrote:
>> From: Joey Gouly <joey.gouly@arm.com>
>> Sent: 09 March 2021 16:45
>> Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3 
>  
> Hi,
> 
> A little ping on this. Can someone take a look?
> 
> There was a similar patch here, that addressed the same issue https://edk2.groups.io/g/devel/topic/82327316#74401 so I think it would be good get this in.

This even looks like a candidate for edk2-stable202105 to me (it's small
and arguably a clear-cut bugfix).

NB the comment style should be:

  //
  // Interrupt ID 1020-1023 are reserved:
  //

IOW, we need a trailing and a leading empty comment line, plus the
semicolon at the end of the comment should likely be a colon, or maybe
just a period.

Thanks
Laszlo

> 
> Thanks,
> Joey
> 
> 
> 
> 



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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Ard Biesheuvel 2 years, 11 months ago
On Sun, 23 May 2021 at 10:55, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 05/21/21 12:49, Joey Gouly wrote:
> >> From: Joey Gouly <joey.gouly@arm.com>
> >> Sent: 09 March 2021 16:45
> >> Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
> >
> > Hi,
> >
> > A little ping on this. Can someone take a look?
> >
> > There was a similar patch here, that addressed the same issue https://edk2.groups.io/g/devel/topic/82327316#74401 so I think it would be good get this in.
>
> This even looks like a candidate for edk2-stable202105 to me (it's small
> and arguably a clear-cut bugfix).
>
> NB the comment style should be:
>
>   //
>   // Interrupt ID 1020-1023 are reserved:
>   //
>
> IOW, we need a trailing and a leading empty comment line, plus the
> semicolon at the end of the comment should likely be a colon, or maybe
> just a period.
>

With that,

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


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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Laszlo Ersek 2 years, 11 months ago
On 05/23/21 11:03, Ard Biesheuvel wrote:
> On Sun, 23 May 2021 at 10:55, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> On 05/21/21 12:49, Joey Gouly wrote:
>>>> From: Joey Gouly <joey.gouly@arm.com>
>>>> Sent: 09 March 2021 16:45
>>>> Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
>>>
>>> Hi,
>>>
>>> A little ping on this. Can someone take a look?
>>>
>>> There was a similar patch here, that addressed the same issue https://edk2.groups.io/g/devel/topic/82327316#74401 so I think it would be good get this in.
>>
>> This even looks like a candidate for edk2-stable202105 to me (it's small
>> and arguably a clear-cut bugfix).
>>
>> NB the comment style should be:
>>
>>   //
>>   // Interrupt ID 1020-1023 are reserved:
>>   //
>>
>> IOW, we need a trailing and a leading empty comment line, plus the
>> semicolon at the end of the comment should likely be a colon, or maybe
>> just a period.
>>
> 
> With that,
> 
> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> 

Thank you, Ard!

Joey, can you please resubmit the patch with the comment fix, and Ard's
R-b, quickly?

Please use the following subject prefix:

  [edk2-devel202105 PATCH v2]

Also, please file a bugzilla ticket for this issue at
<https://bugzilla.tianocore.org/>, and include the BZ URL in the commit
message. (It wouldn't be really necessary for such a small patch, but a
ticket is required during the feature freeze.)

Thanks
Laszlo



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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Sami Mujawar 2 years, 11 months ago
Hi Laszlo,

Joey is not in office today. I will submit this patch shortly so that we can include this in the release.

Regards,

Sami Mujawar

From: Laszlo Ersek <lersek@redhat.com>
Date: Sunday, 23 May 2021 at 12:27
To: Ard Biesheuvel <ardb@kernel.org>, Joey Gouly <Joey.Gouly@arm.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>, ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>, leif@nuviainc.com <leif@nuviainc.com>, Sami Mujawar <Sami.Mujawar@arm.com>, Andreas Sandberg <Andreas.Sandberg@arm.com>, nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
On 05/23/21 11:03, Ard Biesheuvel wrote:
> On Sun, 23 May 2021 at 10:55, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> On 05/21/21 12:49, Joey Gouly wrote:
>>>> From: Joey Gouly <joey.gouly@arm.com>
>>>> Sent: 09 March 2021 16:45
>>>> Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
>>>
>>> Hi,
>>>
>>> A little ping on this. Can someone take a look?
>>>
>>> There was a similar patch here, that addressed the same issue https://edk2.groups.io/g/devel/topic/82327316#74401 so I think it would be good get this in.
>>
>> This even looks like a candidate for edk2-stable202105 to me (it's small
>> and arguably a clear-cut bugfix).
>>
>> NB the comment style should be:
>>
>>   //
>>   // Interrupt ID 1020-1023 are reserved:
>>   //
>>
>> IOW, we need a trailing and a leading empty comment line, plus the
>> semicolon at the end of the comment should likely be a colon, or maybe
>> just a period.
>>
>
> With that,
>
> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
>

Thank you, Ard!

Joey, can you please resubmit the patch with the comment fix, and Ard's
R-b, quickly?

Please use the following subject prefix:

  [edk2-devel202105 PATCH v2]

Also, please file a bugzilla ticket for this issue at
<https://bugzilla.tianocore.org/>, and include the BZ URL in the commit
message. (It wouldn't be really necessary for such a small patch, but a
ticket is required during the feature freeze.)

Thanks
Laszlo


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


Re: [edk2-devel] [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Posted by Laszlo Ersek 2 years, 11 months ago
On 05/24/21 14:58, Sami Mujawar wrote:
> Hi Laszlo,
> 
> Joey is not in office today. I will submit this patch shortly so that we can include this in the release.

Ah good, just seeing this now. Thanks!
Laszlo



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