From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=agLpbAqO; spf=pass (domain: arm.com, ip: 40.107.6.58, mailfrom: sami.mujawar@arm.com) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.58]) by groups.io with SMTP; Tue, 11 Jun 2019 04:07:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NKi3xHYfYhdzaguXuQLhJ4h2ZNXTKWXMKofK99fQC0g=; b=agLpbAqOpaMif4uoX+YTYOiuUYDK14TtUpV2ySLbfw56ACq5WHhzV9QZ+1CFY/N9P6WgmOAWZtD1hHN53UiTseY8GTnD9wt31Do5e/T2r+v4xOnmdXuMElhL/eLVUFChbSdsf8+4k5Lnv7Ja/nca6nT8TYaOnaHZkJAiYymEP7k= Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com (10.172.228.142) by DB6PR0802MB2341.eurprd08.prod.outlook.com (10.172.229.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.10; Tue, 11 Jun 2019 11:07:17 +0000 Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::a46c:aa3a:17bf:7909]) by DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::a46c:aa3a:17bf:7909%3]) with mapi id 15.20.1965.017; Tue, 11 Jun 2019 11:07:17 +0000 From: "Sami Mujawar" To: "devel@edk2.groups.io" CC: nd Subject: Re: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 Thread-Topic: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 Thread-Index: AQHVHEktfxkbWc+Xy0eK9yHPlZXZNKaWLgWAgAAAMUA= Date: Tue, 11 Jun 2019 11:07:17 +0000 Message-ID: References: <20190606092057.28676-1-pierre.gondois@arm.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 5fdafc94-762b-45e8-a74a-c8282af0a5f2.1 x-checkrecipientchecked: true authentication-results: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; x-originating-ip: [217.140.106.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 78d3e69e-b242-4e79-1f96-08d6ee5cf792 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0802MB2341; x-ms-traffictypediagnostic: DB6PR0802MB2341: x-ms-exchange-purlcount: 1 nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 006546F32A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(136003)(39850400004)(396003)(366004)(199004)(189003)(13464003)(2940100002)(316002)(15650500001)(256004)(14444005)(4326008)(2351001)(478600001)(11346002)(81166006)(66946007)(14454004)(476003)(99286004)(73956011)(76116006)(66476007)(66556008)(64756008)(66446008)(305945005)(72206003)(8936002)(966005)(2906002)(486006)(53936002)(52536014)(3846002)(6116002)(5660300002)(7736002)(229853002)(33656002)(102836004)(68736007)(26005)(6916009)(53546011)(6506007)(25786009)(86362001)(6436002)(2501003)(6246003)(186003)(9686003)(81156014)(6306002)(74316002)(55016002)(8676002)(71190400001)(71200400001)(446003)(76176011)(66066001)(1730700003)(5640700003)(7696005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0802MB2341;H:DB6PR0802MB2375.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: mPnUd38J9Ko3L823HpSJaheX/PTjschi9fasqKnW/EhBKztCDdTj8+iPNflh/xVzK8nO2YrC3VdOhqQe/Vf57XU5fjx0hI5arjFUXj3HzmN9VKqfX6kEo3z7ppzDGpc1xmsTEsDoQ0ogN+HCDhGul6G4ZPjoiUgA/ts/a0jzmvdl9qka+/yNmFeu+8rjXV2JG77EmkcNdrzKxqJKIUSmSfQlyCCsOC80nQEp8eDGHIMA+MGxKd1q0jFUYTQRB4njQtSjS0+T7OfPU7MSsNva9NJxwR7PdhZuhDnU62rK66VcFnoVlUhjT//odWllWPlMvhACqtNSNluAiC7ZOICIkYdpE8zLiv1hif1F7aEUWRQRkR3sdEwp/WZjMrW6/XRaL/uwO2rYuGiFBmsRCAXdueTKU28yM9Kgk3v619nJXcM= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78d3e69e-b242-4e79-1f96-08d6ee5cf792 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2019 11:07:17.6033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2341 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Pushed as 77db115601fb..e8015f2facff -----Original Message----- From: Sami Mujawar=20 Sent: 11 June 2019 09:55 AM To: devel@edk2.groups.io Cc: nd Subject: RE: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 Reviewed-by: Sami Mujawar -----Original Message----- From: PierreGondois =20 Sent: 06 June 2019 10:21 AM To: devel@edk2.groups.io Cc: Sami Mujawar ; Alexei Fedorov ; Matteo Carlini ; Stephanie Hughes-Fitt ; Pierre Gondois ; nd Subject: [PATCH v1 1/1] DynamicTablesPkg: GTDT updates for ACPI 6.3 From: Pierre Gondois The ACPI 6.3 specification adds support for describing ARMv8.1 EL2 virtual timers. Update GTDTGenerator to extend this support. Signed-off-by: Pierre Gondois --- The changes can be seen at: https://github.com/PierreARM/edk2/tree/381_dyna= micTables_gtdt_acpi6_3_update_v1 Notes: v1: - Add support for describing ARMv8.1 EL2 virtual timers and update GTDTGenerator to extend this support. [Pierre] DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 6 ++ DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 69 ++++= +++++++--------- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index bf70dc76cea044b9a8e8eb529d2ddbf892bafd58..0b00c8669729138e910d1fa0987= 0f12dbc2a02a6 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -290,6 +290,12 @@ typedef struct CmArmGenericTimerInfo { =20 /// The non-secure PL2 timer flags UINT32 NonSecurePL2TimerFlags; + + /// GSIV for the virtual EL2 timer + UINT32 VirtualPL2TimerGSIV; + + /// Flags for the virtual EL2 timer + UINT32 VirtualPL2TimerFlags; } CM_ARM_GENERIC_TIMER_INFO; =20 /** A structure that describes the diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator= .c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c index 8d9ddcf9244b9f8b795edf7a53dd8a071bb121bc..adc91c073efcac8e06997658b20= 096ae0b7d7b86 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c @@ -5,7 +5,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): - - ACPI 6.2 Specification - Errata A, September 2017 + - ACPI 6.3 Specification - January 2019 =20 **/ =20 @@ -77,7 +77,7 @@ GET_OBJECT_LIST ( Protocol Interface. @param [in] Gtdt Pointer to the GTDT Table. @param [in] PlatformTimerCount Platform timer count. - + @param [in] AcpiTableRevision Acpi Revision targeted by the platform. @retval EFI_SUCCESS Success. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND The required object was not found. @@ -90,8 +90,9 @@ EFI_STATUS EFIAPI AddGenericTimerInfo ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrPro= tocol, - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, - IN CONST UINT32 PlatformT= imerCount + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN CONST UINT32 PlatformT= imerCount, + IN CONST UINT32 AcpiTable= Revision ) { EFI_STATUS Status; @@ -131,9 +132,14 @@ AddGenericTimerInfo ( GenericTimerInfo->CounterReadBaseAddress; Gtdt->PlatformTimerCount =3D PlatformTimerCount; Gtdt->PlatformTimerOffset =3D (PlatformTimerCount =3D=3D 0) ? 0 : - sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE); + sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE); =20 - return EFI_SUCCESS; + if (AcpiTableRevision > EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REV= ISION) { + Gtdt->VirtualPL2TimerGSIV =3D GenericTimerInfo->VirtualPL2TimerGSIV; + Gtdt->VirtualPL2TimerFlags =3D=20 + GenericTimerInfo->VirtualPL2TimerFlags; + } + + return Status; } =20 /** Add the SBSA Generic Watchdog Timers to the GTDT table. @@ -147,26 +153,26 @@ AddGenericTimerInfo ( STATIC VOID AddGenericWatchd= ogList ( - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN CONST UINT32 WatchdogOffset, IN CONST CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoLis= t, IN UINT32 WatchdogCount ) { - EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog; + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE * Watchdog; =20 ASSERT (Gtdt !=3D NULL); ASSERT (WatchdogInfoList !=3D NULL); =20 - Watchdog =3D (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *) + Watchdog =3D (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE *) ((UINT8*)Gtdt + WatchdogOffset); =20 while (WatchdogCount-- !=3D 0) { // Add watchdog entry DEBUG ((DEBUG_INFO, "GTDT: Watchdog =3D 0x%p\n", Watchdog)); - Watchdog->Type =3D EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG; + Watchdog->Type =3D EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG; Watchdog->Length =3D - sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE); + sizeof (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE); Watchdog->Reserved =3D EFI_ACPI_RESERVED_BYTE; Watchdog->RefreshFramePhysicalAddress =3D WatchdogInfoList->RefreshFrameAddress; @@ -193,7 +199,7 @@ AddGenericWatchdogList ( STATIC EFI_STATUS AddGTBloc= kTimerFrames ( - IN EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame= , + IN EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame= , IN CONST CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimer= FrameList, IN UINT32 GTBlockFrame= Count ) @@ -261,22 +267,22 @@ STATIC EFI_STATUS AddGTBlockList ( IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtoco= l, - IN EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, + IN EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * CONST Gtdt, IN CONST UINT32 GTBlockOffset= , IN CONST CM_ARM_GTBLOCK_INFO * GTBlockInfo, IN UINT32 BlockTimerCou= nt ) { EFI_STATUS Status; - EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE * GTBlock; - EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame; + EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE * GTBlock; + EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE * GtBlockFrame; CM_ARM_GTBLOCK_TIMER_FRAME_INFO * GTBlockTimerFrameList; UINT32 GTBlockTimerFrameCount; =20 ASSERT (Gtdt !=3D NULL); ASSERT (GTBlockInfo !=3D NULL); =20 - GTBlock =3D (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt + + GTBlock =3D (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)Gtdt + GTBlockOffset); =20 while (BlockTimerCount-- !=3D 0) { @@ -298,18 +304,18 @@ AddGTBlockList ( return Status; } =20 - GTBlock->Type =3D EFI_ACPI_6_2_GTDT_GT_BLOCK; - GTBlock->Length =3D sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) + - (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTUR= E) * + GTBlock->Type =3D EFI_ACPI_6_3_GTDT_GT_BLOCK; + GTBlock->Length =3D sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) + + (sizeof=20 + (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) * GTBlockInfo->GTBlockTimerFrameCount); =20 GTBlock->Reserved =3D EFI_ACPI_RESERVED_BYTE; GTBlock->CntCtlBase =3D GTBlockInfo->GTBlockPhysicalAddress; GTBlock->GTBlockTimerCount =3D GTBlockInfo->GTBlockTimerFrameCount; GTBlock->GTBlockTimerOffset =3D - sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE); + sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE); =20 - GtBlockFrame =3D (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE*) + GtBlockFrame =3D (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE*) ((UINT8*)GTBlock + GTBlock->GTBlockTimerOffset); =20 // Add GT Block Timer frames @@ -328,7 +334,7 @@ AddGTBlockList ( } =20 // Next GTBlock - GTBlock =3D (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock + + GTBlock =3D (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE *)((UINT8*)GTBlock=20 + + GTBlock->Length); GTBlockInfo++; }// for @@ -375,7 +381,7 @@ BuildGtdtTable ( UINT32 BlockTimerCount; CM_ARM_GENERIC_WATCHDOG_INFO * WatchdogInfoList; CM_ARM_GTBLOCK_INFO * GTBlockInfo; - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt; + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE * Gtdt; UINT32 Idx; UINT32 GTBlockOffset; UINT32 WatchdogOffset; @@ -442,11 +448,11 @@ BuildGtdtTable ( =20 // Calculate the GTDT Table Size PlatformTimerCount =3D 0; - TableSize =3D sizeof (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE); + TableSize =3D sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE); if (BlockTimerCount !=3D 0) { GTBlockOffset =3D TableSize; PlatformTimerCount +=3D BlockTimerCount; - TableSize +=3D (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_STRUCTURE) * + TableSize +=3D (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) * BlockTimerCount); =20 for (Idx =3D 0; Idx < BlockTimerCount; Idx++) { @@ -461,7 +467,7 @@ Bu= ildGtdtTable ( )); goto error_handler; } - TableSize +=3D (sizeof (EFI_ACPI_6_2_GTDT_GT_BLOCK_TIMER_STRUCTURE) = * + TableSize +=3D (sizeof (EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE)= =20 + * GTBlockInfo[Idx].GTBlockTimerFrameCount); } =20 @@ -477,7 +483,7 @@ BuildGtdtTable ( if (WatchdogCount !=3D 0) { WatchdogOffset =3D TableSize; PlatformTimerCount +=3D WatchdogCount; - TableSize +=3D (sizeof (EFI_ACPI_6_2_GTDT_SBSA_GENERIC_WATCHDOG_STRUCT= URE) * + TableSize +=3D (sizeof=20 + (EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE) * WatchdogCount); DEBUG (( DEBUG_INFO, @@ -500,7 +506,7 @@ BuildGtdtTable ( goto error_handler; } =20 - Gtdt =3D (EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table; + Gtdt =3D (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE*)*Table; DEBUG (( DEBUG_INFO, "GTDT: Gtdt =3D 0x%p TableSize =3D 0x%x\n", @@ -527,7 +533,8 @@ BuildG= tdtTable ( Status =3D AddGenericTimerInfo ( CfgMgrProtocol, Gtdt, - PlatformTimerCount + PlatformTimerCount, + AcpiTableInfo->AcpiTableRevision ); if (EFI_ERROR (Status)) { DEBUG (( @@ -626,9 +633,9 @@ ACPI_TABLE_GENERATOR GtdtGenerator =3D { // Generator Description L"ACPI.STD.GTDT.GENERATOR", // ACPI Table Signature - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, // ACPI Table Revision supported by this Generator - EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, // Minimum ACPI Table Revision supported by this Generator EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, // Creator ID -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'