From: "Jeremy Linton" <jeremy.linton@arm.com>
To: devel@edk2.groups.io
Cc: pete@akeo.ie, awarkentin@vmware.com,
samer.el-haj-mahmoud@arm.com, leif@nuviainc.com,
ard.biesheuvel@arm.com, Jeremy Linton <jeremy.linton@arm.com>
Subject: [BUG/PATCH] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.
Date: Mon, 1 Feb 2021 16:44:37 -0600 [thread overview]
Message-ID: <20210201224437.2001658-1-jeremy.linton@arm.com> (raw)
The 3G limit, and the 2G IORT are intended to solve
the same linux problem, and limit PCI DMA operations
to the first 3G of RAM. Older linux kernels, as
used with RHEL/Centos, trigger an assertion*
when a DMA operation starts that doesn't fit within
the 2G range specified by the IORT.
The simple solution is to only enable the IORT
when the 3G flag is disabled.
* https://github.com/pftf/RPi4/issues/123
Fixes: dac891da5cf3 ("Platform/RaspberryPi/AcpiTables: add a IORT ACPI table to limit XHCI DMA")
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 26 +++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 19ef950f10..9581bc41e1 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -217,13 +217,23 @@ SetupVariables (
ASSERT_EFI_ERROR (Status);
}
- if (mModelFamily >= 4 && mModelInstalledMB > 3 * 1024) {
+ if (mModelFamily >= 4) {
+ if (mModelInstalledMB > 3 * 1024) {
+ /*
+ * This allows changing PcdRamLimitTo3GB in forms.
+ */
+ Status = PcdSet32S (PcdRamMoreThan3GB, 1);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Status = PcdSet32S (PcdRamMoreThan3GB, 0);
+ ASSERT_EFI_ERROR (Status);
+ }
+
/*
- * This allows changing PcdRamLimitTo3GB in forms.
+ * Enable the "3G ram limit" on 2GB device because we
+ * are going to utlize that limit as a new/old kernel
+ * flag and also disable the IORT if the 3G limit is set.
*/
- Status = PcdSet32S (PcdRamMoreThan3GB, 1);
- ASSERT_EFI_ERROR (Status);
-
Size = sizeof (UINT32);
Status = gRT->GetVariable (L"RamLimitTo3GB",
&gConfigDxeFormSetGuid,
@@ -755,6 +765,12 @@ HandleDynamicNamespace (
DEBUG ((DEBUG_ERROR, "Found namespace table not in table list.\n"));
return FALSE;
+ case SIGNATURE_32 ('I', 'O', 'R', 'T'):
+ // only enable the IORT on machines with >3G and no limit
+ // to avoid problems with rhel/centos
+ if (PcdGet32 (PcdRamLimitTo3GB)) {
+ return FALSE;
+ }
}
return TRUE;
--
2.13.7
next reply other threads:[~2021-02-01 22:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 22:44 Jeremy Linton [this message]
2021-02-08 17:36 ` [edk2-devel] [BUG/PATCH] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled Andrei Warkentin
2021-02-08 18:59 ` Jeremy Linton
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=20210201224437.2001658-1-jeremy.linton@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