Skip to content

Commit 12753d7

Browse files
Meng Lirafaeljw
authored andcommitted
ACPI: CPPC: Add helper to get the highest performance value
Add support for getting the highest performance to the generic CPPC driver. This enables downstream drivers such as amd-pstate to discover and use these values. Refer to Chapter 8.4.6.1.1.1. Highest Performance of ACPI Specification 6.5 for details on continuous performance control of CPPC (linked below). Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Wyes Karny <wyes.karny@amd.com> Reviewed-by: Perry Yuan <perry.yuan@amd.com> Acked-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Meng Li <li.meng@amd.com> Link: https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html?highlight=cppc#highest-performance [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 3598e57 commit 12753d7

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
11571157
return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf);
11581158
}
11591159

1160+
/**
1161+
* cppc_get_highest_perf - Get the highest performance register value.
1162+
* @cpunum: CPU from which to get highest performance.
1163+
* @highest_perf: Return address.
1164+
*
1165+
* Return: 0 for success, -EIO otherwise.
1166+
*/
1167+
int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
1168+
{
1169+
return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf);
1170+
}
1171+
EXPORT_SYMBOL_GPL(cppc_get_highest_perf);
1172+
11601173
/**
11611174
* cppc_get_epp_perf - Get the epp register value.
11621175
* @cpunum: CPU from which to get epp preference value.

include/acpi/cppc_acpi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ struct cppc_cpudata {
139139
#ifdef CONFIG_ACPI_CPPC_LIB
140140
extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
141141
extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf);
142+
extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf);
142143
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
143144
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
144145
extern int cppc_set_enable(int cpu, bool enable);
@@ -167,6 +168,10 @@ static inline int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
167168
{
168169
return -ENOTSUPP;
169170
}
171+
static inline int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
172+
{
173+
return -ENOTSUPP;
174+
}
170175
static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs)
171176
{
172177
return -ENOTSUPP;

0 commit comments

Comments
 (0)