From nobody Thu May 16 09:51:27 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+110049+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+110049+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1698233314; cv=none; d=zohomail.com; s=zohoarc; b=RNQ8lpQoH32DtH5t1aCtbD8MWKcW3fAm4tyGAlbD/Z4A1+kVsjNWS+W/CoquR/e3zkQ34Ktf8fwguf/BwSyJ0TIsUSlOhS4X4CWq6QoLHzlxX2SEW7tOcPE4aVIzeSk7kT8Vd48+SBePJwCrXPW8b7KtVd9NadbOCuEQWXxwxZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698233314; 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=ALSJ8Oh5DR4ZU2esT8iRDI2FyTB9nP543499t/iox/4=; b=h42Zto69qMCuo0v6h0RhcuwBKEZsjdgD+MVXjbGGary/8t40CVOIzlA8iJNmvSbDiTNWais49mti+48E89Pmef8ClY1B1i/M4ree8wG20AdsVTW4i3MiAfNJRM+jrHK1QIzkQefKWXnB4t5k8IeoKAfZl5Y7/Y+lx1kMm8N9Z0Q= 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+110049+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 1698233314398746.6906796229445; Wed, 25 Oct 2023 04:28:34 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=0X91EK8JJKCJLamIYhcKKu8hkD4JWsp51LF+4iE4eTs=; 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=1698233314; v=1; b=PKrCJXaG1cyWR2rnny5uyH2saDYnYqkcFN8W1GOstMJ7gCMaWQhWrDgnSTgV+Qau09jI0MB9 lU/u0+GMBJ2wRyBkAb7rL8Zqo09YTXIt5J57Zw0NdeIxkG+wZTasoaXttSdeLo1+RrLH+7NNyH6 eFtMabTm2w3lZC1Hpbud07W4= X-Received: by 127.0.0.2 with SMTP id b1LlYY1788612x0pfnylBjM4; Wed, 25 Oct 2023 04:28:34 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.41147.1698233313472227691 for ; Wed, 25 Oct 2023 04:28:33 -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 AA63BC15; Wed, 25 Oct 2023 04:29:14 -0700 (PDT) X-Received: from cam-smtp0.cambridge.arm.com (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 641AE3F738; Wed, 25 Oct 2023 04:28:32 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Thomas Abraham Subject: [edk2-devel] [PATCH v2 1/3] Platform/ARM: Juno: Fix typo Date: Wed, 25 Oct 2023 13:28:18 +0200 Message-Id: <20231025112820.1655727-2-Pierre.Gondois@arm.com> In-Reply-To: <20231025112820.1655727-1-Pierre.Gondois@arm.com> References: <20231025112820.1655727-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: Yq38NTTLHoe63Xxmw93j6SRBx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698233316254100006 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois 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 (#110049): https://edk2.groups.io/g/devel/message/110049 Mute This Topic: https://groups.io/mt/102175862/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 Thu May 16 09:51:27 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+110050+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+110050+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1698233315; cv=none; d=zohomail.com; s=zohoarc; b=OulAfflWRKUUjcPpzimGItPKmksaz2BX2CRqPkobH5WAY2RH8iO8d+5JhsxGgg1EZcSzUYt2Ojv0mppmmYhUPtQKFpw2Un+FKNMnKWhlBdWpuwSX1WtjljQWphSZJ7Hl9bgCZcW1H0R+CqacANeU2EJLeLBn3+kbosvT6vYL9Dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698233315; 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=TqNsoHvaw/c7ljgMjSva/Uj2514Y5wbciurdhEhH3EI=; b=mO6Jh8dWWb/O8x5TYEPsRDAnG1Sx56w6hzPBwjr7QTiYy1eptVaslVXyCeAy7oH/vtfqdRehwqbo3FiDVoVT3vcuSAjjXSC3nJ1rp7K+AiE6FKVIL4qocn3fNv390p170xlgbtv4//qQ8pRZXE3QXa0H7QZxPO2lhbO8rAH7XDg= 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+110050+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 1698233315648716.5760866023954; Wed, 25 Oct 2023 04:28:35 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=y7jEb5o7kV/P+M+M36xkhy6cuyQR1zMU6oKGiXKKwVw=; 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=1698233315; v=1; b=lPWonkSP43Cx+IvzgvpqutRvGtvK4xBBHhIbq5P0GHRA4XO0uRQ4eUXhrZDcwnq51Rcr8Rrc 5VwbICUWbL7qw8JFBxvy84GGrdYfFmuCfDd9RJN1YSCW9IsFleizzgl6VF1Q4veohCJAhxFNxEV 9PHhJqTLDO0q2pSMJnn0IOT0= X-Received: by 127.0.0.2 with SMTP id gaBxYY1788612xVmGjcgU66B; Wed, 25 Oct 2023 04:28:35 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.170970.1698233314455066089 for ; Wed, 25 Oct 2023 04:28:34 -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 A57EA139F; Wed, 25 Oct 2023 04:29:15 -0700 (PDT) X-Received: from cam-smtp0.cambridge.arm.com (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 688EF3F738; Wed, 25 Oct 2023 04:28:33 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Thomas Abraham Subject: [edk2-devel] [PATCH v2 2/3] Platform/ARM: Juno: Generate _PSD objects Date: Wed, 25 Oct 2023 13:28:19 +0200 Message-Id: <20231025112820.1655727-3-Pierre.Gondois@arm.com> In-Reply-To: <20231025112820.1655727-1-Pierre.Gondois@arm.com> References: <20231025112820.1655727-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: KEyW2E6F0U7C3kDz3MX9YiCPx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698233316285100007 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. Change-Id: I4bb23582d250d43c173a3e6ee86eb6b0349f1b03 Signed-off-by: Pierre Gondois --- .../ConfigurationManager.c | 98 +++++++++++++++++-- .../ConfigurationManager.h | 22 ++++- 2 files changed, 111 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..80e9df246b81 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_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 @@ -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..de7d8f44efec 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,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 (#110050): https://edk2.groups.io/g/devel/message/110050 Mute This Topic: https://groups.io/mt/102175863/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 Thu May 16 09:51:27 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+110051+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+110051+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1698233316; cv=none; d=zohomail.com; s=zohoarc; b=BLAgwStvjTNvfoJzLe6IxjFMKLHuOHWvDQz43DwpaWRYpH91onWlneq0eANiRx/iuN5fqiFgs+Shzq6weHP4+R4cJ2aVGGWlesR/WanMJlm16nH909ZSfy3ev3xfrHzC2DDrxjWfA4HR/IdVJCiT0EVuHaRClebWAFwoGv/ISfQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698233316; 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=dIfriRzLOzp7t3ftg2EPc8kkozqEN7CktMbEEoXKcqg=; b=NpW2YkJhsOhSWoBxofKSrRI3oQHU74yPdDHYUgDVrCxMrSWdQwk4vCNEoFl48BEWGsWwyWDyS5WWGPyi5SYLrC/8YrzkIY9Uin53iDdTMdu36MxGLvMuUokj1mZ9rL8rGdbBCTvDBipy8hktlRnEcPhfmKsqV9oLeYHdHHV3lgw= 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+110051+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 169823331643649.19225123365743; Wed, 25 Oct 2023 04:28:36 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=8ROe4zTawpQ0meEq+NZ9vGb6DWbxch6Ub2NQpsEO/Vo=; 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=1698233316; v=1; b=eNWkwGWCg4OjcGnfeyW9NCMOzH0deXcwmhtjhA2DBvJcUx3zVXWdMYeqvRV9U/PV7zKUQsO9 8fdiHLJuR6s3KFEpzwJzmfYG2RLEWEFkIrWFo29DdD1L18shlMEwBifX29QqI0M/FrQH+a98vHm NRpQOXc2QPCmodt8ChiHCn1w= X-Received: by 127.0.0.2 with SMTP id M2kzYY1788612xPZmV8gbwWw; Wed, 25 Oct 2023 04:28:36 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.170972.1698233315491015369 for ; Wed, 25 Oct 2023 04:28:35 -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 A04E32F4; Wed, 25 Oct 2023 04:29:16 -0700 (PDT) X-Received: from cam-smtp0.cambridge.arm.com (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 630633F738; Wed, 25 Oct 2023 04:28:34 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Thomas Abraham Subject: [edk2-devel] [PATCH v2 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 Date: Wed, 25 Oct 2023 13:28:20 +0200 Message-Id: <20231025112820.1655727-4-Pierre.Gondois@arm.com> In-Reply-To: <20231025112820.1655727-1-Pierre.Gondois@arm.com> References: <20231025112820.1655727-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: DIxehbU66mDUiMnszNexfCpcx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698233318159100015 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. 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 80e9df246b81..9c38d0815cb7 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 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 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_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 @@ -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 de7d8f44efec..873b11e74ca5 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/Con= figurationManager.h @@ -301,6 +301,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 (#110051): https://edk2.groups.io/g/devel/message/110051 Mute This Topic: https://groups.io/mt/102175864/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-