From: quan@os.amperecomputing.com
To: Leif Lindholm <leif@nuviainc.com>,
Ard Biesheuvel <ard.biesheuvel@arm.com>,
devel@edk2.groups.io
Cc: Open Source Review <OpenSourceReview@amperecomputing.com>,
Victor Gallardo <Victor@os.amperecomputing.com>,
Quan Nguyen <quan@os.amperecomputing.com>
Subject: [PATCH v1 1/1] ArmPkg/ArmGicDxe: fix writes to GICD_IPRIORITYR<n> when ARE enable
Date: Wed, 28 Oct 2020 08:21:12 +0700 [thread overview]
Message-ID: <20201028012112.12125-1-quan@os.amperecomputing.com> (raw)
According to ARM doc IHI 0069F, section 11.9.18, "Accessing the
GICD_IPRIORITYR<n>:", "These registers are always used when affinity
routing is not enabled. When affinity routing is enabled for the
Security state of an interrupt:
* GICR_IPRIORITYR<n> is used instead of GICD_IPRIORITYR<n> where n = 0
to 7 (that is, for SGIs and PPIs)."
The current ArmGicV3 code tries to initialize all the IPRIORITYR
registers to a default state via the Distributor (GICD), so skip
writes to the first eight IPRIORITYR registers when Affinity Routing
is Enabled.
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Victor Gallardo <Victor@os.amperecomputing.com>
Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
---
ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
index d7da1f198d9e..bc543502481b 100644
--- a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
+++ b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
@@ -378,6 +378,7 @@ GicV3DxeInitialize (
UINTN RegShift;
UINT64 CpuTarget;
UINT64 MpId;
+ BOOLEAN AffinityRoutingEnabled = FALSE;
// Make sure the Interrupt Controller Protocol is not already installed in
// the system.
@@ -391,11 +392,21 @@ GicV3DxeInitialize (
// Routing enabled. So ensure that the ARE bit is set.
if (!FeaturePcdGet (PcdArmGicV3WithV2Legacy)) {
MmioOr32 (mGicDistributorBase + ARM_GIC_ICDDCR, ARM_GIC_ICDDCR_ARE);
+ // If Affinity Routing is Enabled, the first 32 interrupts (SGI and PPI)
+ // can be programmed only through Redistributor interface (GICR).
+ // Initializing the GICD_IPRIORITYR registers for these interrupts can be
+ // skipped as the Redistributor will be powered up and initialized
+ // at the appropriate time (e.g. in EL3 by trusted firmware).
+ AffinityRoutingEnabled = TRUE;
}
for (Index = 0; Index < mGicNumInterrupts; Index++) {
GicV3DisableInterruptSource (&gHardwareInterruptV3Protocol, Index);
+ if (AffinityRoutingEnabled && Index < 32) {
+ continue;
+ }
+
// Set Priority
RegOffset = Index / 4;
RegShift = (Index % 4) * 8;
--
2.28.0
next reply other threads:[~2020-10-28 1:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 1:21 quan [this message]
2020-11-26 13:09 ` [PATCH v1 1/1] ArmPkg/ArmGicDxe: fix writes to GICD_IPRIORITYR<n> when ARE enable Quan Nguyen
2020-11-27 7:17 ` Ard Biesheuvel
2020-11-28 1:43 ` Quan Nguyen
2020-11-30 9:09 ` Ard Biesheuvel
2020-12-01 3:46 ` Quan Nguyen
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=20201028012112.12125-1-quan@os.amperecomputing.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