* [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 @ 2024-01-29 12:08 PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 1/3] Platform/ARM: Juno: Fix typo PierreGondois ` (3 more replies) 0 siblings, 4 replies; 6+ messages in thread From: PierreGondois @ 2024-01-29 12:08 UTC (permalink / raw) To: devel; +Cc: Sami Mujawar, Thomas Abraham, Pierre Gondois From: Pierre Gondois <pierre.gondois@arm.com> v1: - https://edk2.groups.io/g/devel/message/104127 v2: - https://edk2.groups.io/g/devel/message/110048 - Rebase patches on latest version. - Correct frequency values which were advertised in KHz when CPPC spec require them to be in MHz. v3: - https://edk2.groups.io/g/devel/message/111579 - Rebase on latest master - Use ACPI 6.5 definitions instead of 6.4 previously - Renamed ArmScmiInfoLib to DynamicTablesScmiInfoLib v4: - https://edk2.groups.io/g/devel/message/112378 - Removed Change-id left in commit messages. v5: [PATCH v4 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 - Removed unnecessary _CPC initialization - Moved PopulateCpcInfo() to InitializePlatformRepository() - Moved Juno revision check to InitializePlatformRepository() Added new patch - 'Platform/ARM: Juno: Use PcdDevelopmentPlatformRelaxations for _CPC' v6: -Merged patches into one patch: - 'Platform/ARM: Juno: Use PcdDevelopmentPlatformRelaxations for _CPC' - 'Platform/ARM: Juno: Generate _CPC objects for JunoR2' - Return correct error code in GetCpcInfo()/GetpsdInfo() - Make PopulateCpcObjects() use an input parameter: PlatformRepo - Add ENABLE_CPC build parameter to enable CPC generation via command line. A recent patchset [1] allows the generation of _PSD/_CPC ACPI objects by querying the relevant information through the SCMI protocol. - The _PSD object describes to which performance domain a CPU belongs. CPUs in the same performance domain have the same frequency. - The _CPC object describes an interface to control the performance level of a CPU (i.e. its frequency). Demonstrate the _PSD/_CPC generation functionality on Juno-r2 platforms. In order to work, the SCP must describe performance levels on a unified scale (i.e. not as frequencies). The following performance level values where used for testing: - little CPUs OPPs: [181, 322, 383] * 1000 - big CPUs OPPs: [512, 833, 1024] * 1024 The SCP should also: - have fast channel enabled - set the `approximate_level` feature to allow performance level requests in between OPP leveles. [1] https://edk2.groups.io/g/devel/message/114410 Pierre Gondois (3): Platform/ARM: Juno: Fix typo Platform/ARM: Juno: Generate _PSD objects Platform/ARM: Juno: Generate _CPC objects for JunoR2 Platform/ARM/JunoPkg/ArmJuno.dsc | 11 + .../ConfigurationManager.c | 352 +++++++++++++++++- .../ConfigurationManager.h | 31 +- .../ConfigurationManagerDxe.inf | 3 + 4 files changed, 384 insertions(+), 13 deletions(-) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114690): https://edk2.groups.io/g/devel/message/114690 Mute This Topic: https://groups.io/mt/104029700/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 6+ messages in thread
* [edk2-devel] [PATCH v6 1/3] Platform/ARM: Juno: Fix typo 2024-01-29 12:08 [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois @ 2024-01-29 12:08 ` PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 2/3] Platform/ARM: Juno: Generate _PSD objects PierreGondois ` (2 subsequent siblings) 3 siblings, 0 replies; 6+ messages in thread From: PierreGondois @ 2024-01-29 12:08 UTC (permalink / raw) To: devel; +Cc: Sami Mujawar, Thomas Abraham, Pierre Gondois From: Pierre Gondois <pierre.gondois@arm.com> Fix a typo. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> --- .../ConfigurationManagerDxe/ConfigurationManager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c index 91f035480dcf..2fdb15cc4caf 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c @@ -993,7 +993,7 @@ GetGicCInfo ( return EFI_NOT_FOUND; } -/** Return Lpi State Infor. +/** Return Lpi State Info. @param [in] This Pointer to the Configuration Manager Protocol. @param [in] CmObjectId The Object ID of the CM object requested -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114691): https://edk2.groups.io/g/devel/message/114691 Mute This Topic: https://groups.io/mt/104029701/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [edk2-devel] [PATCH v6 2/3] Platform/ARM: Juno: Generate _PSD objects 2024-01-29 12:08 [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 1/3] Platform/ARM: Juno: Fix typo PierreGondois @ 2024-01-29 12:08 ` PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 PierreGondois 2024-01-30 14:30 ` [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 Sami Mujawar 3 siblings, 0 replies; 6+ messages in thread From: PierreGondois @ 2024-01-29 12:08 UTC (permalink / raw) To: devel; +Cc: Sami Mujawar, Thomas Abraham, Pierre Gondois From: Pierre Gondois <pierre.gondois@arm.com> The SsdtCpuTopologyGenerator can generate _PSD objects. Add _PSD information and handling to the Configuration Manager to generate them. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> --- .../ConfigurationManager.c | 98 +++++++++++++++++-- .../ConfigurationManager.h | 24 ++++- 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c index 2fdb15cc4caf..efc4c0ddf87c 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c @@ -129,12 +129,12 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = { GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency) */ { - 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[PSD_BIG_DOMAIN_ID])), + GICC_ENTRY (1, GET_MPID (0, 1), 38, 25, 1, REFERENCE_TOKEN (PsdInfo[PSD_BIG_DOMAIN_ID])), + GICC_ENTRY (2, GET_MPID (1, 0), 50, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])), + GICC_ENTRY (3, GET_MPID (1, 1), 54, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])), + GICC_ENTRY (4, GET_MPID (1, 2), 58, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])), + GICC_ENTRY (5, GET_MPID (1, 3), 62, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])), }, // GIC Distributor Info @@ -733,7 +733,29 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = { { { REFERENCE_TOKEN (LpiInfo[1]) }, { REFERENCE_TOKEN (LpiInfo[2]) }, - } + }, + { // Power domains + { // 0: big cores + // Revision + EFI_ACPI_6_5_AML_PSD_REVISION, + // Domain + PSD_BIG_DOMAIN_ID, + // CoordType + ACPI_AML_COORD_TYPE_SW_ANY, + // NumProc + 2, + }, + { // 1: little cores + // Revision + EFI_ACPI_6_5_AML_PSD_REVISION, + // Domain + PSD_LITTLE_DOMAIN_ID, + // CoordType + ACPI_AML_COORD_TYPE_SW_ANY, + // NumProc + 4, + }, + }, }; /** A helper function for returning the Configuration Manager Objects. @@ -1141,6 +1163,55 @@ GetPciInterruptMapInfo ( return EFI_NOT_FOUND; } +/** Return Psd Info. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Object ID of the CM object requested + @param [in] SearchToken A unique token for identifying the requested + CM_ARM_PCI_INTERRUPT_MAP_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not found. +**/ +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 == NULL) || (CmObject == NULL)) { + ASSERT (This != NULL); + ASSERT (CmObject != NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo = This->PlatRepoInfo; + + TotalObjCount = ARRAY_SIZE (PlatformRepo->PsdInfo); + + for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->PsdInfo[ObjIndex]) { + CmObject->ObjectId = CmObjectId; + CmObject->Size = sizeof (PlatformRepo->PsdInfo[ObjIndex]); + CmObject->Data = (VOID*)&PlatformRepo->PsdInfo[ObjIndex]; + CmObject->Count = 1; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Return a list of Configuration Manager object references pointed to by the given input token. @@ -1549,6 +1620,19 @@ GetArmNameSpaceObject ( ); break; + case EArmObjPsdInfo: + Status = HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->PsdInfo, + sizeof (PlatformRepo->PsdInfo), + ARRAY_SIZE (PlatformRepo->PsdInfo), + Token, + GetPsdInfo, + CmObject + ); + break; + default: { Status = EFI_NOT_FOUND; DEBUG (( diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h index 5b5e62427f2b..e58e9cbecb23 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.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 */ \ } /** 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) +/** 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]; + // Power domains + CM_ARM_PSD_INFO PsdInfo[PSD_DOMAIN_COUNT]; + /// Juno Board Revision UINT32 JunoRevision; } EDKII_PLATFORM_REPOSITORY_INFO; -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114692): https://edk2.groups.io/g/devel/message/114692 Mute This Topic: https://groups.io/mt/104029702/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 2024-01-29 12:08 [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 1/3] Platform/ARM: Juno: Fix typo PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 2/3] Platform/ARM: Juno: Generate _PSD objects PierreGondois @ 2024-01-29 12:08 ` PierreGondois 2024-01-29 14:54 ` Sami Mujawar 2024-01-30 14:30 ` [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 Sami Mujawar 3 siblings, 1 reply; 6+ messages in thread From: PierreGondois @ 2024-01-29 12:08 UTC (permalink / raw) To: devel; +Cc: Sami Mujawar, Thomas Abraham, Pierre Gondois From: Pierre Gondois <pierre.gondois@arm.com> 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. Perf level values used for testing: - little CPUs OPPs: [181, 322, 383] * 1000 - big CPUs OPPs: [512, 833, 1024] * 1000 Also make use of the newly added PcdDevelopmentPlatformRelaxations and add a new ENABLE_CPC build parameter ('-D ENABLE_CPC') to enable CPC generation. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> --- Platform/ARM/JunoPkg/ArmJuno.dsc | 11 + .../ConfigurationManager.c | 252 +++++++++++++++++- .../ConfigurationManager.h | 7 + .../ConfigurationManagerDxe.inf | 3 + 4 files changed, 270 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 1ea0aba2655f..7fe796a53433 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -83,6 +83,9 @@ [BuildOptions] !ifdef DYNAMIC_TABLES_FRAMEWORK *_*_*_PLATFORM_FLAGS = -DDYNAMIC_TABLES_FRAMEWORK !endif +!ifdef ENABLE_CPC + *_*_*_PLATFORM_FLAGS = -DENABLE_CPC +!endif ################################################################################ # @@ -203,6 +206,14 @@ [PcdsFixedAtBuild.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20 +!ifdef ENABLE_CPC + # + # Allow some relaxation on some specific points for the platforms that desire it. + # BIT0: Allow the absence of some registers in the _CPC object. + # + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations|0x1 +!endif + [PcdsPatchableInModule] # Console Resolution (Full HD) gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1920 diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c index efc4c0ddf87c..636645ed2821 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c @@ -14,6 +14,7 @@ #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h> #include <IndustryStandard/SerialPortConsoleRedirectionTable.h> #include <Library/ArmLib.h> +#include <Library/DynamicTablesScmiInfoLib.h> #include <Library/DebugLib.h> #include <Library/IoLib.h> #include <Library/PcdLib.h> @@ -901,6 +902,173 @@ HandleCmObjectSearchPlatformRepo ( return Status; } +/** 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 = (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + GicCInfo[0].CpcToken = CM_NULL_TOKEN; + GicCInfo[1].CpcToken = CM_NULL_TOKEN; + GicCInfo[2].CpcToken = CM_NULL_TOKEN; + GicCInfo[3].CpcToken = CM_NULL_TOKEN; + GicCInfo[4].CpcToken = CM_NULL_TOKEN; + GicCInfo[5].CpcToken = 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 == NULL) || + ((DomainId != PSD_BIG_DOMAIN_ID) && + (DomainId != PSD_LITTLE_DOMAIN_ID))) { + Status = EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + CpcInfo = &PlatformRepo->CpcInfo[DomainId]; + GicCInfo = (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + Status = 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 advertised + to the OS via the _CPC objects. SCP currently maps performance requests + 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 advertised + lowest/nominal frequencies are not the default ones. + */ + if (((DomainId == PSD_BIG_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger == 600000000) && + (CpcInfo->NominalPerformanceInteger == 1000000000)) || + ((DomainId == PSD_LITTLE_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger == 450000000) && + (CpcInfo->NominalPerformanceInteger == 800000000))) { + return EFI_UNSUPPORTED; + } + + // Juno R2's lowest/nominal frequencies. + // Nominal frequency != Highest frequency. + if (DomainId == PSD_BIG_DOMAIN_ID) { + CpcInfo->LowestFrequencyInteger = 600; + CpcInfo->NominalFrequencyInteger = 1000; + } else { + CpcInfo->LowestFrequencyInteger = 450; + CpcInfo->NominalFrequencyInteger = 800; + } + + // The mapping Psd -> CPUs is available here. + if (DomainId == PSD_BIG_DOMAIN_ID) { + GicCInfo[0].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[1].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + } else { + GicCInfo[2].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[3].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[4].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[5].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + } + + /* + Arm advises to use FFH to the following registers which uses AMU counters: + - ReferencePerformanceCounterRegister + - DeliveredPerformanceCounterRegister + Cf. Arm Functional Fixed Hardware Specification + s3.2 Performance management and Collaborative Processor Performance Control + + AMU is not supported by the Juno, so clear these registers. + */ + CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitWidth = 0; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitOffset = 0; + CpcInfo->ReferencePerformanceCounterRegister.AccessSize = 0; + CpcInfo->ReferencePerformanceCounterRegister.Address = 0; + + CpcInfo->DeliveredPerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitWidth = 0; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitOffset = 0; + CpcInfo->DeliveredPerformanceCounterRegister.AccessSize = 0; + CpcInfo->DeliveredPerformanceCounterRegister.Address = 0; + + return Status; +} + +/** Iterate over the PSD Domains and try to populate the Cpc objects. +**/ +STATIC +VOID +EFIAPI +PopulateCpcObjects ( + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo + ) +{ + EFI_STATUS Status; + UINT32 Index; + BOOLEAN CpcFailed; + + CpcFailed = FALSE; + for (Index = 0; Index < PSD_DOMAIN_COUNT; Index++) { + Status = PopulateCpcInfo (PlatformRepo, Index); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "WARN: Could not populate _CPC.\n")); + CpcFailed = TRUE; + break; + } + } + + if (CpcFailed) { + // _CPC information is not mandatory and SCP might not support some + // SCMI requests. Failing should not prevent from booting. + ClearCpcInfo (PlatformRepo); + } +} + /** Initialize the platform configuration repository. @param [in] This Pointer to the Configuration Manager Protocol. @@ -920,6 +1088,23 @@ InitializePlatformRepository ( GetJunoRevision (PlatformRepo->JunoRevision); DEBUG ((DEBUG_INFO, "Juno Rev = 0x%x\n", PlatformRepo->JunoRevision)); + + /// + /// 1. + /// _CPC was only tested on Juno R2, so only enable support for this version. + /// + /// 2. + /// Some _CPC registers cannot be populated for the Juno: + /// - PerformanceLimitedRegister + /// - ReferencePerformanceCounterRegister + /// - DeliveredPerformanceCounterRegister + /// Only build _CPC objects if relaxation regarding these registers + /// is allowed. + if ((PlatformRepo->JunoRevision == JUNO_REVISION_R2) && + (PcdGet64(PcdDevelopmentPlatformRelaxations) & BIT0)) { + PopulateCpcObjects (PlatformRepo); + } + return EFI_SUCCESS; } @@ -1212,6 +1397,55 @@ GetPsdInfo ( return EFI_NOT_FOUND; } +/** Return Cpc Info. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Object ID of the CM object requested + @param [in] SearchToken A unique token for identifying the requested + CM_ARM_PCI_INTERRUPT_MAP_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not found. +**/ +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 == NULL) || (CmObject == NULL)) { + ASSERT (This != NULL); + ASSERT (CmObject != NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo = This->PlatRepoInfo; + + TotalObjCount = ARRAY_SIZE (PlatformRepo->CpcInfo); + + for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->CpcInfo[ObjIndex]) { + CmObject->ObjectId = CmObjectId; + CmObject->Size = sizeof (PlatformRepo->CpcInfo[ObjIndex]); + CmObject->Data = (VOID*)&PlatformRepo->CpcInfo[ObjIndex]; + CmObject->Count = 1; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Return a list of Configuration Manager object references pointed to by the given input token. @@ -1633,6 +1867,19 @@ GetArmNameSpaceObject ( ); break; + case EArmObjCpcInfo: + Status = HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->CpcInfo, + sizeof (PlatformRepo->CpcInfo), + ARRAY_SIZE (PlatformRepo->CpcInfo), + Token, + GetCpcInfo, + CmObject + ); + break; + default: { Status = EFI_NOT_FOUND; DEBUG (( @@ -1821,7 +2068,7 @@ ConfigurationManagerDxeInitialize ( " Status = %r\n", Status )); - goto error_handler; + return Status; } Status = InitializePlatformRepository ( @@ -1836,6 +2083,5 @@ ConfigurationManagerDxeInitialize ( )); } -error_handler: - return Status; + return EFI_SUCCESS; } diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h index e58e9cbecb23..78452295a180 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h @@ -303,6 +303,13 @@ typedef struct PlatformRepositoryInfo { // Power domains CM_ARM_PSD_INFO PsdInfo[PSD_DOMAIN_COUNT]; + // + // Dynamically populated fields from here. + // + + // 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/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf index 91bffe8d5d82..dea475375688 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf @@ -35,6 +35,7 @@ [Packages] [LibraryClasses] ArmPlatformLib + DynamicTablesScmiInfoLib PrintLib UefiBootServicesTableLib UefiDriverEntryPoint @@ -76,6 +77,8 @@ [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations + [Pcd] [Depex] -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114693): https://edk2.groups.io/g/devel/message/114693 Mute This Topic: https://groups.io/mt/104029703/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 PierreGondois @ 2024-01-29 14:54 ` Sami Mujawar 0 siblings, 0 replies; 6+ messages in thread From: Sami Mujawar @ 2024-01-29 14:54 UTC (permalink / raw) To: Pierre Gondois, devel@edk2.groups.io; +Cc: Thomas Abraham, nd Hi Pierre, Thank you for this patch. I have some minor suggestions, that I will fix before merging. With that, Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Regards, Sami Mujawar On 29/01/2024, 12:08, "Pierre.Gondois@arm.com <mailto:Pierre.Gondois@arm.com>" <Pierre.Gondois@arm.com <mailto:Pierre.Gondois@arm.com>> wrote: From: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> 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. Perf level values used for testing: - little CPUs OPPs: [181, 322, 383] * 1000 - big CPUs OPPs: [512, 833, 1024] * 1000 Also make use of the newly added PcdDevelopmentPlatformRelaxations and add a new ENABLE_CPC build parameter ('-D ENABLE_CPC') to enable CPC generation. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> --- Platform/ARM/JunoPkg/ArmJuno.dsc | 11 + .../ConfigurationManager.c | 252 +++++++++++++++++- .../ConfigurationManager.h | 7 + .../ConfigurationManagerDxe.inf | 3 + 4 files changed, 270 insertions(+), 3 deletions(-) diff --git a/Platform/ARM/JunoPkg/ArmJuno.dsc b/Platform/ARM/JunoPkg/ArmJuno.dsc index 1ea0aba2655f..7fe796a53433 100644 --- a/Platform/ARM/JunoPkg/ArmJuno.dsc +++ b/Platform/ARM/JunoPkg/ArmJuno.dsc @@ -83,6 +83,9 @@ [BuildOptions] !ifdef DYNAMIC_TABLES_FRAMEWORK *_*_*_PLATFORM_FLAGS = -DDYNAMIC_TABLES_FRAMEWORK !endif +!ifdef ENABLE_CPC + *_*_*_PLATFORM_FLAGS = -DENABLE_CPC +!endif ################################################################################ # @@ -203,6 +206,14 @@ [PcdsFixedAtBuild.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20 +!ifdef ENABLE_CPC + # + # Allow some relaxation on some specific points for the platforms that desire it. + # BIT0: Allow the absence of some registers in the _CPC object. + # + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations|0x1 +!endif + [PcdsPatchableInModule] # Console Resolution (Full HD) gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1920 diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c index efc4c0ddf87c..636645ed2821 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c @@ -14,6 +14,7 @@ #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h> #include <IndustryStandard/SerialPortConsoleRedirectionTable.h> #include <Library/ArmLib.h> +#include <Library/DynamicTablesScmiInfoLib.h> #include <Library/DebugLib.h> #include <Library/IoLib.h> #include <Library/PcdLib.h> @@ -901,6 +902,173 @@ HandleCmObjectSearchPlatformRepo ( return Status; } +/** 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 = (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + GicCInfo[0].CpcToken = CM_NULL_TOKEN; + GicCInfo[1].CpcToken = CM_NULL_TOKEN; + GicCInfo[2].CpcToken = CM_NULL_TOKEN; + GicCInfo[3].CpcToken = CM_NULL_TOKEN; + GicCInfo[4].CpcToken = CM_NULL_TOKEN; + GicCInfo[5].CpcToken = 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 == NULL) || + ((DomainId != PSD_BIG_DOMAIN_ID) && + (DomainId != PSD_LITTLE_DOMAIN_ID))) { + Status = EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + CpcInfo = &PlatformRepo->CpcInfo[DomainId]; + GicCInfo = (CM_ARM_GICC_INFO*)&PlatformRepo->GicCInfo; + + Status = 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 advertised + to the OS via the _CPC objects. SCP currently maps performance requests + 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 advertised + lowest/nominal frequencies are not the default ones. + */ + if (((DomainId == PSD_BIG_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger == 600000000) && + (CpcInfo->NominalPerformanceInteger == 1000000000)) || + ((DomainId == PSD_LITTLE_DOMAIN_ID) && + (CpcInfo->LowestPerformanceInteger == 450000000) && + (CpcInfo->NominalPerformanceInteger == 800000000))) { + return EFI_UNSUPPORTED; + } + + // Juno R2's lowest/nominal frequencies. + // Nominal frequency != Highest frequency. + if (DomainId == PSD_BIG_DOMAIN_ID) { + CpcInfo->LowestFrequencyInteger = 600; + CpcInfo->NominalFrequencyInteger = 1000; + } else { + CpcInfo->LowestFrequencyInteger = 450; + CpcInfo->NominalFrequencyInteger = 800; + } + + // The mapping Psd -> CPUs is available here. + if (DomainId == PSD_BIG_DOMAIN_ID) { + GicCInfo[0].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[1].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + } else { + GicCInfo[2].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[3].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[4].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + GicCInfo[5].CpcToken = (CM_OBJECT_TOKEN)CpcInfo; + } + + /* + Arm advises to use FFH to the following registers which uses AMU counters: + - ReferencePerformanceCounterRegister + - DeliveredPerformanceCounterRegister + Cf. Arm Functional Fixed Hardware Specification + s3.2 Performance management and Collaborative Processor Performance Control + + AMU is not supported by the Juno, so clear these registers. + */ + CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitWidth = 0; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitOffset = 0; + CpcInfo->ReferencePerformanceCounterRegister.AccessSize = 0; + CpcInfo->ReferencePerformanceCounterRegister.Address = 0; + + CpcInfo->DeliveredPerformanceCounterRegister.AddressSpaceId = EFI_ACPI_6_5_SYSTEM_MEMORY; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitWidth = 0; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitOffset = 0; + CpcInfo->DeliveredPerformanceCounterRegister.AccessSize = 0; + CpcInfo->DeliveredPerformanceCounterRegister.Address = 0; + + return Status; +} + +/** Iterate over the PSD Domains and try to populate the Cpc objects. [SAMI] Documentation for parameters is missing. I will add that before merging. +**/ +STATIC +VOID +EFIAPI +PopulateCpcObjects ( + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo + ) +{ + EFI_STATUS Status; + UINT32 Index; + BOOLEAN CpcFailed; + + CpcFailed = FALSE; + for (Index = 0; Index < PSD_DOMAIN_COUNT; Index++) { + Status = PopulateCpcInfo (PlatformRepo, Index); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "WARN: Could not populate _CPC.\n")); + CpcFailed = TRUE; + break; + } + } + + if (CpcFailed) { + // _CPC information is not mandatory and SCP might not support some + // SCMI requests. Failing should not prevent from booting. + ClearCpcInfo (PlatformRepo); + } +} + /** Initialize the platform configuration repository. @param [in] This Pointer to the Configuration Manager Protocol. @@ -920,6 +1088,23 @@ InitializePlatformRepository ( GetJunoRevision (PlatformRepo->JunoRevision); DEBUG ((DEBUG_INFO, "Juno Rev = 0x%x\n", PlatformRepo->JunoRevision)); + + /// + /// 1. + /// _CPC was only tested on Juno R2, so only enable support for this version. + /// + /// 2. + /// Some _CPC registers cannot be populated for the Juno: + /// - PerformanceLimitedRegister + /// - ReferencePerformanceCounterRegister + /// - DeliveredPerformanceCounterRegister + /// Only build _CPC objects if relaxation regarding these registers + /// is allowed. + if ((PlatformRepo->JunoRevision == JUNO_REVISION_R2) && + (PcdGet64(PcdDevelopmentPlatformRelaxations) & BIT0)) { + PopulateCpcObjects (PlatformRepo); + } + return EFI_SUCCESS; } @@ -1212,6 +1397,55 @@ GetPsdInfo ( return EFI_NOT_FOUND; } +/** Return Cpc Info. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Object ID of the CM object requested + @param [in] SearchToken A unique token for identifying the requested + CM_ARM_PCI_INTERRUPT_MAP_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not found. +**/ +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 == NULL) || (CmObject == NULL)) { + ASSERT (This != NULL); + ASSERT (CmObject != NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo = This->PlatRepoInfo; + + TotalObjCount = ARRAY_SIZE (PlatformRepo->CpcInfo); + + for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->CpcInfo[ObjIndex]) { + CmObject->ObjectId = CmObjectId; + CmObject->Size = sizeof (PlatformRepo->CpcInfo[ObjIndex]); + CmObject->Data = (VOID*)&PlatformRepo->CpcInfo[ObjIndex]; + CmObject->Count = 1; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Return a list of Configuration Manager object references pointed to by the given input token. @@ -1633,6 +1867,19 @@ GetArmNameSpaceObject ( ); break; + case EArmObjCpcInfo: + Status = HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->CpcInfo, + sizeof (PlatformRepo->CpcInfo), + ARRAY_SIZE (PlatformRepo->CpcInfo), + Token, + GetCpcInfo, + CmObject + ); + break; + default: { Status = EFI_NOT_FOUND; DEBUG (( @@ -1821,7 +2068,7 @@ ConfigurationManagerDxeInitialize ( " Status = %r\n", Status )); - goto error_handler; + return Status; [SAMI] This change not related to this patch. I will drop this before merging. } Status = InitializePlatformRepository ( @@ -1836,6 +2083,5 @@ ConfigurationManagerDxeInitialize ( )); } -error_handler: - return Status; + return EFI_SUCCESS; [SAMI] This change not related to this patch. Also, we should be returning the proper error code instead of EFI_SUCESS. I will drop this before merging. } diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h index e58e9cbecb23..78452295a180 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h @@ -303,6 +303,13 @@ typedef struct PlatformRepositoryInfo { // Power domains CM_ARM_PSD_INFO PsdInfo[PSD_DOMAIN_COUNT]; + // + // Dynamically populated fields from here. + // + + // 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/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf index 91bffe8d5d82..dea475375688 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf @@ -35,6 +35,7 @@ [Packages] [LibraryClasses] ArmPlatformLib + DynamicTablesScmiInfoLib PrintLib UefiBootServicesTableLib UefiDriverEntryPoint @@ -76,6 +77,8 @@ [FixedPcd] gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations + [Pcd] [Depex] -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114709): https://edk2.groups.io/g/devel/message/114709 Mute This Topic: https://groups.io/mt/104029703/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 2024-01-29 12:08 [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois ` (2 preceding siblings ...) 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 PierreGondois @ 2024-01-30 14:30 ` Sami Mujawar 3 siblings, 0 replies; 6+ messages in thread From: Sami Mujawar @ 2024-01-30 14:30 UTC (permalink / raw) To: Pierre Gondois, devel@edk2.groups.io; +Cc: Thomas Abraham, nd Merged as 14b8c793e685..d9070fb98d5d Thanks. Regards, Sami Mujawar On 29/01/2024, 12:08, "Pierre.Gondois@arm.com <mailto:Pierre.Gondois@arm.com>" <Pierre.Gondois@arm.com <mailto:Pierre.Gondois@arm.com>> wrote: From: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> v1: - https://edk2.groups.io/g/devel/message/104127 <https://edk2.groups.io/g/devel/message/104127> v2: - https://edk2.groups.io/g/devel/message/110048 <https://edk2.groups.io/g/devel/message/110048> - Rebase patches on latest version. - Correct frequency values which were advertised in KHz when CPPC spec require them to be in MHz. v3: - https://edk2.groups.io/g/devel/message/111579 <https://edk2.groups.io/g/devel/message/111579> - Rebase on latest master - Use ACPI 6.5 definitions instead of 6.4 previously - Renamed ArmScmiInfoLib to DynamicTablesScmiInfoLib v4: - https://edk2.groups.io/g/devel/message/112378 <https://edk2.groups.io/g/devel/message/112378> - Removed Change-id left in commit messages. v5: [PATCH v4 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 - Removed unnecessary _CPC initialization - Moved PopulateCpcInfo() to InitializePlatformRepository() - Moved Juno revision check to InitializePlatformRepository() Added new patch - 'Platform/ARM: Juno: Use PcdDevelopmentPlatformRelaxations for _CPC' v6: -Merged patches into one patch: - 'Platform/ARM: Juno: Use PcdDevelopmentPlatformRelaxations for _CPC' - 'Platform/ARM: Juno: Generate _CPC objects for JunoR2' - Return correct error code in GetCpcInfo()/GetpsdInfo() - Make PopulateCpcObjects() use an input parameter: PlatformRepo - Add ENABLE_CPC build parameter to enable CPC generation via command line. A recent patchset [1] allows the generation of _PSD/_CPC ACPI objects by querying the relevant information through the SCMI protocol. - The _PSD object describes to which performance domain a CPU belongs. CPUs in the same performance domain have the same frequency. - The _CPC object describes an interface to control the performance level of a CPU (i.e. its frequency). Demonstrate the _PSD/_CPC generation functionality on Juno-r2 platforms. In order to work, the SCP must describe performance levels on a unified scale (i.e. not as frequencies). The following performance level values where used for testing: - little CPUs OPPs: [181, 322, 383] * 1000 - big CPUs OPPs: [512, 833, 1024] * 1024 The SCP should also: - have fast channel enabled - set the `approximate_level` feature to allow performance level requests in between OPP leveles. [1] https://edk2.groups.io/g/devel/message/114410 <https://edk2.groups.io/g/devel/message/114410> Pierre Gondois (3): Platform/ARM: Juno: Fix typo Platform/ARM: Juno: Generate _PSD objects Platform/ARM: Juno: Generate _CPC objects for JunoR2 Platform/ARM/JunoPkg/ArmJuno.dsc | 11 + .../ConfigurationManager.c | 352 +++++++++++++++++- .../ConfigurationManager.h | 31 +- .../ConfigurationManagerDxe.inf | 3 + 4 files changed, 384 insertions(+), 13 deletions(-) -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114788): https://edk2.groups.io/g/devel/message/114788 Mute This Topic: https://groups.io/mt/104029700/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-30 14:30 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-29 12:08 [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 1/3] Platform/ARM: Juno: Fix typo PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 2/3] Platform/ARM: Juno: Generate _PSD objects PierreGondois 2024-01-29 12:08 ` [edk2-devel] [PATCH v6 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 PierreGondois 2024-01-29 14:54 ` Sami Mujawar 2024-01-30 14:30 ` [edk2-devel] [PATCH v6 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 Sami Mujawar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox