From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=thomas.abraham@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 620912063D743 for ; Tue, 22 May 2018 21:19:19 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 26E671529 for ; Tue, 22 May 2018 21:19:19 -0700 (PDT) Received: from mail-io0-f170.google.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F1433F59F for ; Tue, 22 May 2018 21:19:19 -0700 (PDT) Received: by mail-io0-f170.google.com with SMTP id c9-v6so21169735iob.12 for ; Tue, 22 May 2018 21:19:19 -0700 (PDT) X-Gm-Message-State: ALKqPwdMMqI7iFmfCI/3xY3VXTLXGnd+JU6F4cMgC1BFxm4vEoWYK5ex m8ikjm9J/aQf0pS3o5AHChg6wnT7maiwK1yCvDM= X-Google-Smtp-Source: ADUXVKIEo+3Am2g1Nol16pTALGFQK+X1wap2dH1KgY+UEmQB0wxYBLstZaTUNJPxewkxunh93ZJR/Wz+kqM3aBi3rmU= X-Received: by 2002:a6b:f804:: with SMTP id o4-v6mr967680ioh.180.1527049158339; Tue, 22 May 2018 21:19:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:97b8:0:0:0:0:0 with HTTP; Tue, 22 May 2018 21:19:17 -0700 (PDT) In-Reply-To: References: <1526891152-18739-1-git-send-email-thomas.abraham@arm.com> <1526891152-18739-10-git-send-email-thomas.abraham@arm.com> From: Thomas Abraham Date: Wed, 23 May 2018 09:49:17 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Ard Biesheuvel Cc: Thomas Abraham , "edk2-devel@lists.01.org" , Leif Lindholm Subject: Re: [PATCH edk2-platforms v4 9/9] Platform/ARM/Sgi: Add Ssdt, Iort and Mcfg tables X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 04:19:19 -0000 Content-Type: text/plain; charset="UTF-8" On Mon, May 21, 2018 at 2:59 PM, Ard Biesheuvel wrote: > On 21 May 2018 at 10:25, Thomas Abraham wrote: >> SGI platforms support a AHCI controller which is attached to a PCIe >> root complex and it can generate PCIe ITS-MSI transactions. So the >> Ssdt, Iort and Mcfg ACPI tables to desribe this topology to the >> linux kernel. >> >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Thomas Abraham >> --- >> .../ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf | 5 + >> Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc | 106 +++++++++++++++++++++ >> Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc | 59 ++++++++++++ >> Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl | 91 ++++++++++++++++++ >> 4 files changed, 261 insertions(+) >> create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc >> create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Mcfg.aslc >> create mode 100644 Platform/ARM/SgiPkg/AcpiTables/Sgi575/Ssdt.asl >> >> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf >> index 2c9bd98..485f819 100644 >> --- a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf >> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/AcpiTables.inf >> @@ -25,8 +25,11 @@ >> Dsdt.asl >> Fadt.aslc >> Gtdt.aslc >> + Iort.aslc >> Madt.aslc >> + Mcfg.aslc >> Spcr.aslc >> + Ssdt.asl >> >> [Packages] >> ArmPkg/ArmPkg.dec >> @@ -51,3 +54,5 @@ >> gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase >> gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase >> gArmPlatformTokenSpaceGuid.PL011UartInterrupt >> + >> + gArmSgiTokenSpaceGuid.PcdPciConfigurationSpaceBaseAddress >> diff --git a/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc >> new file mode 100644 >> index 0000000..f3b3105 >> --- /dev/null >> +++ b/Platform/ARM/SgiPkg/AcpiTables/Sgi575/Iort.aslc >> @@ -0,0 +1,106 @@ >> +/** @file >> +* I/O Remapping Table (Iort) >> +* >> +* Copyright (c) 2018, ARM Ltd. All rights reserved. >> +* >> +* This program and the accompanying materials are licensed and made available >> +* under the terms and conditions of the BSD License which accompanies this >> +* distribution. The full text of the license may be found at >> +* http://opensource.org/licenses/bsd-license.php >> +* >> +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. >> +* >> +**/ >> + >> +#include >> +#include >> +#include >> +#include "SgiAcpiHeader.h" >> + >> +#pragma pack(1) >> + >> +typedef struct >> +{ >> + EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE ItsNode; >> + UINT32 ItsIdentifiers; >> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE; >> + >> +typedef struct >> +{ >> + EFI_ACPI_6_0_IO_REMAPPING_RC_NODE RcNode; >> + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE RcIdMap; >> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE; >> + >> +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_RC_NODE RcNode; >> +} ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE; >> + >> +#pragma pack () >> + >> +ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort = >> +{ >> + // EFI_ACPI_6_0_IO_REMAPPING_TABLE >> + { >> + ARM_ACPI_HEADER // EFI_ACPI_DESCRIPTION_HEADER >> + ( >> + EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE, >> + ARM_EFI_ACPI_6_0_IO_REMAPPING_TABLE, >> + EFI_ACPI_IO_REMAPPING_TABLE_REVISION >> + ), >> + 2, // NumNodes >> + sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE), // NodeOffset >> + 0, // Reserved >> + }, >> + // ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE >> + { >> + // EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE >> + { >> + // EFI_ACPI_6_0_IO_REMAPPING_NODE >> + { >> + EFI_ACPI_IORT_TYPE_ITS_GROUP, // Type >> + sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE), // Length >> + 0, // Revision >> + 0, // Reserved >> + 0, // NumIdMappings >> + 0, // IdReference >> + }, >> + 1, // GIC ITS Identifiers >> + }, >> + 0, >> + }, >> + // ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE >> + { >> + // EFI_ACPI_6_0_IO_REMAPPING_RC_NODE >> + { >> + // EFI_ACPI_6_0_IO_REMAPPING_NODE >> + { >> + EFI_ACPI_IORT_TYPE_ROOT_COMPLEX, // Type >> + sizeof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE), // Length >> + 0, // Revision >> + 0, // Reserved >> + 1, // NumIdMappings >> + __builtin_offsetof (ARM_EFI_ACPI_6_0_IO_REMAPPING_RC_NODE, RcIdMap), // IdReference >> + }, >> + 1, // CacheCoherent >> + 0, // AllocationHints >> + 0, // Reserved >> + 0, // MemoryAccessFlags >> + EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED, // AtsAttribute >> + 0x0, // PciSegmentNumber >> + }, >> + // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE >> + { >> + 0x0038, // InputBase >> + 0x0001, // NumIds >> + 0x0038, // OutputBase > > This looks slightly dodgy to me. NumIds is zero based, so you are > mapping device IDs 0x38 and 0x39 only. Is that what you intended? Yes, that was the intent. I had tested it with these values. But looking at again, it seems better to keep it zero based. Will fix it in the next version. > > It is best to identity remap the entire RID range, even if the virtual > AHCI is the only one that ever uses it. Alternatively, you can create > a EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE mapping for the particular > device ID that the AHCI uses. Okay. Thanks, Thomas.