From nobody Fri May 10 07:01:18 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+111580+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+111580+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1700585512; cv=none; d=zohomail.com; s=zohoarc; b=M1IrJF+9L2iGIRHUn8uR4GtotsU5BediGj9may3LNrNbVyNSXqYaMfbqsbCET9WEtRytzMqMdgpDS2dmRK+8FaBwcxzK8I/Cc0UGwLcjc/ApxmGBzDv061cxtYbJ2SQ3SNrONM0XzYsj2T6cSgulnI15NIN+QCs3AblEgss/OrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700585512; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=bdBft41+MrDxf86xxyhI4JPSX53DhiltC9uvlWWJx0s=; b=CmwLwW9iey3pihgAzN8Ck40c5LQC0LyFoX84cO5Ehskn1BOxdcRPz4PLpZ+RI2gOUBvY83fPdrCSiDa5wTcqy2/J6PJnAQUqkfuolfoUwooC+c/gZsMJxxZ4KZmo6p3MrZT5Zy91ld0j9y8kC0JoghxpTY8BE9nwPm636oX3oDw= 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+111580+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 1700585512175415.6644140393647; Tue, 21 Nov 2023 08:51:52 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=5NeyObGz92xBSKpAEnYp/DBCpoVgPt9XmqsyETMEVU8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700585511; v=1; b=SswWPNXNtLRIlw1teP1FQfa0G7lUh/Z6eaaN1mVOeEdVKO/SSkXH8zb0WOeTqWWOl+tEjV3K +SCnDrbemYIvQ0Fp3ZhPzAxyeysJ0iXFKXPkxW/w6zAYrhEMNCpgJHgakjnZ86zaDuTqnyvWV+/ 0LA7kP7xJJD+doyce9WXGI6Q= X-Received: by 127.0.0.2 with SMTP id Eu64YY1788612xvXWHONjxMr; Tue, 21 Nov 2023 08:51:51 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.46844.1700585511310837049 for ; Tue, 21 Nov 2023 08:51:51 -0800 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 CD280168F; Tue, 21 Nov 2023 08:52:37 -0800 (PST) X-Received: from e126645.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9130D3F6C4; Tue, 21 Nov 2023 08:51:49 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Thomas Abraham Subject: [edk2-devel] [PATCH v3 1/3] Platform/ARM: Juno: Fix typo Date: Tue, 21 Nov 2023 17:51:33 +0100 Message-Id: <20231121165135.1547708-2-pierre.gondois@arm.com> In-Reply-To: <20231121165135.1547708-1-pierre.gondois@arm.com> References: <20231121165135.1547708-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6zyvOY5WhBcqOaJoj3k4qOrFx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1700585513369100001 Content-Type: text/plain; charset="utf-8" Fix a typo. Change-Id: I84807f18855ff4c0a2f34a3556edc4698eea2170 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 91f035480dcf..2fdb15cc4caf 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 (#111580): https://edk2.groups.io/g/devel/message/111580 Mute This Topic: https://groups.io/mt/102732064/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 10 07:01:18 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+111581+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+111581+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1700585513; cv=none; d=zohomail.com; s=zohoarc; b=NOerRiZDqr+yTPU7i+bEo2drPFWUJbwwDLPx99r+h0QGhQYjBHZ6HEti0J78Vef42ryaVPEMwGgMI6xrnig0uaOKo4WwXyhqR5NCG8Wh9Q3szMew/WAJdgejxNTQWR2+GXQogjlktsxys6dackt/t7ah8pmCo1aVe57ZRVU6W0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700585513; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=rs+EwFuYQpvNvYxkhWTRiKG3jyJ/L+qOVNSkO9h/RUM=; b=IJR12+N45lwZAyZL9yffY6u8EN6vDgCkmYbmtW2lOpxn/q722D5CGAnt+H0WNWuj+xHJgrIaHS9eCImWvbxS1Q3LKD11kAD45X6tb5Lqi0wKiK1jYEA7gxLDIlJ+jyKOI4JIYUQY/WWW/A+uJT8qg4YtErYcyOPp2iWEoixGKlk= 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+111581+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 1700585513934397.1985885087913; Tue, 21 Nov 2023 08:51:53 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=4gQPfl55+06j5PHspxqkKio4lTcPPrnBWNKPrGHPeNg=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700585513; v=1; b=KUU/Jha8SLY/v9abudS4H1IzZVxIM2VuevZIlw9BeyDbCNWCOnfFF+W/BFLtwZm4i/AjFwF1 KkKhrrvCnQtH48uJENDaaACy1DJPMSjLm+UYYZb3FqDQ6IGZ5eKblTfL/jhpPvHdE1A/hCM2AHi eEPXuTgCN2MZj2ndvl3YIJXo= X-Received: by 127.0.0.2 with SMTP id Z8EdYY1788612x2sjZeYb0tu; Tue, 21 Nov 2023 08:51:53 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.46845.1700585512879228237 for ; Tue, 21 Nov 2023 08:51:53 -0800 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 5B6261042; Tue, 21 Nov 2023 08:52:39 -0800 (PST) X-Received: from e126645.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4A0783F6C4; Tue, 21 Nov 2023 08:51:51 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Thomas Abraham Subject: [edk2-devel] [PATCH v3 2/3] Platform/ARM: Juno: Generate _PSD objects Date: Tue, 21 Nov 2023 17:51:34 +0100 Message-Id: <20231121165135.1547708-3-pierre.gondois@arm.com> In-Reply-To: <20231121165135.1547708-1-pierre.gondois@arm.com> References: <20231121165135.1547708-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MmTRDn7GM1iz4oxgy6nIDYvKx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1700585515425100006 Content-Type: text/plain; charset="utf-8" The SsdtCpuTopologyGenerator can generate _PSD objects. Add _PSD information and handling to the Configuration Manager to generate them. Change-Id: I4bb23582d250d43c173a3e6ee86eb6b0349f1b03 Signed-off-by: Pierre Gondois --- .../ConfigurationManager.c | 98 +++++++++++++++++-- .../ConfigurationManager.h | 24 ++++- 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.c index 2fdb15cc4caf..6a4f6e626d3f 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.c @@ -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_5_AML_PSD_REVISION_V0, + // Domain + PSD_BIG_DOMAIN_ID, + // CoordType + EFI_ACPI_6_5_AML_STATE_COORD_TYPE_SW_ANY, + // NumProc + 2, + }, + { // 1: little cores + // Revision + EFI_ACPI_6_5_AML_PSD_REVISION_V0, + // Domain + PSD_LITTLE_DOMAIN_ID, + // CoordType + EFI_ACPI_6_5_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 @@ -1549,6 +1620,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..e58e9cbecb23 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h @@ -41,7 +41,8 @@ extern CHAR8 ssdtpci_aml_code[]; Mpidr, \ PmuIrq, \ VGicIrq, \ - EnergyEfficiency \ + EnergyEfficiency, \ + PsdToken \ ) { \ CPUInterfaceNumber, /* UINT32 CPUInterfaceNumber */ \ CPUInterfaceNumber, /* UINT32 AcpiProcessorUid */ \ @@ -57,7 +58,15 @@ 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 */ \ + CM_NULL_TOKEN, /* CM_OBJECT_TOKEN CpcToken */ \ + 0, /* UINT16 TrbeInterrupt */ \ + CM_NULL_TOKEN, /* CM_OBJECT_TOKEN EtToken */ \ + PsdToken, /* CM_OBJECT_TOKEN PsdToken */ \ } =20 /** A helper macro for populating the Processor Hierarchy Node flags @@ -196,6 +205,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 +300,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 (#111581): https://edk2.groups.io/g/devel/message/111581 Mute This Topic: https://groups.io/mt/102732065/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 10 07:01:18 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+111582+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+111582+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1700585515; cv=none; d=zohomail.com; s=zohoarc; b=ZXhR43h2jILTv5maRwaxJHxeWwVHUyYXdJ5VHjeplktFppGY57yVjDbR7au4wNZtrW4/j1sSvb7TD9bV2r0RKoY0wcS1qNKpoCZaAVKejFoKn5Q2MK0045UkuDykDyQSq/tBy3RJHZMWr4tnQ4U4VbOxve2d83Ia2/ST8P6ilPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700585515; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=7gYC/qJV4RcR2w+fYLz8rp2OS+UBFDLcm7R4Z9afVDI=; b=DtHnN/FJ6ORHdd7KwycgUiHuX1BnnITWrZs/j/KB6Wh1pBt0FzQqJgJSsOf3l+ALzP1PoZYzej9UzQWAcgWDSCAV1xv7sly9y2z0020GRaKBX31yQRTzSrIcKAZvmdpNMCSqdjlcVYSnkQLNo5i0v6upeG6wo7YKLG5OQnWl0+E= 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+111582+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 1700585515879866.0325661059585; Tue, 21 Nov 2023 08:51:55 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=32j+Nm00DjEarJO8sXqD05OF1Md3c8eO6c/PH1gm2XM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700585515; v=1; b=PH6WnfBtFf6LkHiT8J1uIiT8K/RTMFQv8pWX1tKftnIswXdvj+E7UYqS6LWZh6/Yb2vpZBTM qTCLhHp7fzdxcVHNFH20YDQ3vjCcQPqyr19gAhmHHKF4smHLNCA1mJ9QL+diTD4axTrKk3H37tp /7Igl1aYnfTiZrgkSf/ZQ5kI= X-Received: by 127.0.0.2 with SMTP id wPoaYY1788612xsLukUQLmtc; Tue, 21 Nov 2023 08:51:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.46912.1700585514679307460 for ; Tue, 21 Nov 2023 08:51:54 -0800 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 34F431042; Tue, 21 Nov 2023 08:52:41 -0800 (PST) X-Received: from e126645.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EDC673F6C4; Tue, 21 Nov 2023 08:51:52 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Thomas Abraham Subject: [edk2-devel] [PATCH v3 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 Date: Tue, 21 Nov 2023 17:51:35 +0100 Message-Id: <20231121165135.1547708-4-pierre.gondois@arm.com> In-Reply-To: <20231121165135.1547708-1-pierre.gondois@arm.com> References: <20231121165135.1547708-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 5Pmb6zJgxe3s7paMwckeV6PVx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1700585517460100012 Content-Type: text/plain; charset="utf-8" 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 DynamicTablesScmiInfoLib 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. Change-Id: Ifac3ff21a58c53da41e7444c035cb0e3f73acfad Signed-off-by: Pierre Gondois --- .../ConfigurationManager.c | 233 +++++++++++++++++- .../ConfigurationManager.h | 3 + .../ConfigurationManagerDxe.inf | 1 + 3 files changed, 234 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManager= Dxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/ConfigurationManager.c index 6a4f6e626d3f..283ff92bd027 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,55 @@ 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; + + 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 @@ -1633,6 +1685,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 (( @@ -1788,6 +1853,151 @@ 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. + */ + Status =3D EFI_UNSUPPORTED; + return Status; + } + + CpcInfo =3D &PlatformRepo->CpcInfo[DomainId]; + GicCInfo =3D (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + Status =3D DynamicTablesScmiInfoGetFastChannel ( + 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 600000000) && + (CpcInfo->NominalPerformanceInteger =3D=3D 1000000000)) || + ((DomainId =3D=3D PSD_LITTLE_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger =3D=3D 450000000) && + (CpcInfo->NominalPerformanceInteger =3D=3D 800000000))) { + 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 600; + CpcInfo->NominalFrequencyInteger =3D 1000; + } else { + CpcInfo->LowestFrequencyInteger =3D 450; + CpcInfo->NominalFrequencyInteger =3D 800; + } + + // 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 + + AMU is not supported by the Juno, so clear these registers. + */ + CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId =3D EFI_ACPI= _6_5_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_5_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 @@ -1807,6 +2017,8 @@ ConfigurationManagerDxeInitialize ( ) { EFI_STATUS Status; + UINT32 Index; + BOOLEAN CpcFailed; =20 Status =3D gBS->InstallProtocolInterface ( &ImageHandle, @@ -1821,7 +2033,7 @@ ConfigurationManagerDxeInitialize ( " Status =3D %r\n", Status )); - goto error_handler; + return Status; } =20 Status =3D InitializePlatformRepository ( @@ -1836,6 +2048,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 e58e9cbecb23..fe3edd548faf 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h @@ -303,6 +303,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..53060bf56531 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 + DynamicTablesScmiInfoLib 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 (#111582): https://edk2.groups.io/g/devel/message/111582 Mute This Topic: https://groups.io/mt/102732066/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-