From nobody Fri May 17 19:00:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104128+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104128+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1683292720; cv=none; d=zohomail.com; s=zohoarc; b=D4UiBKN62fhPJzkd0A06la4GNzxN8LvAVEU7ACF4wM+2HNAx/BTaH9feBgzjStasd85bRXUFyeOBWTicRsg6X2Aui15CoT6DTAGmmEGKhN9OERWATSAftWqC0hpNAgtmKs5dVVj3Yp207aJ41/JFg7+3bS9S87UkLgJHUDL7odc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683292720; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=dg1jOQQF/+hFpjKlKDZn6ATeJi3KBNLbPjpEKx7/TWw=; b=YOvobW676hhYxz89wv1HuIfq2CKujbRht8cs38OBOigm4OGUn+bIiqon2cIFcSzTEcFqdWQV/PoYXJlH390cMO9uKZa3bb2kx6GdYUqfg1xK9cvOskhLoRfh/S9L2oSMLrXv4uN8el1dHTEJzxEpprTI3U8s6WlG08Hxr1tU6Uc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104128+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683292720487928.679780018045; Fri, 5 May 2023 06:18:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DhfdYY1788612xf7BZnuvSt4; Fri, 05 May 2023 06:18:38 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.26973.1683292718460843302 for ; Fri, 05 May 2023 06:18:38 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 770482F4; Fri, 5 May 2023 06:19:22 -0700 (PDT) X-Received: from e126645.arm.com (e126645.nice.arm.com [10.34.100.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 59E5D3F64C; Fri, 5 May 2023 06:18:37 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Thomas Abraham , Sami Mujawar Subject: [edk2-devel] [PATCH v1 1/3] Platform/ARM: Juno: Fix typo Date: Fri, 5 May 2023 15:18:28 +0200 Message-Id: <20230505131830.1310792-2-Pierre.Gondois@arm.com> In-Reply-To: <20230505131830.1310792-1-Pierre.Gondois@arm.com> References: <20230505131830.1310792-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com X-Gm-Message-State: FvvV6Q6ncKEayuRf4QnYKxBwx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683292718; bh=59zVI8jxreOtXom/MTHHGhafxlxbZbTIEod8Bu21uqU=; h=Cc:Date:From:Reply-To:Subject:To; b=ozft5EWIjBQqzUDjM5jcgD5BmbtQGneL4h+dF0xFZXG6LJUTx9aW7bdAqoWg/GVqK5A p5b57tdF4mJFMLtc1IUlk2j9KgJJI6Cx/nEHcMizrq5NvhXuN3XLdKwHNko7rTYWkYFDt xfAV9aA0NYA18wmo5aNATkIaGsWdD8Z5xis= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683292722565100011 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois Fix a typo. Signed-off-by: Pierre Gondois --- .../ConfigurationManagerDxe/ConfigurationManager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.c index 48f0fd370f07..e374d62dfb95 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c @@ -993,7 +993,7 @@ GetGicCInfo ( return EFI_NOT_FOUND; } =20 -/** Return Lpi State Infor. +/** Return Lpi State Info. =20 @param [in] This Pointer to the Configuration Manager Pro= tocol. @param [in] CmObjectId The Object ID of the CM object requested --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104128): https://edk2.groups.io/g/devel/message/104128 Mute This Topic: https://groups.io/mt/98705087/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 17 19:00:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104129+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104129+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1683292720; cv=none; d=zohomail.com; s=zohoarc; b=nGobtpy4FPKigb9Udh0E7Etz9KhqzTaFx2b7/XrhmRHV8ISaz3qS0mFOoQMuoW++TUQVC6QJZIh7gJ1o1+GVEd8YrHKZWbm6mbTpNQw06CFSstawOxuRMN6gXtnsfNa+OWajrD6Im34EzCpDvnieDToLt72b713R7InmzMSoXf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683292720; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=WqjuP2dVZdzF2EDfZPr/0zMBH/QItPE+yXYIEJ7BT70=; b=efq/HgItzifPpO2k+t9sfUD+W3pilel5XQQUlJMUfEsfXyE93LxTgBooypViI1thri878TVZpYo7MLkAdrWPT4WTw6uKzd3I6nTH6bugLRCgbojatPYolNLMwJhTtzy6vF3RRQPA7erlJJicwWOfsMX3dq9/jMS3wnWAWvGySok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104129+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683292720747317.2087156944914; Fri, 5 May 2023 06:18:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id s3LzYY1788612xVhcJAgTdLG; Fri, 05 May 2023 06:18:40 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.26831.1683292719477614985 for ; Fri, 05 May 2023 06:18:39 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7A4A3113E; Fri, 5 May 2023 06:19:23 -0700 (PDT) X-Received: from e126645.arm.com (e126645.nice.arm.com [10.34.100.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 66CC43F64C; Fri, 5 May 2023 06:18:38 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Thomas Abraham , Sami Mujawar Subject: [edk2-devel] [PATCH v1 2/3] Platform/ARM: Juno: Generate _PSD objects Date: Fri, 5 May 2023 15:18:29 +0200 Message-Id: <20230505131830.1310792-3-Pierre.Gondois@arm.com> In-Reply-To: <20230505131830.1310792-1-Pierre.Gondois@arm.com> References: <20230505131830.1310792-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com X-Gm-Message-State: IMYLiPvNEqM7hzrRN6JamKX6x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683292720; bh=2X5Vn2Qq5eQq/be/csOiRgzX19587hInACY/uczQOd4=; h=Cc:Date:From:Reply-To:Subject:To; b=DCa8eRk6P16HJNiIScdLtZJ9ZV6rJz0hLklUHCLJUppEn78URbdlDEyOjf3vTS9129y G3yPquL8qDuSy1ycfQja76CNdCf3FwJINmR053pTXrY/ANM47WVr+HJw8ghUGECXK/KQ+ 9wLoAiUMz7byNIRR5IXLHLan0P6oT6GtA8A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683292722636100012 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois The SsdtCpuTopologyGenerator can generate _PSD objects. Add _PSD information and handling to the Configuration Manager to generate them. Signed-off-by: Pierre Gondois --- .../ConfigurationManager.c | 100 ++++++++++++++++-- .../ConfigurationManager.h | 24 ++++- 2 files changed, 113 insertions(+), 11 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.c index e374d62dfb95..2b881e61be50 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c @@ -1,7 +1,7 @@ /** @file Configuration Manager Dxe =20 - Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -129,12 +129,12 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficien= cy) */ { - GICC_ENTRY (0, GET_MPID (0, 0), 34, 25, 1), - GICC_ENTRY (1, GET_MPID (0, 1), 38, 25, 1), - GICC_ENTRY (2, GET_MPID (1, 0), 50, 25, 0), - GICC_ENTRY (3, GET_MPID (1, 1), 54, 25, 0), - GICC_ENTRY (4, GET_MPID (1, 2), 58, 25, 0), - GICC_ENTRY (5, GET_MPID (1, 3), 62, 25, 0) + GICC_ENTRY (0, GET_MPID (0, 0), 34, 25, 1, REFERENCE_TOKEN (PsdInfo[PS= D_BIG_DOMAIN_ID])), + GICC_ENTRY (1, GET_MPID (0, 1), 38, 25, 1, REFERENCE_TOKEN (PsdInfo[PS= D_BIG_DOMAIN_ID])), + GICC_ENTRY (2, GET_MPID (1, 0), 50, 25, 0, REFERENCE_TOKEN (PsdInfo[PS= D_LITTLE_DOMAIN_ID])), + GICC_ENTRY (3, GET_MPID (1, 1), 54, 25, 0, REFERENCE_TOKEN (PsdInfo[PS= D_LITTLE_DOMAIN_ID])), + GICC_ENTRY (4, GET_MPID (1, 2), 58, 25, 0, REFERENCE_TOKEN (PsdInfo[PS= D_LITTLE_DOMAIN_ID])), + GICC_ENTRY (5, GET_MPID (1, 3), 62, 25, 0, REFERENCE_TOKEN (PsdInfo[PS= D_LITTLE_DOMAIN_ID])), }, =20 // GIC Distributor Info @@ -733,7 +733,29 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposito= ryInfo =3D { { { REFERENCE_TOKEN (LpiInfo[1]) }, { REFERENCE_TOKEN (LpiInfo[2]) }, - } + }, + { // Power domains + { // 0: big cores + // Revision + EFI_ACPI_6_4_AML_PSD_REVISION_V0, + // Domain + PSD_BIG_DOMAIN_ID, + // CoordType + EFI_ACPI_6_4_AML_STATE_COORD_TYPE_SW_ANY, + // NumProc + 2, + }, + { // 1: little cores + // Revision + EFI_ACPI_6_4_AML_PSD_REVISION_V0, + // Domain + PSD_LITTLE_DOMAIN_ID, + // CoordType + EFI_ACPI_6_4_AML_STATE_COORD_TYPE_SW_ANY, + // NumProc + 4, + }, + }, }; =20 /** A helper function for returning the Configuration Manager Objects. @@ -1141,6 +1163,55 @@ GetPciInterruptMapInfo ( return EFI_NOT_FOUND; } =20 +/** Return Psd Info. + + @param [in] This Pointer to the Configuration Manager Pro= tocol. + @param [in] CmObjectId The Object ID of the CM object requested + @param [in] SearchToken A unique token for identifying the reque= sted + CM_ARM_PCI_INTERRUPT_MAP_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager Obj= ect + descriptor describing the requested Obje= ct. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not f= ound. +**/ +EFI_STATUS +EFIAPI +GetPsdInfo ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN SearchToken, + IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject + ) +{ + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; + UINT32 TotalObjCount; + UINT32 ObjIndex; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + TotalObjCount =3D ARRAY_SIZE (PlatformRepo->PsdInfo); + + for (ObjIndex =3D 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->PsdInfo[ObjInde= x]) { + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (PlatformRepo->PsdInfo[ObjIndex]); + CmObject->Data =3D (VOID*)&PlatformRepo->PsdInfo[ObjIndex]; + CmObject->Count =3D 1; + return EFI_SUCCESS; + } + } + + return EFI_SUCCESS; +} + /** Return a list of Configuration Manager object references pointed to by= the given input token. =20 @@ -1537,6 +1608,19 @@ GetArmNameSpaceObject ( ); break; =20 + case EArmObjPsdInfo: + Status =3D HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->PsdInfo, + sizeof (PlatformRepo->PsdInfo), + ARRAY_SIZE (PlatformRepo->PsdInfo), + Token, + GetPsdInfo, + CmObject + ); + break; + default: { Status =3D EFI_NOT_FOUND; DEBUG (( diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.h index 5b5e62427f2b..4082a6f059a5 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -41,7 +41,8 @@ extern CHAR8 ssdtpci_aml_code[]; Mpidr, \ PmuIrq, \ VGicIrq, \ - EnergyEfficiency \ + EnergyEfficiency, \ + PsdToken \ ) { \ CPUInterfaceNumber, /* UINT32 CPUInterfaceNumber */ \ CPUInterfaceNumber, /* UINT32 AcpiProcessorUid */ \ @@ -57,7 +58,13 @@ extern CHAR8 ssdtpci_aml_code[]; VGicIrq, /* UINT32 VGICMaintenanceInterrupt */ \ 0, /* UINT64 GICRBaseAddress */ \ Mpidr, /* UINT64 MPIDR */ \ - EnergyEfficiency /* UINT8 ProcessorPowerEfficiencyClass*/ \ + EnergyEfficiency, /* UINT8 ProcessorPowerEfficiencyClass*/ \ + 0, /* UINT16 SpeOverflowInterrupt */ \ + 0, /* UINT32 ProximityDomain */ \ + 0, /* UINT32 ClockDomain */ \ + 0, /* UINT32 AffinityFlags */ \ + 0, /* CM_OBJECT_TOKEN CpcToken */ \ + PsdToken, /* CM_OBJECT_TOKEN PsdToken */ \ } =20 /** A helper macro for populating the Processor Hierarchy Node flags @@ -196,6 +203,14 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( #define LPI_STATE_COUNT (CORES_LPI_STATE_COUNT + = \ CLUSTERS_LPI_STATE_COUNT) =20 +/** Psd domains: + - 0: big cores + - 1: little cores +*/ +#define PSD_BIG_DOMAIN_ID 0 +#define PSD_LITTLE_DOMAIN_ID 1 +#define PSD_DOMAIN_COUNT 2 + /** A structure describing the platform configuration manager repository information */ @@ -283,6 +298,9 @@ typedef struct PlatformRepositoryInfo { // Cores Low Power Idle state references (LPI) CM_ARM_OBJ_REF CoresLpiRef[CORES_LPI_STATE_COUNT]; =20 + // Power domains + CM_ARM_PSD_INFO PsdInfo[PSD_DOMAIN_COUNT]; + /// Juno Board Revision UINT32 JunoRevision; } EDKII_PLATFORM_REPOSITORY_INFO; --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104129): https://edk2.groups.io/g/devel/message/104129 Mute This Topic: https://groups.io/mt/98705088/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 17 19:00:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104130+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104130+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1683292721; cv=none; d=zohomail.com; s=zohoarc; b=cbUhw9dQ+fYGcV/S0k942f8wbCnMBx8FHoLozM+Bs6XnJqO8W2/PKy8m/WKE6iPwwiWahdwajqnZY69mREwZQKESjkiAwxqEcHuNB/DfGWqNd+B211UEqCcrB/M36xmza+d8o8zWHdo9N/nUvYNwlUq/I/KmE/lR15blDnIc5DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683292721; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=hYSIriSqIIw5KABuFTj7PK4dak60N/NxANPuP9vtgKk=; b=FCGky7jFvlbpR/d0Q+pl4Ei5HwcaKDZ26U5Aj+8wzP34gvgxKl6lgytUnvauZkbsBl5ZqiKJ+P/1Mk3mLAeL8JmHl5rx3b4sEBmgh4+VVIfSmsTglsgLgeoE8Z1+E8ERDRiqSEWFmlsfzL26b0iwDG1UUN/3HJAqPapKLJxOClE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104130+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683292721393870.6963505675268; Fri, 5 May 2023 06:18:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id C9KkYY1788612xpiwnuHegsC; Fri, 05 May 2023 06:18:41 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.26833.1683292720492435873 for ; Fri, 05 May 2023 06:18:40 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7E2161FB; Fri, 5 May 2023 06:19:24 -0700 (PDT) X-Received: from e126645.arm.com (e126645.nice.arm.com [10.34.100.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6AC4E3F64C; Fri, 5 May 2023 06:18:39 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Thomas Abraham , Sami Mujawar Subject: [edk2-devel] [PATCH v1 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 Date: Fri, 5 May 2023 15:18:30 +0200 Message-Id: <20230505131830.1310792-4-Pierre.Gondois@arm.com> In-Reply-To: <20230505131830.1310792-1-Pierre.Gondois@arm.com> References: <20230505131830.1310792-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com X-Gm-Message-State: 82LXdX8gpHJ0hRGVSoVAUOehx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683292721; bh=dZVpFwU6byqiYD0iY1WKBXY1UJ/forZNF/mCeoDDgeg=; h=Cc:Date:From:Reply-To:Subject:To; b=EnK/39OxHN386Oi576JZPdKMLguGnPKWaZX4/lHhCqfRy+JoKGy1jg+9zn4Od7Mh516 Hjo6QWMnk7dk8qyhunYo8lBg7S6VXFb+/2wMJRYHw7AaI9kolSZxz0UyTbqG0Bcqrrud7 a93dTx8yTlpB9HgI1dI2hclko3nyz+MDwlc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683292723518100015 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois The SsdtCpuTopologyGenerator can generate _CPC objects. This is done by querying the SCP for the relevant performance state information through SCMI. CM_ARM_CPC_INFO are then populated and used to generate _CPC objects in the Ssdt Cpu topology. Use the ArmScmiInfoLib and add the handling to generate _CPC information. Note that using _CPC is only possible if SCP is correctly tuned to advertise performance levels on an abstract and unified scale. A basic check is done to prevent the _CPC generation otherwise. The following performance level values where used for testing: - little CPUs OPPs: [181, 322, 383] * 1000 - big CPUs OPPs: [512, 833, 1024] * 1024 Signed-off-by: Pierre Gondois --- .../ConfigurationManager.c | 237 +++++++++++++++++- .../ConfigurationManager.h | 10 + .../ConfigurationManagerDxe.inf | 1 + 3 files changed, 245 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.c index 2b881e61be50..971efc17c8f7 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -756,6 +757,8 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositor= yInfo =3D { 4, }, }, + { // CPC info, dynamically populated. + }, }; =20 /** A helper function for returning the Configuration Manager Objects. @@ -1212,6 +1215,60 @@ GetPsdInfo ( return EFI_SUCCESS; } =20 +/** Return Cpc Info. + + @param [in] This Pointer to the Configuration Manager Pro= tocol. + @param [in] CmObjectId The Object ID of the CM object requested + @param [in] SearchToken A unique token for identifying the reque= sted + CM_ARM_PCI_INTERRUPT_MAP_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager Obj= ect + descriptor describing the requested Obje= ct. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not f= ound. +**/ +EFI_STATUS +EFIAPI +GetCpcInfo ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN SearchToken, + IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject + ) +{ + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; + UINT32 TotalObjCount; + UINT32 ObjIndex; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + if (PlatformRepo->JunoRevision !=3D JUNO_REVISION_R2) { + /* Only support _CPC generation on Juno R2 for now. */ + return EFI_UNSUPPORTED; + } + + TotalObjCount =3D ARRAY_SIZE (PlatformRepo->CpcInfo); + + for (ObjIndex =3D 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->CpcInfo[ObjInde= x]) { + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (PlatformRepo->CpcInfo[ObjIndex]); + CmObject->Data =3D (VOID*)&PlatformRepo->CpcInfo[ObjIndex]; + CmObject->Count =3D 1; + return EFI_SUCCESS; + } + } + + return EFI_SUCCESS; +} + /** Return a list of Configuration Manager object references pointed to by= the given input token. =20 @@ -1621,6 +1678,19 @@ GetArmNameSpaceObject ( ); break; =20 + case EArmObjCpcInfo: + Status =3D HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->CpcInfo, + sizeof (PlatformRepo->CpcInfo), + ARRAY_SIZE (PlatformRepo->CpcInfo), + Token, + GetCpcInfo, + CmObject + ); + break; + default: { Status =3D EFI_NOT_FOUND; DEBUG (( @@ -1776,6 +1846,150 @@ EDKII_CONFIGURATION_MANAGER_PROTOCOL ArmJunoPlatfor= mConfigManagerProtocol =3D { &ArmJunoPlatformRepositoryInfo }; =20 +/** Clear Cpc information. + + If populating _CPC information fails, remove GicC tokens pointing + to Cpc CmObj to avoid creating corrupted _CPC objects. + + @param [in] PlatformRepo Platfom Info repository. + + @retval EFI_SUCCESS Success. +**/ +STATIC +EFI_STATUS +EFIAPI +ClearCpcInfo ( + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo + ) +{ + CM_ARM_GICC_INFO *GicCInfo; + + GicCInfo =3D (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + GicCInfo[0].CpcToken =3D CM_NULL_TOKEN; + GicCInfo[1].CpcToken =3D CM_NULL_TOKEN; + GicCInfo[2].CpcToken =3D CM_NULL_TOKEN; + GicCInfo[3].CpcToken =3D CM_NULL_TOKEN; + GicCInfo[4].CpcToken =3D CM_NULL_TOKEN; + GicCInfo[5].CpcToken =3D CM_NULL_TOKEN; + + return EFI_SUCCESS; +} + +/** Use the SCMI protocol to populate CPC objects dynamically. + + @param [in] PlatformRepo Platfom Info repository. + @param [in] DomainId Id of the DVFS domain to probe. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_UNSUPPORTED Not supported. + @retval !(EFI_SUCCESS) An error occured. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateCpcInfo ( + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN UINT32 DomainId + ) +{ + EFI_STATUS Status; + CM_ARM_GICC_INFO *GicCInfo; + AML_CPC_INFO *CpcInfo; + + if ((PlatformRepo =3D=3D NULL) || + ((DomainId !=3D PSD_BIG_DOMAIN_ID) && + (DomainId !=3D PSD_LITTLE_DOMAIN_ID))) { + Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + if (PlatformRepo->JunoRevision !=3D JUNO_REVISION_R2) { + /* Available frequencies are different on Juno R[0|1|2]. _CPC was + * only tested on Juno R2, so only enable support for this version. + */ + return EFI_UNSUPPORTED; + } + + CpcInfo =3D &PlatformRepo->CpcInfo[DomainId]; + GicCInfo =3D (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + Status =3D ArmScmiInfoGetFastChannel ( + PlatformRepo->PsdInfo[DomainId].Domain, + CpcInfo + ); + if (EFI_ERROR (Status)) { + return Status; + } + + /* CPPC must advertise performances on a 'continuous, abstract, unit-less + performance scale', i.e. CPU performances on an asymmetric platform + nust be represented on a unified scale. + CPU performance values are obtained from SCP through SCMI and adverti= sed + to the OS via the _CPC objects. SCP currently maps performance reques= ts + to frequency requests. + Thus, SCP must be modified to advertise (and correctly handle) + performance values on a unified scale. + + Check that SCP is using a unified scale by checking that the advertis= ed + lowest/nominal frequencies are not the default ones. + */ + if (((DomainId =3D=3D PSD_BIG_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger =3D=3D HZ_TO_KHZ(JUNO_R2_BIG_LOW= EST_FREQ)) && + (CpcInfo->NominalPerformanceInteger =3D=3D HZ_TO_KHZ(JUNO_R2_BIG_NO= MINAL_FREQ))) || + ((DomainId =3D=3D PSD_LITTLE_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger =3D=3D HZ_TO_KHZ(JUNO_R2_LITTLE_= LOWEST_FREQ)) && + (CpcInfo->NominalPerformanceInteger =3D=3D HZ_TO_KHZ(JUNO_R2_LITTLE= _NOMINAL_FREQ)))) { + return EFI_UNSUPPORTED; + } + + // Juno R2's lowest/nominal frequencies. + // Nominal frequency !=3D Highest frequency. + if (DomainId =3D=3D PSD_BIG_DOMAIN_ID) { + CpcInfo->LowestFrequencyInteger =3D JUNO_R2_BIG_LOWEST_FREQ; + CpcInfo->NominalFrequencyInteger =3D JUNO_R2_BIG_NOMINAL_FREQ; + } else { + CpcInfo->LowestFrequencyInteger =3D JUNO_R2_LITTLE_LOWEST_FREQ; + CpcInfo->NominalFrequencyInteger =3D JUNO_R2_LITTLE_NOMINAL_FREQ; + } + + // The mapping Psd -> CPUs is available here. + if (DomainId =3D=3D PSD_BIG_DOMAIN_ID) { + GicCInfo[0].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[1].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + } else { + GicCInfo[2].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[3].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[4].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[5].CpcToken =3D (CM_OBJECT_TOKEN)CpcInfo; + } + + /* + Arm advises to use FFH to the following registers which uses AMU count= ers: + - ReferencePerformanceCounterRegister + - DeliveredPerformanceCounterRegister + Cf. Arm Functional Fixed Hardware Specification + s3.2 Performance management and Collaborative Processor Performance Co= ntrol + + Since, AMU is not supported by the Juno, clear these registers. + */ + CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId =3D EFI_ACPI= _6_4_SYSTEM_MEMORY; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitWidth =3D 0; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitOffset =3D 0; + CpcInfo->ReferencePerformanceCounterRegister.AccessSize =3D 0; + CpcInfo->ReferencePerformanceCounterRegister.Address =3D 0; + + CpcInfo->DeliveredPerformanceCounterRegister.AddressSpaceId =3D EFI_ACPI= _6_4_SYSTEM_MEMORY; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitWidth =3D 0; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitOffset =3D 0; + CpcInfo->DeliveredPerformanceCounterRegister.AccessSize =3D 0; + CpcInfo->DeliveredPerformanceCounterRegister.Address =3D 0; + + return Status; +} + /** Entrypoint of Configuration Manager Dxe. =20 @@ -1795,6 +2009,8 @@ ConfigurationManagerDxeInitialize ( ) { EFI_STATUS Status; + UINT32 Index; + BOOLEAN CpcFailed; =20 Status =3D gBS->InstallProtocolInterface ( &ImageHandle, @@ -1809,7 +2025,7 @@ ConfigurationManagerDxeInitialize ( " Status =3D %r\n", Status )); - goto error_handler; + return Status; } =20 Status =3D InitializePlatformRepository ( @@ -1824,6 +2040,21 @@ ConfigurationManagerDxeInitialize ( )); } =20 -error_handler: - return Status; + CpcFailed =3D FALSE; + for (Index =3D 0; Index < PSD_DOMAIN_COUNT; Index++) { + Status =3D PopulateCpcInfo (&ArmJunoPlatformRepositoryInfo, Index); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "WARN: Could not populate _CPC.\n")); + CpcFailed =3D TRUE; + break; + } + } + + if (CpcFailed) { + // _CPC information is not mandatory and SCP might not support some + // SCMI requests. Failing should not prevent from booting. + ClearCpcInfo (&ArmJunoPlatformRepositoryInfo); + } + + return EFI_SUCCESS; } diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.h index 4082a6f059a5..4c4643b56c96 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h @@ -211,6 +211,13 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( #define PSD_LITTLE_DOMAIN_ID 1 #define PSD_DOMAIN_COUNT 2 =20 +/* JUNO R2 frequency values, in KHz. */ +#define JUNO_R2_BIG_LOWEST_FREQ (600000) +#define JUNO_R2_BIG_NOMINAL_FREQ (1000000) +#define JUNO_R2_LITTLE_LOWEST_FREQ (450000) +#define JUNO_R2_LITTLE_NOMINAL_FREQ (800000) +#define HZ_TO_KHZ(Freq) (Freq * 1000) + /** A structure describing the platform configuration manager repository information */ @@ -301,6 +308,9 @@ typedef struct PlatformRepositoryInfo { // Power domains CM_ARM_PSD_INFO PsdInfo[PSD_DOMAIN_COUNT]; =20 + // Cpc info (1 for each PSD domain) + CM_ARM_CPC_INFO CpcInfo[PSD_DOMAIN_COUNT]; + /// Juno Board Revision UINT32 JunoRevision; } EDKII_PLATFORM_REPOSITORY_INFO; diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager= /ConfigurationManagerDxe/ConfigurationManagerDxe.inf index 91bffe8d5d82..688996549337 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManagerDxe.inf +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManagerDxe.inf @@ -35,6 +35,7 @@ [Packages] =20 [LibraryClasses] ArmPlatformLib + ArmScmiInfoLib PrintLib UefiBootServicesTableLib UefiDriverEntryPoint --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104130): https://edk2.groups.io/g/devel/message/104130 Mute This Topic: https://groups.io/mt/98705089/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-