<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
I'd rather we not set the <span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important">PcdRamMoreThan3GB
on a device with 1 or 2GB. I recognise you're using this to choose behavior for an old Linux version, but it's still non-sensical to the end user and it becomes a maintenance burden since the logic is no longer clear, so you might as well add a boot option
to disable the IORT (and document as being for older Linux kernels) or just not install it if you explicitly being booted on a system with less RAM. I.e.</span></div>
<div style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, system-ui, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color:rgb(255, 255, 255);display:inline !important"><span> </span>if
(PcdGet32 (PcdRamLimitTo3GB) || <span style="background-color:rgb(255, 255, 255);display:inline !important">
mModelInstalledMB < 2 * 1024</span>) {</span><br>
<br style="background-color:rgb(255, 255, 255)">
<span style="background-color:rgb(255, 255, 255);display:inline !important"> return FALSE;</span><br style="background-color:rgb(255, 255, 255)">
<br style="background-color:rgb(255, 255, 255)">
<span style="background-color:rgb(255, 255, 255);display:inline !important"> }</span><br>
</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Jeremy Linton via groups.io <jeremy.linton=arm.com@groups.io><br>
<b>Sent:</b> Monday, February 1, 2021 4:44 PM<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> pete@akeo.ie <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com>; leif@nuviainc.com <leif@nuviainc.com>; ard.biesheuvel@arm.com <ard.biesheuvel@arm.com>; Jeremy Linton <jeremy.linton@arm.com><br>
<b>Subject:</b> [edk2-devel] [BUG/PATCH] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The 3G limit, and the 2G IORT are intended to solve<br>
the same linux problem, and limit PCI DMA operations<br>
to the first 3G of RAM. Older linux kernels, as<br>
used with RHEL/Centos, trigger an assertion*<br>
when a DMA operation starts that doesn't fit within<br>
the 2G range specified by the IORT.<br>
<br>
The simple solution is to only enable the IORT<br>
when the 3G flag is disabled.<br>
<br>
* <a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F123&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dKbis45PDc6ciBMWvSime3ZhQJGOwYLN0OHTnhMSvvU%3D&reserved=0">
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F123&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dKbis45PDc6ciBMWvSime3ZhQJGOwYLN0OHTnhMSvvU%3D&reserved=0</a><br>
<br>
Fixes: dac891da5cf3 ("Platform/RaspberryPi/AcpiTables: add a IORT ACPI table to limit XHCI DMA")<br>
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com><br>
---<br>
Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 26 +++++++++++++++++-----<br>
1 file changed, 21 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
index 19ef950f10..9581bc41e1 100644<br>
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c<br>
@@ -217,13 +217,23 @@ SetupVariables (<br>
ASSERT_EFI_ERROR (Status);<br>
<br>
}<br>
<br>
<br>
<br>
- if (mModelFamily >= 4 && mModelInstalledMB > 3 * 1024) {<br>
<br>
+ if (mModelFamily >= 4) {<br>
<br>
+ if (mModelInstalledMB > 3 * 1024) {<br>
<br>
+ /*<br>
<br>
+ * This allows changing PcdRamLimitTo3GB in forms.<br>
<br>
+ */<br>
<br>
+ Status = PcdSet32S (PcdRamMoreThan3GB, 1);<br>
<br>
+ ASSERT_EFI_ERROR (Status);<br>
<br>
+ } else {<br>
<br>
+ Status = PcdSet32S (PcdRamMoreThan3GB, 0);<br>
<br>
+ ASSERT_EFI_ERROR (Status);<br>
<br>
+ }<br>
<br>
+<br>
<br>
/*<br>
<br>
- * This allows changing PcdRamLimitTo3GB in forms.<br>
<br>
+ * Enable the "3G ram limit" on 2GB device because we<br>
<br>
+ * are going to utlize that limit as a new/old kernel<br>
<br>
+ * flag and also disable the IORT if the 3G limit is set.<br>
<br>
*/<br>
<br>
- Status = PcdSet32S (PcdRamMoreThan3GB, 1);<br>
<br>
- ASSERT_EFI_ERROR (Status);<br>
<br>
-<br>
<br>
Size = sizeof (UINT32);<br>
<br>
Status = gRT->GetVariable (L"RamLimitTo3GB",<br>
<br>
&gConfigDxeFormSetGuid,<br>
<br>
@@ -755,6 +765,12 @@ HandleDynamicNamespace (<br>
DEBUG ((DEBUG_ERROR, "Found namespace table not in table list.\n"));<br>
<br>
<br>
<br>
return FALSE;<br>
<br>
+ case SIGNATURE_32 ('I', 'O', 'R', 'T'):<br>
<br>
+ // only enable the IORT on machines with >3G and no limit<br>
<br>
+ // to avoid problems with rhel/centos<br>
<br>
+ if (PcdGet32 (PcdRamLimitTo3GB)) {<br>
<br>
+ return FALSE;<br>
<br>
+ }<br>
<br>
}<br>
<br>
<br>
<br>
return TRUE;<br>
<br>
-- <br>
2.13.7<br>
<br>
<br>
<br>
-=-=-=-=-=-=<br>
Groups.io Links: You receive all messages sent to this group.<br>
View/Reply Online (#71032): <a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F71032&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=asFWjKVaiPH31M3SCUx8TQtzDoucFNTf8TqcYW%2Bo0uY%3D&reserved=0">
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Fmessage%2F71032&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=asFWjKVaiPH31M3SCUx8TQtzDoucFNTf8TqcYW%2Bo0uY%3D&reserved=0</a><br>
Mute This Topic: <a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F80300339%2F4387333&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Njvni%2BMK0z38Xi3rw2xwPNiMBmesole6evqVHwZB87c%3D&reserved=0">
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.io%2Fmt%2F80300339%2F4387333&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Njvni%2BMK0z38Xi3rw2xwPNiMBmesole6evqVHwZB87c%3D&reserved=0</a><br>
Group Owner: devel+owner@edk2.groups.io<br>
Unsubscribe: <a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DaNks8FMX0pgeoEOY3xITNK46wbvbahKWAPnIe5kaRk%3D&reserved=0">
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Funsub&data=04%7C01%7Cawarkentin%40vmware.com%7C92f310e07997434a267408d8c702f698%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637478162838925480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DaNks8FMX0pgeoEOY3xITNK46wbvbahKWAPnIe5kaRk%3D&reserved=0</a>
[awarkentin@vmware.com]<br>
-=-=-=-=-=-=<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>
<div width="1" style="color:white;clear:both">_._,_._,_</div> <hr> Groups.io Links:<p> You receive all messages sent to this group. <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/71480">View/Reply Online (#71480)</a> | | <a target="_blank" href="https://groups.io/mt/80300339/1813853">Mute This Topic</a> | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br> <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> | <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a> [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>