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.web12.22978.1602438984397918831 for ; Sun, 11 Oct 2020 10:56:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@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 B735F30E; Sun, 11 Oct 2020 10:56:23 -0700 (PDT) Received: from [192.168.1.81] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 973853F73C; Sun, 11 Oct 2020 10:56:22 -0700 (PDT) Subject: Re: [PATCH edk2-platforms 1/1] Platform/RaspberryPi/AcpiTables: add a IORT ACPI table to limit XHCI DMA To: Andrei Warkentin , "devel@edk2.groups.io" Cc: Samer El-Haj-Mahmoud , Jeremy Linton , Pete Batard , Leif Lindholm References: <20201011082057.20662-1-ard.biesheuvel@arm.com> From: "Ard Biesheuvel" Message-ID: <2f7578b6-42b0-d46c-ee4d-1ac77df963f6@arm.com> Date: Sun, 11 Oct 2020 19:56:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10/11/20 7:25 PM, Andrei Warkentin wrote: > Hi Ard, >=20 > This makes sense to me. Glad there's a way forward to support such=20 > systems with ACPI in Linux. >=20 > Could the other "legacy" devices behind the GPU be handled similarly? I= =20 > mean the ones with the 1GB DMA limit. Not this change, of course. >=20 Yes. Anything we describe in the namespace can be added here as a named=20 component, with the associated address limit. > Reviewed-by: Andrei Warkentin >=20 Thanks, > -----------------------------------------------------------------------= - > *From:* Ard Biesheuvel > *Sent:* Sunday, October 11, 2020 3:20 AM > *To:* devel@edk2.groups.io > *Cc:* Ard Biesheuvel ; Samer El-Haj-Mahmoud=20 > ; Jeremy Linton ;=20 > Pete Batard ; Andrei Warkentin ;=20 > Leif Lindholm > *Subject:* [PATCH edk2-platforms 1/1] Platform/RaspberryPi/AcpiTables:=20 > add a IORT ACPI table to limit XHCI DMA > Add an IORT table that will limit XHCI DMA to 2 GB, by setting the > DMA width to 31 bits. This is needed for Linux/arm64, which can > only reliably deal with devices that are unable to perform DMA to > the entire 32-bit address range if it can discover their existence > early during boot, and this is before the ACPI interpreter is up > and running (which rules out calling the _DMA method of the XHC0 > object) >=20 > Cc: Samer El-Haj-Mahmoud > Cc: Jeremy Linton > Cc: Pete Batard > Cc: Andrei Warkentin > Cc: Leif Lindholm > Signed-off-by: Ard Biesheuvel > --- > Related discussions here: >=20 > https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flor= e.kernel.org%2Flinux-arm-kernel%2F20201001161740.29064-1-nsaenzjulienne%4= 0suse.de%2F&data=3D04%7C01%7Cawarkentin%40vmware.com%7C0ceb573430144c= f5a9c308d86dbe9d15%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637380012= 741008284%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ= BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3DZ1MavubU27xkVXFXSSLtobrwpK= SmerA9y9uRZNDd2Nw%3D&reserved=3D0 > https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flor= e.kernel.org%2Flinux-acpi%2F20201010093153.30177-1-ardb%40kernel.org%2F&a= mp;data=3D04%7C01%7Cawarkentin%40vmware.com%7C0ceb573430144cf5a9c308d86db= e9d15%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637380012741008284%7CU= nknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi= LCJXVCI6Mn0%3D%7C3000&sdata=3DJrfduAeqAJqiFzP8CrwnTigwy21SIJYviMW6Ikd= A8KI%3D&reserved=3D0 >=20 > On Linux, a _DMA method supersedes the IORT, and so the 3 GB limit will > be used at runtime. IOW, streaming DMA will be permitted to the entire > 3 GB region, but if shared buffers or bounce buffers are needed, they > will be allocated from the first 2 GB of DRAM. >=20 > We may need to offer some guidance on this in the IORT spec, i.e., whic= h > value takes precedence if the IORT and the _DMA method disagree. >=20 > =A0Platform/RaspberryPi/AcpiTables/AcpiTables.inf |=A0 1 + > =A0Platform/RaspberryPi/AcpiTables/Iort.aslc=A0=A0=A0=A0=A0 | 58 +++++= +++++++++++++++ > =A02 files changed, 59 insertions(+) >=20 > diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf=20 > b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf > index c40c32e16ff7..d2cce074e56c 100644 > --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf > +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf > @@ -29,6 +29,7 @@ [Sources] > =A0=A0 Fadt.aslc > =A0=A0 Dbg2.aslc > =A0=A0 Gtdt.aslc > +=A0 Iort.aslc > =A0=A0 Dsdt.asl > =A0=A0 Csrt.aslc > =A0=A0 Spcr.aslc > diff --git a/Platform/RaspberryPi/AcpiTables/Iort.aslc=20 > b/Platform/RaspberryPi/AcpiTables/Iort.aslc > new file mode 100644 > index 000000000000..1351e8f7b262 > --- /dev/null > +++ b/Platform/RaspberryPi/AcpiTables/Iort.aslc > @@ -0,0 +1,58 @@ > +/** @file > + > +=A0 Copyright (c) 2020, Arm, Ltd. All rights reserved.
> + > +=A0 SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +#include "AcpiTables.h" > + > +#pragma pack(1) > + > +typedef struct { > +=A0 EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE Node; > +=A0 CONST CHAR8=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Name[16]; > +} RPI4_NC_NODE; > + > +typedef struct { > +=A0 EFI_ACPI_6_0_IO_REMAPPING_TABLE=A0=A0=A0=A0=A0 Iort; > +=A0 RPI4_NC_NODE=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 NamedCompNode; > +} RPI4_IO_REMAPPING_STRUCTURE; > + > +STATIC RPI4_IO_REMAPPING_STRUCTURE Iort =3D { > +=A0 { > +=A0=A0=A0 ACPI_HEADER (EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE, > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 RPI4_IO_REMAPPING_STR= UCTURE, > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 EFI_ACPI_IO_REMAPPING= _TABLE_REVISION), > +=A0=A0=A0 1,=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= // NumNodes > +=A0=A0=A0 sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE),=A0=A0=A0=A0=A0=A0 = // NodeOffset > +=A0=A0=A0 0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 // Reserved > +=A0 }, { > +=A0=A0=A0 // XHCI named component node > +=A0=A0=A0 { > +=A0=A0=A0=A0=A0 { > +=A0=A0=A0=A0=A0=A0=A0 EFI_ACPI_IORT_TYPE_NAMED_COMP, > +=A0=A0=A0=A0=A0=A0=A0 sizeof (RPI4_NC_NODE), > +=A0=A0=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 }, > +=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 0x0, > +=A0=A0=A0=A0=A0 31, > +=A0=A0=A0 }, { > +=A0=A0=A0=A0=A0 "\\_SB_.SCB0.XHC0" > +=A0=A0=A0 } > +=A0 } > +}; > + > +#pragma pack() > + > +VOID* CONST ReferenceAcpiTable =3D &Iort; > --=20 > 2.17.1 >=20