@@ -675,6 +675,29 @@ static inline u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
675675}
676676#endif
677677
678+ static void acpi_cpufreq_resolve_max_freq (struct cpufreq_policy * policy ,
679+ unsigned int pss_max_freq )
680+ {
681+ #ifdef CONFIG_ACPI_CPPC_LIB
682+ u64 max_speed = cppc_get_dmi_max_khz ();
683+ /*
684+ * Use DMI "Max Speed" if it looks plausible: must be
685+ * above _PSS P0 frequency and within 2x of it.
686+ */
687+ if (max_speed > pss_max_freq && max_speed < pss_max_freq * 2 ) {
688+ policy -> cpuinfo .max_freq = max_speed ;
689+ return ;
690+ }
691+ #endif
692+ /*
693+ * If the maximum "boost" frequency is unknown, ask the arch
694+ * scale-invariance code to use the "nominal" performance for
695+ * CPU utilization scaling so as to prevent the schedutil
696+ * governor from selecting inadequate CPU frequencies.
697+ */
698+ arch_set_max_freq_ratio (true);
699+ }
700+
678701static int acpi_cpufreq_cpu_init (struct cpufreq_policy * policy )
679702{
680703 struct cpufreq_frequency_table * freq_table ;
@@ -849,13 +872,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
849872
850873 policy -> cpuinfo .max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT ;
851874 } else {
852- /*
853- * If the maximum "boost" frequency is unknown, ask the arch
854- * scale-invariance code to use the "nominal" performance for
855- * CPU utilization scaling so as to prevent the schedutil
856- * governor from selecting inadequate CPU frequencies.
857- */
858- arch_set_max_freq_ratio (true);
875+ acpi_cpufreq_resolve_max_freq (policy , freq_table [0 ].frequency );
859876 }
860877
861878 policy -> freq_table = freq_table ;
0 commit comments