public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"sami.mujawar@arm.com" <sami.mujawar@arm.com>
Cc: "Alexei.Fedorov@arm.com" <Alexei.Fedorov@arm.com>,
	"ardb+tianocore@kernel.org" <ardb+tianocore@kernel.org>,
	"quic_llindhol@quicinc.com" <quic_llindhol@quicinc.com>,
	"pierre.gondois@arm.com" <pierre.gondois@arm.com>,
	"Matteo.Carlini@arm.com" <Matteo.Carlini@arm.com>,
	"Akanksha.Jain2@arm.com" <Akanksha.Jain2@arm.com>,
	"Ben.Adderson@arm.com" <Ben.Adderson@arm.com>,
	"steven.price@arm.com" <steven.price@arm.com>,
	"Lorenzo.Pieralisi@arm.com" <Lorenzo.Pieralisi@arm.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	"Ni, Ray" <ray.ni@intel.com>, "nd@arm.com" <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v6 5/8] MdePkg: IORT header update for IORT Rev E.d spec
Date: Tue, 19 Jul 2022 01:46:45 +0000	[thread overview]
Message-ID: <PH7PR11MB63773FCFCEFD2A27C92E14E3F68F9@PH7PR11MB6377.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220714165031.42640-6-sami.mujawar@arm.com>

Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sami
> Mujawar
> Sent: Friday, July 15, 2022 12:50 AM
> To: devel@edk2.groups.io
> Cc: Sami Mujawar <sami.mujawar@arm.com>; Alexei.Fedorov@arm.com;
> ardb+tianocore@kernel.org; quic_llindhol@quicinc.com;
> pierre.gondois@arm.com; Matteo.Carlini@arm.com;
> Akanksha.Jain2@arm.com; Ben.Adderson@arm.com;
> steven.price@arm.com; Lorenzo.Pieralisi@arm.com; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>;
> Liu, Zhiguang <zhiguang.liu@intel.com>; Ni, Ray <ray.ni@intel.com>; Gao,
> Zhichao <zhichao.gao@intel.com>; nd@arm.com
> Subject: [edk2-devel] [PATCH v6 5/8] MdePkg: IORT header update for IORT
> Rev E.d spec
> 
> 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_REVISION_00.
> 
> Also update the IORT generator in DynamicTablesPkg to fix the compilation
> errors so that Git Bisect can work.
> 
> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> ---
> 
> Notes:
>     v6:
>      - Add definition for IORT Rev 4 and RMR Node Rev 2.             [PIERRE]
>      - Added definition for IORT Rev 4 and RMR Node 2 so that        [SAMI]
>        appropriate checks can be performed for deprecated
>        table/node revisions.
> 
>     v5:
>      - Change IORT revision macro name to make it similar to         [THOMAS]
>        macro names for other ACPI tables.
>      - Updated IORT revision macros from                             [SAMI]
>        EFI_ACPI_IO_REMAPPING_TABLE_REVx to
>        EFI_ACPI_IO_REMAPPING_TABLE_REVISION_0x
>        Ref: https://edk2.groups.io/g/devel/message/91119
>      - Keep EFI_ACPI_IO_REMAPPING_TABLE_REVISION and set to
> [LIMING]
>        EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05.
>        Ref: https://edk2.groups.io/g/devel/message/91137
>      - Added EFI_ACPI_IO_REMAPPING_TABLE_REVISION and set it         [SAMI]
>        to the latest IORT revision.
>      - Updated IORT generator in DynamicTablesPkg and included       [SAMI]
>        in this patch so that Git bisect does not break.
> 
>     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.
> 
>  DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 19
> ++---
>  MdePkg/Include/IndustryStandard/IoRemappingTable.h               | 86
> ++++++++++++++++++--
>  2 files changed, 87 insertions(+), 18 deletions(-)
> 
> diff --git
> a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> index
> abef9e5a7f90a38e1d697227d3cd2c110db364a4..63381441e2d6515a7cc9731c8
> 9b9739a12c65599 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
> @@ -766,7 +766,7 @@ AddItsGroupNodes (
>      ItsGroupNode->Node.Type          = EFI_ACPI_IORT_TYPE_ITS_GROUP;
>      ItsGroupNode->Node.Length        = (UINT16)NodeLength;
>      ItsGroupNode->Node.Revision      = 0;
> -    ItsGroupNode->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    ItsGroupNode->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      ItsGroupNode->Node.NumIdMappings = 0;
>      ItsGroupNode->Node.IdReference   = 0;
> 
> @@ -872,7 +872,7 @@ AddNamedComponentNodes (
>      NcNode->Node.Type          = EFI_ACPI_IORT_TYPE_NAMED_COMP;
>      NcNode->Node.Length        = (UINT16)NodeLength;
>      NcNode->Node.Revision      = 2;
> -    NcNode->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    NcNode->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      NcNode->Node.NumIdMappings = NodeList->IdMappingCount;
> 
>      ObjectNameLength         = AsciiStrLen (NodeList->ObjectName) + 1;
> @@ -1005,7 +1005,7 @@ AddRootComplexNodes (
>      RcNode->Node.Type          = EFI_ACPI_IORT_TYPE_ROOT_COMPLEX;
>      RcNode->Node.Length        = (UINT16)NodeLength;
>      RcNode->Node.Revision      = 1;
> -    RcNode->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    RcNode->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      RcNode->Node.NumIdMappings = NodeList->IdMappingCount;
>      RcNode->Node.IdReference   = (NodeList->IdMappingCount == 0) ?
>                                   0 : sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE);
> @@ -1018,9 +1018,8 @@ AddRootComplexNodes (
>      RcNode->AtsAttribute      = NodeList->AtsAttribute;
>      RcNode->PciSegmentNumber  = NodeList->PciSegmentNumber;
>      RcNode->MemoryAddressSize = NodeList->MemoryAddressSize;
> +    RcNode->PasidCapabilities = EFI_ACPI_RESERVED_WORD;
>      RcNode->Reserved1[0]      = EFI_ACPI_RESERVED_BYTE;
> -    RcNode->Reserved1[1]      = EFI_ACPI_RESERVED_BYTE;
> -    RcNode->Reserved1[2]      = EFI_ACPI_RESERVED_BYTE;
> 
>      if (NodeList->IdMappingCount > 0) {
>        if (NodeList->IdMappingToken == CM_NULL_TOKEN) { @@ -1188,7
> +1187,7 @@ AddSmmuV1V2Nodes (
>      SmmuNode->Node.Type          = EFI_ACPI_IORT_TYPE_SMMUv1v2;
>      SmmuNode->Node.Length        = (UINT16)NodeLength;
>      SmmuNode->Node.Revision      = 0;
> -    SmmuNode->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    SmmuNode->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      SmmuNode->Node.NumIdMappings = NodeList->IdMappingCount;
>      SmmuNode->Node.IdReference   = (NodeList->IdMappingCount == 0) ?
>                                     0 : (sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE)
> + @@ -1387,7 +1386,7 @@ AddSmmuV3Nodes (
>      SmmuV3Node->Node.Type          = EFI_ACPI_IORT_TYPE_SMMUv3;
>      SmmuV3Node->Node.Length        = (UINT16)NodeLength;
>      SmmuV3Node->Node.Revision      = 2;
> -    SmmuV3Node->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    SmmuV3Node->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      SmmuV3Node->Node.NumIdMappings = NodeList->IdMappingCount;
>      SmmuV3Node->Node.IdReference   = (NodeList->IdMappingCount == 0) ?
>                                       0 : sizeof
> (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE);
> @@ -1518,7 +1517,7 @@ AddPmcgNodes (
>      PmcgNode->Node.Type          = EFI_ACPI_IORT_TYPE_PMCG;
>      PmcgNode->Node.Length        = (UINT16)NodeLength;
>      PmcgNode->Node.Revision      = 1;
> -    PmcgNode->Node.Reserved      = EFI_ACPI_RESERVED_DWORD;
> +    PmcgNode->Node.Identifier    = EFI_ACPI_RESERVED_DWORD;
>      PmcgNode->Node.NumIdMappings = NodeList->IdMappingCount;
>      PmcgNode->Node.IdReference   = (NodeList->IdMappingCount == 0) ?
>                                     0 : sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE);
> @@ -2258,9 +2257,9 @@ ACPI_IORT_GENERATOR  IortGenerator = {
>      // ACPI Table Signature
>      EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE,
>      // ACPI Table Revision supported by this Generator
> -    EFI_ACPI_IO_REMAPPING_TABLE_REVISION,
> +    EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00,
>      // Minimum supported ACPI Table Revision
> -    EFI_ACPI_IO_REMAPPING_TABLE_REVISION,
> +    EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00,
>      // Creator ID
>      TABLE_GENERATOR_CREATOR_ID_ARM,
>      // Creator Revision
> diff --git a/MdePkg/Include/IndustryStandard/IoRemappingTable.h
> b/MdePkg/Include/IndustryStandard/IoRemappingTable.h
> index
> 79a34678681d45b2982dc8573db6bd447f42e429..f48a4a95cd71a147098dff33ef
> f3096b52021990 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_I
> O_Remapping_Table.pdf
> +  ACPI IO Remapping Table (IORT) definitions.
> 
>    Copyright (c) 2017, Linaro Limited. All rights reserved.<BR>
> -  Copyright (c) 2018, ARM Limited. All rights reserved.<BR>
> +  Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.<BR>
> 
>    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,9 @@
> 
>  #include <IndustryStandard/Acpi.h>
> 
> -#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION  0x0
> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00  0x0
> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION_04  0x4   //
> Deprecated
> +#define EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05  0x5
> 
>  #define EFI_ACPI_IORT_TYPE_ITS_GROUP     0x0
>  #define EFI_ACPI_IORT_TYPE_NAMED_COMP    0x1
> @@ -22,6 +31,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,10 +65,34 @@
>  #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
> 
> +#define EFI_ACPI_IORT_RMR_NODE_REVISION_02  0x2    // Deprecated
> +
>  #pragma pack(1)
> 
>  ///
> @@ -89,7 +123,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 +152,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 +234,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)'
> 
> 
> 
> 
> 


  reply	other threads:[~2022-07-19  1:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 16:50 [PATCH v6 0/8] IORT Rev E.d specification updates Sami Mujawar
2022-07-14 16:50 ` [PATCH v6 1/8] ShellPkg: Acpiview: Abbreviate field names to preserve alignment Sami Mujawar
2022-07-19  1:46   ` Gao, Zhichao
2022-07-14 16:50 ` [PATCH v6 2/8] DynamicTablesPkg: Handle error when IdMappingToken is NULL Sami Mujawar
2022-07-14 16:50 ` [PATCH v6 3/8] DynamicTablesPkg: IORT set reference to Id array only if present Sami Mujawar
2022-07-14 16:50 ` [PATCH v6 4/8] DynamicTablesPkg: IORT set reference to interrupt array " Sami Mujawar
2022-07-14 16:50 ` [PATCH v6 5/8] MdePkg: IORT header update for IORT Rev E.d spec Sami Mujawar
2022-07-19  1:46   ` Gao, Zhichao [this message]
2022-07-14 16:50 ` [PATCH v6 6/8] ShellPkg: Acpiview: IORT parser " Sami Mujawar
2022-07-18  8:48   ` Sami Mujawar
2022-07-19  1:59   ` [edk2-devel] " Gao, Zhichao
2022-07-14 16:50 ` [PATCH v6 7/8] DynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.d Sami Mujawar
2022-07-14 16:50 ` [PATCH v6 8/8] DynamicTablesPkg: IORT generator updates for Rev E.d spec Sami Mujawar
2022-07-18  7:42 ` [PATCH v6 0/8] IORT Rev E.d specification updates PierreGondois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH7PR11MB63773FCFCEFD2A27C92E14E3F68F9@PH7PR11MB6377.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox