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.web11.11581.1614950071513924297 for ; Fri, 05 Mar 2021 05:14:31 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: vivek.gautam@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 94CEA11FB; Fri, 5 Mar 2021 05:14:27 -0800 (PST) Received: from usa.arm.com (a074945.blr.arm.com [10.162.16.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EB2483F73B; Fri, 5 Mar 2021 05:14:25 -0800 (PST) From: "Vivek Kumar Gautam" To: devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, leif@nuviainc.com, Sami.Mujawar@arm.com, Vivek.Gautam@arm.com Subject: [edk2-platforms][PATCH V2 1/2] Platform/Sgi: Add smmu-v3 node in the iort acpi table Date: Fri, 5 Mar 2021 18:44:18 +0530 Message-Id: <20210305131419.24069-2-vivek.gautam@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210305131419.24069-1-vivek.gautam@arm.com> References: <20210305131419.24069-1-vivek.gautam@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Arm's SMMU-v3 present in various SGI/RD platforms provides address translation support for devices such as the ones present over PCIe bus. SMMU-v3 also supports Address Translation Service (ATS) and Page Request Interface (PRI) to work with PCIe devices. The overall system topology looks as below: --------------- ------------ ------------ | PCIe device |---->| SMMUv3 |---->| ITS | | (RequesterID) | | (StreamID) | | (DeviceID) | --------------- ------------ ------------ SMMU-v3 accepts requests coming from the PCIe device, and forwards the traffic to the GIC ITS block that can provide the translation for interrupts coming from LPI sources. Add this generic SMMUv3 type node in the iort table and setup the rid->stream-id->device-id mapping accordingly. Signed-off-by: Vivek Gautam --- Platform/ARM/SgiPkg/AcpiTables/Iort.aslc | 58 ++++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/Platform/ARM/SgiPkg/AcpiTables/Iort.aslc b/Platform/ARM/SgiP= kg/AcpiTables/Iort.aslc index 58ec31ddc837..ce8eefc585ea 100644 --- a/Platform/ARM/SgiPkg/AcpiTables/Iort.aslc +++ b/Platform/ARM/SgiPkg/AcpiTables/Iort.aslc @@ -20,6 +20,12 @@ typedef struct UINT32 ItsIdentifiers; } ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE; =20 +typedef struct +{ + EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE SmmuNode; + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE SmmuIdMap[2]; +} ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE; + typedef struct { EFI_ACPI_6_0_IO_REMAPPING_RC_NODE RcNode; @@ -30,6 +36,7 @@ typedef struct { EFI_ACPI_6_0_IO_REMAPPING_TABLE Header; ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE ItsNode; + ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE SmmuNode; ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE RcNode; } ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE; =20 @@ -45,7 +52,7 @@ ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =3D ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, EFI_ACPI_IO_REMAPPING_TABLE_REVISION ), - 2, // NumNodes + 3, // NumNodes sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE), // NodeOffset 0, // Reserved }, @@ -62,9 +69,52 @@ ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =3D 0, // NumIdMappings 0, // IdReference }, - 1, // GIC ITS Identifiers + 1, // ITS count + }, + 0, // GIC ITS Identifiers + }, + // SMMU + { + // EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE + { + // EFI_ACPI_6_0_IO_REMAPPING_NODE + { + EFI_ACPI_IORT_TYPE_SMMUv3, // Type + sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE), // Length + 2, // Revision + 0, // Reserved + 2, // NumIdMapping + OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE, SmmuIdMap),= // IdReference + }, + 0x4F000000, // Base address + EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE, // Flags + 0, // Reserved + 0, // VATOS address + EFI_ACPI_IORT_SMMUv3_MODEL_GENERIC, // SMMUv3 Model + 260, // Event + 0, // Pri + 262, // Gerror + 261, // Sync + 0, // Proximity domain + 1, // DevIDMappingIndex + }, + // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE + { + { + 0x0000, // InputBase + 0xffff, // NumIds + 0x0000, // OutputBase + OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode), // Out= putReference + 0, // Flags + }, + { + 0x0, // InputBase + 0x1, // NumIds + 0x10000, // OutputBase + OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode), // Out= putReference + EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE, // Flags + }, }, - 0, }, // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE { @@ -91,7 +141,7 @@ ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort =3D 0x0000, // InputBase 0xffff, // NumIds 0x0000, // OutputBase - OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, ItsNode), // Outp= utReference + OFFSET_OF (ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, SmmuNode), // Out= putReference 0, // Flags } } --=20 2.17.1