cpufreq: intel_pstate: hybrid: Rework HWP calibration
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 4 Sep 2021 13:53:39 +0000 (15:53 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 7 Sep 2021 19:15:16 +0000 (21:15 +0200)
commit46573fd6369f098f15e11768850b6430f374905f
treeaa3d028fac29d73d72b85e090a87f1f478df0b35
parent0654cf05d17bc4d296a53a8bc7d107bc8a795f2e
cpufreq: intel_pstate: hybrid: Rework HWP calibration

The current HWP calibration for hybrid processors in intel_pstate is
fragile, because it depends too much on the information provided by
the platform firmware via CPPC which may not be reliable enough.  It
also need not be so complicated.

In order to improve that mechanism and make it more resistant to
platform firmware issues, make it only use the CPPC nominal_perf
values to compute the HWP-to-frequency scaling factors for all
CPUs and possibly use the HWP_CAP highest_perf values to recompute
them if the ones derived from the CPPC nominal_perf values alone
appear to be too high.

Namely, fetch CPC.nominal_perf for all CPUs present in the system,
find the minimum one and use it as a reference for computing all of
the CPUs' scaling factors (using the observation that for the CPUs
having the minimum CPC.nominal_perf the HWP range of available
performance levels should be the same as the range of available
"legacy" P-states and so the HWP-to-frequency scaling factor for
them should be the same as the corresponding scaling factor used
for representing the P-state values in kHz).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Zhang Rui <rui.zhang@intel.com>
drivers/cpufreq/intel_pstate.c