From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by mx.groups.io with SMTP id smtpd.web12.2400.1657173953084665372 for ; Wed, 06 Jul 2022 23:05:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@solid-run-com.20210112.gappssmtp.com header.s=20210112 header.b=J+ckv95f; spf=pass (domain: solid-run.com, ip: 209.85.160.42, mailfrom: jon@solid-run.com) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-10c0119dd16so13109441fac.6 for ; Wed, 06 Jul 2022 23:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zn9qzKvHRmFPaKPW+Ldr3ELc7lh1Sr4N5X7npn3yj/U=; b=J+ckv95fOLPq3KT0FxsH4pGq0uvD//z9PFFpRMIX/Tdyb1NbKZ9MVRffwrMU/bSkyK bylhuUOVdgCIE/54tDtQ4YUSaz8uHiMC24kklQ0CfXQw0fpgT7AoRNNCNUEfm3eviLzx EZzxodvILVT9E0bwmWhRGK4D6r4gAEq0mgwi8pHMuCowF8cvRpqclx2Bgwyy6T8hSIKx q41qorBwpKCvX6U4wChnaVrEuwnptGyoqbJ/iS9mS0sI0nj5mNKoTjHsX0nS1nQp7wNe OpMi/xUn4erjOv2BetLTbPKICqQ+VzcOL2l6JZM126+UUff13kANFF2dcTL62JfLVKAE rPXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zn9qzKvHRmFPaKPW+Ldr3ELc7lh1Sr4N5X7npn3yj/U=; b=38ouOq3XD3P2sRR0yA5jZ4FjkwWsRqdcZFXm/mumf6xUVeGIcoIh46QEk9fpjXebqP MB7SMHBhIaKCKL5FL/PTy3ciC0pHVj3nu1mAYZ4xCCqAVRj1oPnhE9DHlbwRjblQKvlf OzkwyoGktFTDZNiH+bCj+An/zWPzgLA3mhAG6ZlpamsiZ7BagjrkiDGDulMoE9sBOdAA 2tsL7lJakQwKRRi6BEVCphACj4aMPLP/Wtdx/FiHImRSWJX30htLU0BAyzlWXoUAUHgb Lte8zL5olK0wA+ZNVWJpw2KMLKmczBInkg66ByFjY4tpWay+PVTaHyZzGE4hZLaAFrHt c2OQ== X-Gm-Message-State: AJIora/JEGZNvk43YtDwvFRyBUTx36VRdiBHbTJqohxKcdsU4tKw1a1n 2nMDKXUj/nfHuB/5Kq+huiMqayJObyXJJiXzzLqG5MANjcCWiw== X-Google-Smtp-Source: AGRyM1tQ3Pxri/L2aQFpJRFl06+/aA6j+EyEaygynoD2yBBvOiX2hzA+U795c4mFnpAOsGyQ/UJOBbs2ES3xi+bPgSQ= X-Received: by 2002:a05:6870:c083:b0:10c:275b:45f3 with SMTP id c3-20020a056870c08300b0010c275b45f3mr1777675oad.206.1657173952146; Wed, 06 Jul 2022 23:05:52 -0700 (PDT) MIME-Version: 1.0 References: <20220706095631.27196-1-sami.mujawar@arm.com> <20220706095631.27196-2-sami.mujawar@arm.com> In-Reply-To: <20220706095631.27196-2-sami.mujawar@arm.com> From: "Jon Nettleton" Date: Thu, 7 Jul 2022 08:05:15 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH v4 1/8] MdePkg: IORT header update for IORT Rev E.d spec To: edk2-devel-groups-io , Sami Mujawar Cc: Alexei.Fedorov@arm.com, "Ard Biesheuvel (TianoCore)" , quic_llindhol@quicinc.com, pierre.gondois@arm.com, Matteo.Carlini@arm.com, Akanksha.Jain2@arm.com, Ben.Adderson@arm.com, Steven Price , Lorenzo Pieralisi , michael.d.kinney@intel.com, Liming Gao , zhiguang.liu@intel.com, ray.ni@intel.com, zhichao.gao@intel.com, nd@arm.com Content-Type: text/plain; charset="UTF-8" On Wed, Jul 6, 2022 at 11:57 AM Sami Mujawar wrote: > > Bugzilla: 3458 - Add support IORT Rev E.d specification updates > (https://bugzilla.tianocore.org/show_bug.cgi?id=3458) > > The IO Remapping Table, Platform Design Document, Revision E.d, > Feb 2022 (https://developer.arm.com/documentation/den0049/) > introduces the following updates, collectively including the > updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c: > - increments the IORT table revision to 5. > - updates the node definition to add an 'Identifier' field. > - adds definition of node type 6 - Reserved Memory Range node. > - adds definition for Memory Range Descriptors. > - adds flag to indicate PRI support for root complexes. > - adds flag to indicate if the root complex supports forwarding > of PASID information on translated transactions to the SMMU. > - adds flag to indicate if the root complex supports PASID. > - adds flags to define access privilege and attributes for the > memory ranges. > > Therefore, update the IORT header file to reflect these changes, > and also rename the EFI_ACPI_IO_REMAPPING_TABLE_REVISION macro to > EFI_ACPI_IO_REMAPPING_TABLE_REV0. > > Signed-off-by: Sami Mujawar > --- > > Notes: > v4: > - Updated patch series to IORT specification revision E.d. [SAMI] > - Add flag to indicate if the root complex supports PASID. [SAMI] > - Add flags to define access privilege and attributes for [SAMI] > the memory ranges. > v3: > - Submit patch series to update platform code to use the [LIMING] > EFI_ACPI_IO_REMAPPING_TABLE_REV0 macro. > Ref: https://edk2.groups.io/g/devel/topic/83618423#76799 > - Removed definition of EFI_ACPI_IO_REMAPPING_TABLE_REVISION [SAMI] > as EFI_ACPI_IO_REMAPPING_TABLE_REV0 has been provided for > representing Rev 0. Also, a corresponding patch series > for updating the platforms in edk2-platforms repository > shall be submitted to the edk2 mailing list. > - Include r-b received from v2 series. [SAMI] > Ref: https://edk2.groups.io/g/devel/topic/83600724#76660 > > v2: > - Set EFI_ACPI_IO_REMAPPING_TABLE_REVISION to Rev 0 as [SAMI] > setting to Rev 3 will break existing platforms. The > problem is that existing code would not be populating > the Identifier field in the nodes. This can lead to > non-unique values in the Identifier field. > > MdePkg/Include/IndustryStandard/IoRemappingTable.h | 83 ++++++++++++++++++-- > 1 file changed, 75 insertions(+), 8 deletions(-) > > diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h b/MdePkg/Include/IndustryStandard/IoRemappingTable.h > index 79a34678681d45b2982dc8573db6bd447f42e429..07cb7f49dc936fb00cc549113f1e62f988535e5d 100644 > --- a/MdePkg/Include/IndustryStandard/IoRemappingTable.h > +++ b/MdePkg/Include/IndustryStandard/IoRemappingTable.h > @@ -1,12 +1,19 @@ > /** @file > - ACPI IO Remapping Table (IORT) as specified in ARM spec DEN0049D > - > - http://infocenter.arm.com/help/topic/com.arm.doc.den0049d/DEN0049D_IO_Remapping_Table.pdf > + ACPI IO Remapping Table (IORT) definitions. > > Copyright (c) 2017, Linaro Limited. All rights reserved.
> - Copyright (c) 2018, ARM Limited. All rights reserved.
> + Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > + > + @par Reference(s): > + - IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 > + (https://developer.arm.com/documentation/den0049/) > + > + @par Glossary: > + - Ref : Reference > + - Mem : Memory > + - Desc : Descriptor > **/ > > #ifndef __IO_REMAPPING_TABLE_H__ > @@ -14,7 +21,8 @@ > > #include > > -#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION 0x0 > +#define EFI_ACPI_IO_REMAPPING_TABLE_REV0 0x0 > +#define EFI_ACPI_IO_REMAPPING_TABLE_REV5 0x5 > > #define EFI_ACPI_IORT_TYPE_ITS_GROUP 0x0 > #define EFI_ACPI_IORT_TYPE_NAMED_COMP 0x1 > @@ -22,6 +30,7 @@ > #define EFI_ACPI_IORT_TYPE_SMMUv1v2 0x3 > #define EFI_ACPI_IORT_TYPE_SMMUv3 0x4 > #define EFI_ACPI_IORT_TYPE_PMCG 0x5 > +#define EFI_ACPI_IORT_TYPE_RMR 0x6 > > #define EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA BIT0 > > @@ -55,7 +64,29 @@ > #define EFI_ACPI_IORT_SMMUv3_MODEL_CAVIUM_CN99XX 0x2 > > #define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED 0x0 > -#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED 0x1 > +#define EFI_ACPI_IORT_ROOT_COMPLEX_ATS_SUPPORTED BIT0 > + > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PRI_UNSUPPORTED 0x0 > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PRI_SUPPORTED BIT1 > + > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PASID_FWD_UNSUPPORTED 0x0 > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PASID_FWD_SUPPORTED BIT2 > + > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PASID_UNSUPPORTED 0x0 > +#define EFI_ACPI_IORT_ROOT_COMPLEX_PASID_SUPPORTED BIT1 > + > +#define EFI_ACPI_IORT_RMR_REMAP_NOT_PERMITTED 0x0 > +#define EFI_ACPI_IORT_RMR_REMAP_PERMITTED BIT0 > + > +#define EFI_ACPI_IORT_RMR_ACCESS_REQ_NOT_PRIVILEGED 0x0 > +#define EFI_ACPI_IORT_RMR_ACCESS_REQ_PRIVILEGED BIT1 > + > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_DEV_NGNRNE 0x0 > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_DEV_NGNRE 0x1 > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_DEV_NGRE 0x2 > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_DEV_GRE 0x3 > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_NORM_IN_NC_OUT_NC 0x4 > +#define EFI_ACPI_IORT_RMR_ACCESS_ATTRIB_NORM_IN_WB_OUT_WB_ISH 0x5 > > #define EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE BIT0 > > @@ -89,7 +120,7 @@ typedef struct { > UINT8 Type; > UINT16 Length; > UINT8 Revision; > - UINT32 Reserved; > + UINT32 Identifier; > UINT32 NumIdMappings; > UINT32 IdReference; > } EFI_ACPI_6_0_IO_REMAPPING_NODE; > @@ -118,7 +149,9 @@ typedef struct { > UINT32 AtsAttribute; > UINT32 PciSegmentNumber; > UINT8 MemoryAddressSize; > - UINT8 Reserved1[3]; > + UINT16 PasidCapabilities; > + UINT8 Reserved1[1]; > + UINT32 Flags; > } EFI_ACPI_6_0_IO_REMAPPING_RC_NODE; > > /// > @@ -198,6 +231,40 @@ typedef struct { > // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE OverflowInterruptMsiMapping[1]; > } EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE; > > +/// > +/// Memory Range Descriptor. > +/// > +typedef struct { > + /// Base address of Reserved Memory Range, > + /// aligned to a page size of 64K. > + UINT64 Base; > + > + /// Length of the Reserved Memory range. > + /// Must be a multiple of the page size of 64K. > + UINT64 Length; > + > + /// Reserved, must be zero. > + UINT32 Reserved; > +} EFI_ACPI_6_0_IO_REMAPPING_MEM_RANGE_DESC; > + > +/// > +/// Node type 6: Reserved Memory Range (RMR) node > +/// > +typedef struct { > + EFI_ACPI_6_0_IO_REMAPPING_NODE Node; > + > + /// RMR flags > + UINT32 Flags; > + > + /// Memory range descriptor count. > + UINT32 NumMemRangeDesc; > + > + /// Offset of the memory range descriptor array. > + UINT32 MemRangeDescRef; > + // EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE IdMapping[1]; > + // EFI_ACPI_6_0_IO_REMAPPING_MEM_RANGE_DESC MemRangeDesc[1]; > +} EFI_ACPI_6_0_IO_REMAPPING_RMR_NODE; > + > #pragma pack() > > #endif > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > > > Please break out the Flags attribute to its own structure so it better reflects the documentation in the spec. I am current using something like this, +^M +///^M +/// Node header definition shared by all node types^M +///^M +typedef struct {^M + UINT32 RemappingPermitted : 1; + UINT32 AccessPrivilege : 1; + UINT32 AccessAttributes : 8; + UINT32 Reserved10_31 : 22; +} EFI_ACPI_6_0_IO_REMAPPING_RMR_FLAGS; +^M /// /// Node type 6: Reserved Memory Range (RMR) node /// @@ -240,7 +258,7 @@ typedef struct { EFI_ACPI_6_0_IO_REMAPPING_NODE Node; /// RMR flags - UINT32 Flags; + EFI_ACPI_6_0_IO_REMAPPING_RMR_FLAGS Flags; -Jon