From: "Joey Gouly" <joey.gouly@arm.com>
To: <devel@edk2.groups.io>
Cc: <joey.gouly@arm.com>, <ardb+tianocore@kernel.org>,
<leif@nuviainc.com>, <sami.mujawar@arm.com>,
<andreas.sandberg@arm.com>, <nd@arm.com>
Subject: [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3
Date: Tue, 9 Mar 2021 16:45:10 +0000 [thread overview]
Message-ID: <20210309164510.19272-1-joey.gouly@arm.com> (raw)
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")
next reply other threads:[~2021-03-09 16:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 16:45 Joey Gouly [this message]
2021-05-21 10:49 ` [PATCH] ArmPkg/ArmGic: Fix maximum number of interrupts in GICv3 Joey Gouly
2021-05-23 8:55 ` [edk2-devel] " Laszlo Ersek
2021-05-23 9:03 ` Ard Biesheuvel
2021-05-23 11:26 ` Laszlo Ersek
2021-05-24 12:58 ` Sami Mujawar
2021-05-25 11:55 ` Laszlo Ersek
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=20210309164510.19272-1-joey.gouly@arm.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