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=KatYJAmr; spf=pass (domain: arm.com, ip: 40.107.5.49, mailfrom: sami.mujawar@arm.com) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.49]) by groups.io with SMTP; Tue, 11 Jun 2019 01:55:08 -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=qJwbPGzswdBjBGZHaLUg6Vk+4aSJeIA79eQ1hVj7vks=; b=KatYJAmr0jFiV5pHbnmnxjQUX7Ym3Ane9aP63WuM/ILbW56C6vY6Q71HAYTa7GL6lf4eGE+ZNW4SuGFehKIKZoAZRHMk19vuDpavX0viPY/qnXoh73wSmZFZmrTkS3x3qs9BsY5gp6AcrCI/RrICLeerilNyjf0q4huh1+KZQTY= Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com (10.172.228.142) by DB6PR0802MB2197.eurprd08.prod.outlook.com (10.172.227.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14; Tue, 11 Jun 2019 08:55:05 +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 08:55:05 +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+Xy0eK9yHPlZXZNKaWLgWA Date: Tue, 11 Jun 2019 08:55:05 +0000 Message-ID: References: <20190606092057.28676-1-pierre.gondois@arm.com> In-Reply-To: <20190606092057.28676-1-pierre.gondois@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: b8f0964e-2841-48fd-80d1-e2ce1a027f6b.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: d2655901-83ef-48fc-c5e5-08d6ee4a7f98 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:DB6PR0802MB2197; x-ms-traffictypediagnostic: DB6PR0802MB2197: x-ms-exchange-purlcount: 1 nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 006546F32A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(376002)(346002)(366004)(39860400002)(199004)(189003)(13464003)(6916009)(6436002)(64756008)(53936002)(52536014)(55016002)(66446008)(6306002)(66556008)(305945005)(53546011)(66476007)(5640700003)(74316002)(478600001)(6506007)(966005)(102836004)(71190400001)(316002)(76176011)(68736007)(81166006)(6116002)(3846002)(8936002)(11346002)(26005)(229853002)(7736002)(15650500001)(446003)(476003)(9686003)(7696005)(81156014)(8676002)(1730700003)(486006)(186003)(99286004)(86362001)(33656002)(66066001)(2501003)(6246003)(5660300002)(4326008)(14444005)(256004)(14454004)(72206003)(73956011)(66946007)(76116006)(2351001)(25786009)(2906002)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0802MB2197;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: TP457cn93twjckEuToYovzi3fl069GWC7yskMl3tG6j33tGb79DmlJliL8lMUrNArSC4XJ5KxZ3PqLwpfpIHNgHdAJyusvI3FVBD6p/zz8xRxxPeAtSq4gFpB0rmVAIn71C13wS77ah2oWG4E3oZojHuH3poHrlm+FE2sH42HKSsIhcnh9ddSIek+c7PLUWv2ElvHnSCR4+qATIUkZC+DsLXOFJpHkLq6p1oeEy/7xVSaKH144xuAfGP0iMF7YWykFRrS1ZP/FIpvoMTc8to2xWt+SFEUzW7+w6HdArLd8bLJPcV6/rROnkLeOMCdGXVEyRvSAcEKedfNw4aboEayQP3EhbpKqt4D2r2nNYTJzwwJ+DbPBCOGeqmohzQRJOPiAqXnhKi3lAID9UwE3P9ZUEBgx/keMysEUaVJfgkEpA= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2655901-83ef-48fc-c5e5-08d6ee4a7f98 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2019 08:55:05.4192 (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: DB6PR0802MB2197 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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)'