cpufreq: CPPC: Set CPPC Enable register in cpu_init
Subsystems (4)
Sumit Gupta
reviewerPATCH 1/1 cpufreq: CPPC: Set CPPC Enable register in cpu_init
As per ACPI 6.x s8.4.6.1.4 (CPPC Enable register):
"If supported by the platform, OSPM writes a one to this register
to enable CPPC on this processor. If not implemented, OSPM assumes the platform always has CPPC enabled."
The driver never writes this register. Call cppc_set_enable() at the start of cppc_cpufreq_cpu_init(). Errors are logged but not fatal, as the register is optional.
---
Sending this separately from the autonomous mode boot parameter series where it was patch 1/2, as it is an independent bug fix.
v5 of the series:
https://lore.kernel.org/lkml/[email protected]/
drivers/cpufreq/cppc_cpufreq.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/cpufreq/cppc_cpufreq.c +8 -0
@@ -679,6 +679,14 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) caps = &cpu_data->perf_caps; policy->driver_data = cpu_data; +/* +* Enable CPPC. The Enable register is optional - some platforms +* may not support it. +*/ + ret =cppc_set_enable (cpu, true); +if (ret && ret != -EOPNOTSUPP ) +pr_warn ("Failed to enable CPPC for CPU%u (%d)\n" , cpu, ret); +/* * Set min to lowest nonlinear perf to avoid any efficiency penalty (see * Section 8.4.7.1.1.5 of ACPI 6.1 spec)
Signature · 1 line
2.34.1
Christian Loehle
reviewerQuoted 5 lines · Sumit Gupta
As per ACPI 6.x s8.4.6.1.4 (CPPC Enable register):
"If supported by the platform, OSPM writes a one to this register
to enable CPPC on this processor. If not implemented, OSPM assumes the platform always has CPPC enabled."
Quoted 7 lines
The driver never writes this register. Call
cppc_set_enable()at the start ofcppc_cpufreq_cpu_init(). Errors are logged but not fatal, as the register is optional.Fixes 5477fb3bd1e8 ("ACPI / CPPC: Add a CPUFreq driver for use with CPPC")Cc [email protected] # v6.16+Signed-off-by Sumit Gupta <[email protected]>
So apparently Nvidia GB10 has and needs this
(I guess it doesn't hurt putting this into the
commit message)
amd-pstate sets it so all good.
Quoted 15 lines
---
Sending this separately from the autonomous mode boot parameter series where it was patch 1/2, as it is an independent bug fix.
v5 of the series:
https://lore.kernel.org/lkml/[email protected]/drivers/cpufreq/cppc_cpufreq.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/cpufreq/cppc_cpufreq.c +0
-0@@ -679,6 +679,14 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) caps = &cpu_data->perf_caps;
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · line 689
Quoted 10 lines
drivers/cpufreq/cppc_cpufreq.c +8
-0policy->driver_data = cpu_data; +/* +* Enable CPPC. The Enable register is optional - some platforms +* may not support it. +*/ + ret =cppc_set_enable (cpu, true); +if (ret && ret != -EOPNOTSUPP ) +pr_warn ("Failed to enable CPPC for CPU%u (%d)\n" , cpu, ret); +
Any reason to not fail here?
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · line 692
Quoted 3 lines
drivers/cpufreq/cppc_cpufreq.c +0
-0/* * Set min to lowest nonlinear perf to avoid any efficiency penalty (see * Section 8.4.7.1.1.5 of ACPI 6.1 spec)
... also I guess we need to set_enable(false) on
other failures?
It should be okay to do this only for policy->cpu AFAICS but I guess we do need to also reenable on resume.
Sumit Gupta
reviewerQuoted 13 lines · Christian Loehle
External email: Use caution opening links or attachments
Quoted 9 lines · Sumit Gupta
As per ACPI 6.x s8.4.6.1.4 (CPPC Enable register):
"If supported by the platform, OSPM writes a one to this register
to enable CPPC on this processor. If not implemented, OSPM assumes the platform always has CPPC enabled."The driver never writes this register. Call
cppc_set_enable()at the start ofcppc_cpufreq_cpu_init(). Errors are logged but not fatal, as the register is optional.
Quoted 9 lines
Quoted 3 lines
Fixes 5477fb3bd1e8 ("ACPI / CPPC: Add a CPUFreq driver for use with CPPC")Cc [email protected] # v6.16+Signed-off-by Sumit Gupta <[email protected]>So apparently Nvidia GB10 has and needs this
(I guess it doesn't hurt putting this into the
commit message)
amd-pstate sets it so all good.
Will add it in v2.
Quoted 17 lines
Quoted 17 lines
---
Sending this separately from the autonomous mode boot parameter series where it was patch 1/2, as it is an independent bug fix.
v5 of the series:
https://lore.kernel.org/lkml/[email protected]/drivers/cpufreq/cppc_cpufreq.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/cpufreq/cppc_cpufreq.c +0
-0@@ -679,6 +679,14 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) caps = &cpu_data->perf_caps; policy->driver_data = cpu_data;
Quoted 11 lines
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · line 689
Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c +8
-0+/* +* Enable CPPC. The Enable register is optional - some platforms +* may not support it. +*/ + ret =cppc_set_enable (cpu, true); +if (ret && ret != -EOPNOTSUPP ) +pr_warn ("Failed to enable CPPC for CPU%u (%d)\n" , cpu, ret); +Any reason to not fail here?
No strong reason. If this write fails, cppc_set_perf() below would likely fail too, and no platform reports this failure today. Will fail init in v2.
Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · line 692
Quoted 3 lines
drivers/cpufreq/cppc_cpufreq.c +0
-0/* * Set min to lowest nonlinear perf to avoid any efficiency penalty (see * Section 8.4.7.1.1.5 of ACPI 6.1 spec) ... also I guess we need to
set_enable(false)on
other failures?
Yes. Will move the call to just before cppc_set_perf(), so that is the only failure after it, and disable it again there.
Quoted 2 lines
It should be okay to do this only for
policy->cpuAFAICS but I guess we do need to also reenable on resume.
The preserve series [1] handles resume, as resume() there calls online() which re-enables CPPC. So I would leave it out of this patch.
[1] https://lore.kernel.org/lkml/[email protected]/
Thanks,
Sumit