diff options
-rw-r--r-- | src/soc/intel/apollolake/chip.c | 12 | ||||
-rw-r--r-- | src/soc/intel/common/block/power_limit/Kconfig | 6 | ||||
-rw-r--r-- | src/soc/intel/common/block/power_limit/power_limit.c | 17 | ||||
-rw-r--r-- | src/soc/intel/elkhartlake/systemagent.c | 18 |
4 files changed, 32 insertions, 21 deletions
diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c index cb115a0b1b..40316a203d 100644 --- a/src/soc/intel/apollolake/chip.c +++ b/src/soc/intel/apollolake/chip.c @@ -321,14 +321,10 @@ static void soc_init(void *data) */ p2sb_unhide(); - if (CONFIG(SOC_INTEL_DISABLE_POWER_LIMITS)) { - printk(BIOS_INFO, "Skip setting RAPL per configuration\n"); - } else { - config = config_of_soc(); - /* Set RAPL MSR for Package power limits */ - soc_config = &config->power_limits_config; - set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); - } + config = config_of_soc(); + /* Set RAPL MSR for Package power limits */ + soc_config = &config->power_limits_config; + set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); /* * FSP-S routes SCI to IRQ 9. With the help of this function you can diff --git a/src/soc/intel/common/block/power_limit/Kconfig b/src/soc/intel/common/block/power_limit/Kconfig index 5b2b34885f..b6782bc6df 100644 --- a/src/soc/intel/common/block/power_limit/Kconfig +++ b/src/soc/intel/common/block/power_limit/Kconfig @@ -3,3 +3,9 @@ config SOC_INTEL_COMMON_BLOCK_POWER_LIMIT default n help This option allows to configure processor power limit values. + +config SOC_INTEL_RAPL_DISABLE_VIA_MCHBAR + bool + default n + help + Select if disabling Running Average Power Limit (RAPL) has to be done via MCHBAR. diff --git a/src/soc/intel/common/block/power_limit/power_limit.c b/src/soc/intel/common/block/power_limit/power_limit.c index 417dd04672..dce174b38a 100644 --- a/src/soc/intel/common/block/power_limit/power_limit.c +++ b/src/soc/intel/common/block/power_limit/power_limit.c @@ -77,6 +77,23 @@ void set_power_limits(u8 power_limit_1_time, unsigned int power_unit; unsigned int tdp, min_power, max_power, max_time, tdp_pl2, tdp_pl1; u8 power_limit_1_val; + uint32_t value; + + if (CONFIG(SOC_INTEL_DISABLE_POWER_LIMITS)) { + printk(BIOS_INFO, "Disabling RAPL\n"); + if (CONFIG(SOC_INTEL_RAPL_DISABLE_VIA_MCHBAR)) { + value = MCHBAR32(MCH_PKG_POWER_LIMIT_LO); + MCHBAR32(MCH_PKG_POWER_LIMIT_LO) = value & ~(PKG_POWER_LIMIT_EN); + value = MCHBAR32(MCH_PKG_POWER_LIMIT_HI); + MCHBAR32(MCH_PKG_POWER_LIMIT_HI) = value & ~(PKG_POWER_LIMIT_EN); + } else { + msr = rdmsr(MSR_PKG_POWER_LIMIT); + msr.lo &= ~PKG_POWER_LIMIT_EN; + msr.hi &= ~PKG_POWER_LIMIT_EN; + wrmsr(MSR_PKG_POWER_LIMIT, msr); + } + return; + } if (power_limit_1_time >= ARRAY_SIZE(power_limit_time_sec_to_msr)) power_limit_1_time = diff --git a/src/soc/intel/elkhartlake/systemagent.c b/src/soc/intel/elkhartlake/systemagent.c index 85623e8b0f..a9fd26c603 100644 --- a/src/soc/intel/elkhartlake/systemagent.c +++ b/src/soc/intel/elkhartlake/systemagent.c @@ -48,7 +48,6 @@ void soc_systemagent_init(struct device *dev) { struct soc_power_limits_config *soc_config; config_t *config; - uint32_t value; /* Enable Power Aware Interrupt Routing */ enable_power_aware_intr(); @@ -57,16 +56,9 @@ void soc_systemagent_init(struct device *dev) enable_bios_reset_cpl(); mdelay(1); - if (CONFIG(SOC_INTEL_DISABLE_POWER_LIMITS)) { - printk(BIOS_INFO, "Skip setting RAPL per configuration\n"); - /* clear bits 47, 15 in PACKAGE_RAPL_LIMIT_0_0_0_MCHBAR_PCU */ - value = MCHBAR32(MCH_PKG_POWER_LIMIT_LO); - MCHBAR32(MCH_PKG_POWER_LIMIT_LO) = value & ~(PKG_PWR_LIM_1_EN); - value = MCHBAR32(MCH_PKG_POWER_LIMIT_HI); - MCHBAR32(MCH_PKG_POWER_LIMIT_HI) = value & ~(PKG_PWR_LIM_2_EN); - } else { - config = config_of_soc(); - soc_config = &config->power_limits_config; - set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); - } + + config = config_of_soc(); + soc_config = &config->power_limits_config; + set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config); + } |