[PATCH] cpufreq/amd-pstate: Add POWER_SUPPLY dependency for dynamic EPP

Mario Limonciello posted 1 patch 2 months, 2 weeks ago
drivers/cpufreq/Kconfig.x86 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] cpufreq/amd-pstate: Add POWER_SUPPLY dependency for dynamic EPP
Posted by Mario Limonciello 2 months, 2 weeks ago
The dynamic EPP feature uses power_supply_reg_notifier() and
power_supply_unreg_notifier() but doesn't declare a dependency on
POWER_SUPPLY, causing linker errors when POWER_SUPPLY is not enabled.

Add POWER_SUPPLY to the depends line to fix the build issue.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202604040742.ySEdkuAa-lkp@intel.com/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/Kconfig.x86 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index a0dbb9808ae9..53e2702e6f1c 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -71,7 +71,7 @@ config X86_AMD_PSTATE_DEFAULT_MODE
 
 config X86_AMD_PSTATE_DYNAMIC_EPP
 	bool "AMD Processor P-State dynamic EPP support"
-	depends on X86_AMD_PSTATE
+	depends on X86_AMD_PSTATE && POWER_SUPPLY
 	default n
 	help
 	  Allow the kernel to dynamically change the energy performance
-- 
2.43.0
Re: [PATCH] cpufreq/amd-pstate: Add POWER_SUPPLY dependency for dynamic EPP
Posted by K Prateek Nayak 2 months, 2 weeks ago
Hello Mario,

On 4/7/2026 8:24 PM, Mario Limonciello wrote:
>  config X86_AMD_PSTATE_DYNAMIC_EPP
>  	bool "AMD Processor P-State dynamic EPP support"
> -	depends on X86_AMD_PSTATE
> +	depends on X86_AMD_PSTATE && POWER_SUPPLY

This config only controls the default selection right? The offending
power_supply_{reg,unreg}_notifier() isn't guarded behind
#ifdef CONFIG_X86_AMD_PSTATE_DYNAMIC_EPP so we'll still run into this.

I thing X86_AMD_PSTATE doing a "select POWER_SUPPLY" should cure this.
Thoughts?

>  	default n
>  	help
>  	  Allow the kernel to dynamically change the energy performance

-- 
Thanks and Regards,
Prateek
Re: [PATCH] cpufreq/amd-pstate: Add POWER_SUPPLY dependency for dynamic EPP
Posted by Mario Limonciello 2 months, 2 weeks ago

On 4/7/26 12:08, K Prateek Nayak wrote:
> Hello Mario,
> 
> On 4/7/2026 8:24 PM, Mario Limonciello wrote:
>>   config X86_AMD_PSTATE_DYNAMIC_EPP
>>   	bool "AMD Processor P-State dynamic EPP support"
>> -	depends on X86_AMD_PSTATE
>> +	depends on X86_AMD_PSTATE && POWER_SUPPLY
> 
> This config only controls the default selection right? The offending
> power_supply_{reg,unreg}_notifier() isn't guarded behind
> #ifdef CONFIG_X86_AMD_PSTATE_DYNAMIC_EPP so we'll still run into this.
> 
> I thing X86_AMD_PSTATE doing a "select POWER_SUPPLY" should cure this.
> Thoughts?
> 

Oh that's a really good point, thanks.  I'll send another patch as a 
follow up.
Re: [PATCH] cpufreq/amd-pstate: Add POWER_SUPPLY dependency for dynamic EPP
Posted by Rafael J. Wysocki 2 months, 2 weeks ago
On Tue, Apr 7, 2026 at 4:55 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> The dynamic EPP feature uses power_supply_reg_notifier() and
> power_supply_unreg_notifier() but doesn't declare a dependency on
> POWER_SUPPLY, causing linker errors when POWER_SUPPLY is not enabled.
>
> Add POWER_SUPPLY to the depends line to fix the build issue.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202604040742.ySEdkuAa-lkp@intel.com/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/cpufreq/Kconfig.x86 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index a0dbb9808ae9..53e2702e6f1c 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -71,7 +71,7 @@ config X86_AMD_PSTATE_DEFAULT_MODE
>
>  config X86_AMD_PSTATE_DYNAMIC_EPP
>         bool "AMD Processor P-State dynamic EPP support"
> -       depends on X86_AMD_PSTATE
> +       depends on X86_AMD_PSTATE && POWER_SUPPLY
>         default n
>         help
>           Allow the kernel to dynamically change the energy performance
> --

Applied, thanks!