soc/intel/common: Read core scaling factors at runtime support

Starting with Lunar Lake, the scaling factor information is
centralized in the power control unit (PCU) firmware. In order to keep
all firmware in sync, it is recommended to read the scaling factors
from the PCU firmware instead of using hard-coded values.

This commit adds a new Kconfig option,
CONFIG_SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS, to allow
SoC specific code to specify its own function to read the core scaling
factors.

When this option is enabled, the soc_read_core_scaling_factors()
function from the SoC specific code is used to read the core scaling
factors instead of using the statically defined values
CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR and
CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR.

Change-Id: Icdf47e17cc5a6d042f3c5f90cf811fccd6c1ed9b
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85553
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Cliff Huang <cliff.huang@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jeremy Compostella 2024-12-10 17:01:18 -08:00 committed by Jérémy Compostella
commit 1669573edd
3 changed files with 31 additions and 6 deletions

View file

@ -54,6 +54,15 @@ config SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID
help
Defines hybrid CPU specific ACPI helper functions.
config SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS
bool
depends on SOC_INTEL_COMMON_BLOCK_ACPI_CPU_HYBRID
help
Core performance and efficient scaling factors are read at runtime
using the soc_read_core_scaling_factors() function instead of using
statically defined values SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR and
SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR.
config SOC_INTEL_UFS_OCP_TIMER_DISABLE
bool
help

View file

@ -113,18 +113,27 @@ void set_dev_core_type(void)
static void acpi_get_cpu_nomi_perf(u16 *eff_core_nom_perf, u16 *perf_core_nom_perf)
{
u8 max_non_turbo_ratio = cpu_get_max_non_turbo_ratio();
static u16 performance, efficient;
_Static_assert(CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR != 0,
_Static_assert(CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS) ||
CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR must not be zero");
_Static_assert(CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR != 0,
_Static_assert(CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS) ||
CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR != 0,
"CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR must not be zero");
*perf_core_nom_perf = (u16)((max_non_turbo_ratio *
CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR) / 100);
if (!performance) {
if (CONFIG(SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS)) {
soc_read_core_scaling_factors(&performance, &efficient);
} else {
performance = CONFIG_SOC_INTEL_PERFORMANCE_CORE_SCALE_FACTOR;
efficient = CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR;
}
}
*eff_core_nom_perf = (u16)((max_non_turbo_ratio *
CONFIG_SOC_INTEL_EFFICIENT_CORE_SCALE_FACTOR) / 100);
*perf_core_nom_perf = (u16)((max_non_turbo_ratio * performance) / 100);
*eff_core_nom_perf = (u16)((max_non_turbo_ratio * efficient) / 100);
}
static u16 acpi_get_cpu_nominal_freq(void)

View file

@ -20,6 +20,13 @@ enum core_type {
unsigned long acpi_create_madt_lapics_with_nmis_hybrid(unsigned long current);
/*
* Read the performance and efficient core ratios.
* This is to be implemented by the SoC specific code if
* SOC_INTEL_COMMON_BLOCK_RUNTIME_CORE_SCALING_FACTORS is selected.
*/
enum cb_err soc_read_core_scaling_factors(u16 *performance, u16 *efficient);
/* Generates ACPI code to define _CPC control method */
void acpigen_write_CPPC_hybrid_method(int core_id);