mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
cpufreq/acpi-cpufreq: Use amd_get_boost_ratio()
Update get_max_boost_ratio() to use the new amd_get_boost_ratio() helper function instead of calling amd_get_effective_highest_perf() directly. This ensures the boost ratio is calculated correctly on systems where frequency values should be used instead of performance values. Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20261001142341.2934582-3-mario.limonciello@amd.com Signed-off-by: Mario Limonciello <superm1@kernel.org>
This commit is contained in:
parent
4817d3e2b9
commit
f9da951d30
|
|
@ -626,7 +626,7 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
|
|||
static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
|
||||
{
|
||||
struct cppc_perf_caps perf_caps;
|
||||
u64 highest_perf, nominal_perf;
|
||||
u64 numerator, denominator;
|
||||
int ret;
|
||||
|
||||
if (acpi_pstate_strict)
|
||||
|
|
@ -640,33 +640,31 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
|
|||
}
|
||||
|
||||
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
|
||||
ret = amd_get_effective_highest_perf(cpu);
|
||||
if (ret < 0) {
|
||||
pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n",
|
||||
ret = amd_get_boost_ratio(cpu, &numerator, &denominator);
|
||||
if (ret) {
|
||||
pr_debug("CPU%d: Unable to get boost ratio (%d)\n",
|
||||
cpu, ret);
|
||||
return 0;
|
||||
}
|
||||
highest_perf = ret;
|
||||
} else {
|
||||
highest_perf = perf_caps.highest_perf;
|
||||
numerator = perf_caps.highest_perf;
|
||||
denominator = perf_caps.nominal_perf;
|
||||
}
|
||||
|
||||
nominal_perf = perf_caps.nominal_perf;
|
||||
|
||||
if (nominal_freq)
|
||||
*nominal_freq = perf_caps.nominal_freq * 1000;
|
||||
|
||||
if (!highest_perf || !nominal_perf) {
|
||||
if (!numerator || !denominator) {
|
||||
pr_debug("CPU%d: highest or nominal performance missing\n", cpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (highest_perf < nominal_perf) {
|
||||
if (numerator < denominator) {
|
||||
pr_debug("CPU%d: nominal performance above highest\n", cpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
|
||||
return div_u64(numerator << SCHED_CAPACITY_SHIFT, denominator);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user