From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.43262.1612219480132605143 for ; Mon, 01 Feb 2021 14:44:40 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: jeremy.linton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3470014F6; Mon, 1 Feb 2021 14:44:39 -0800 (PST) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 214B73F718; Mon, 1 Feb 2021 14:44:39 -0800 (PST) From: "Jeremy Linton" 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 Subject: [BUG/PATCH] Platform/RaspberryPi: Only enable IORT when 3G limit is disabled. Date: Mon, 1 Feb 2021 16:44:37 -0600 Message-Id: <20210201224437.2001658-1-jeremy.linton@arm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 tabl= e to limit XHCI DMA") Signed-off-by: Jeremy Linton --- 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);=0D }=0D =0D - if (mModelFamily >=3D 4 && mModelInstalledMB > 3 * 1024) {=0D + if (mModelFamily >=3D 4) {=0D + if (mModelInstalledMB > 3 * 1024) {=0D + /*=0D + * This allows changing PcdRamLimitTo3GB in forms.=0D + */=0D + Status =3D PcdSet32S (PcdRamMoreThan3GB, 1);=0D + ASSERT_EFI_ERROR (Status);=0D + } else {=0D + Status =3D PcdSet32S (PcdRamMoreThan3GB, 0);=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D /*=0D - * This allows changing PcdRamLimitTo3GB in forms.=0D + * Enable the "3G ram limit" on 2GB device because we=0D + * are going to utlize that limit as a new/old kernel=0D + * flag and also disable the IORT if the 3G limit is set.=0D */=0D - Status =3D PcdSet32S (PcdRamMoreThan3GB, 1);=0D - ASSERT_EFI_ERROR (Status);=0D -=0D Size =3D sizeof (UINT32);=0D Status =3D gRT->GetVariable (L"RamLimitTo3GB",=0D &gConfigDxeFormSetGuid,=0D @@ -755,6 +765,12 @@ HandleDynamicNamespace ( DEBUG ((DEBUG_ERROR, "Found namespace table not in table list.\n"));=0D =0D return FALSE;=0D + case SIGNATURE_32 ('I', 'O', 'R', 'T'):=0D + // only enable the IORT on machines with >3G and no limit=0D + // to avoid problems with rhel/centos=0D + if (PcdGet32 (PcdRamLimitTo3GB)) {=0D + return FALSE;=0D + }=0D }=0D =0D return TRUE;=0D --=20 2.13.7