Commit 857a61c
cpufreq/amd-pstate: Refactor max frequency calculation
The previous approach introduced roundoff errors during division when
calculating the boost ratio. This, in turn, affected the maximum
frequency calculation, often resulting in reporting lower frequency
values.
For example, on the Glinda SoC based board with the following
parameters:
max_perf = 208
nominal_perf = 100
nominal_freq = 2600 MHz
The Linux kernel previously calculated the frequency as:
freq = ((max_perf * 1024 / nominal_perf) * nominal_freq) / 1024
freq = 5405 MHz // Integer arithmetic.
With the updated formula:
freq = (max_perf * nominal_freq) / nominal_perf
freq = 5408 MHz
This change ensures more accurate frequency calculations by eliminating
unnecessary shifts and divisions, thereby improving precision.
Signed-off-by: Naresh Solanki <[email protected]>
[ML: trim the changelog from commit message]
Reviewed-by: Mario Limonciello <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mario Limonciello <[email protected]>1 parent fd604ae commit 857a61c
1 file changed
+4
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
911 | | - | |
| 911 | + | |
912 | 912 | | |
913 | | - | |
914 | 913 | | |
915 | 914 | | |
916 | 915 | | |
| |||
927 | 926 | | |
928 | 927 | | |
929 | 928 | | |
| 929 | + | |
930 | 930 | | |
931 | | - | |
932 | | - | |
933 | | - | |
| 931 | + | |
934 | 932 | | |
935 | 933 | | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
| 934 | + | |
940 | 935 | | |
941 | 936 | | |
942 | 937 | | |
| |||
0 commit comments