public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.
@ 2021-02-17  6:07 jlinton
  2021-02-17  6:22 ` Andrei Warkentin
  0 siblings, 1 reply; 3+ messages in thread
From: jlinton @ 2021-02-17  6:07 UTC (permalink / raw)
  To: devel
  Cc: pete, awarkentin, samer.el-haj-mahmoud, leif, ardb+tianocore,
	Jeremy Linton

From: Jeremy Linton <jeremy.linton@arm.com>

The 3G limit, and the 2G IORT are intended to solve
the same linux problem. They 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 at a range 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 and there is more
than 3G installed.

* 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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 19ef950f10..578f5ead8f 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -755,6 +755,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 and other older OSs
+    if (PcdGet32 (PcdRamLimitTo3GB) || !PcdGet32 (PcdRamMoreThan3GB)) {
+      return FALSE;
+    }
   }
 
   return TRUE;
-- 
2.13.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.
  2021-02-17  6:07 [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled jlinton
@ 2021-02-17  6:22 ` Andrei Warkentin
  2021-02-20 14:43   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Warkentin @ 2021-02-17  6:22 UTC (permalink / raw)
  To: jlinton, devel@edk2.groups.io
  Cc: pete@akeo.ie, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com,
	ardb+tianocore@kernel.org, Jeremy Linton

[-- Attachment #1: Type: text/plain, Size: 2493 bytes --]

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: jlinton <lintonrjeremy@gmail.com>
Sent: Wednesday, February 17, 2021 12:07 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: 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>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>; Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.

From: Jeremy Linton <jeremy.linton@arm.com>

The 3G limit, and the 2G IORT are intended to solve
the same linux problem. They 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 at a range 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 and there is more
than 3G installed.

* https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F123&amp;data=04%7C01%7Cawarkentin%40vmware.com%7C0c1dc1458ac14a84867b08d8d30a613a%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637491388819273969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=VlStuFf%2F5bvIAMarB%2F2djY64J7GDa1zEVMB61%2Fwjgn8%3D&amp;reserved=0

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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
index 19ef950f10..578f5ead8f 100644
--- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
@@ -755,6 +755,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 and other older OSs

+    if (PcdGet32 (PcdRamLimitTo3GB) || !PcdGet32 (PcdRamMoreThan3GB)) {

+      return FALSE;

+    }

   }



   return TRUE;

--
2.13.7


[-- Attachment #2: Type: text/html, Size: 4127 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.
  2021-02-17  6:22 ` Andrei Warkentin
@ 2021-02-20 14:43   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2021-02-20 14:43 UTC (permalink / raw)
  To: Andrei Warkentin
  Cc: jlinton, devel@edk2.groups.io, pete@akeo.ie,
	samer.el-haj-mahmoud@arm.com, leif@nuviainc.com,
	ardb+tianocore@kernel.org, Jeremy Linton

On Wed, 17 Feb 2021 at 07:22, Andrei Warkentin <awarkentin@vmware.com> wrote:
>
> Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
> _

Pushed as 2cad1bd782b5..41b54dbb6803

Thanks all

_______________________________
> From: jlinton <lintonrjeremy@gmail.com>
> Sent: Wednesday, February 17, 2021 12:07 AM
> To: devel@edk2.groups.io <devel@edk2.groups.io>
> Cc: 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>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>; Jeremy Linton <jeremy.linton@arm.com>
> Subject: [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled.
>
> From: Jeremy Linton <jeremy.linton@arm.com>
>
> The 3G limit, and the 2G IORT are intended to solve
> the same linux problem. They 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 at a range 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 and there is more
> than 3G installed.
>
> * https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpftf%2FRPi4%2Fissues%2F123&amp;data=04%7C01%7Cawarkentin%40vmware.com%7C0c1dc1458ac14a84867b08d8d30a613a%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637491388819273969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=VlStuFf%2F5bvIAMarB%2F2djY64J7GDa1zEVMB61%2Fwjgn8%3D&amp;reserved=0
>
> 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 | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 19ef950f10..578f5ead8f 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -755,6 +755,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 and other older OSs
>
> +    if (PcdGet32 (PcdRamLimitTo3GB) || !PcdGet32 (PcdRamMoreThan3GB)) {
>
> +      return FALSE;
>
> +    }
>
>    }
>
>
>
>    return TRUE;
>
> --
> 2.13.7
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-20 14:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-17  6:07 [PATCH v2] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled jlinton
2021-02-17  6:22 ` Andrei Warkentin
2021-02-20 14:43   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox