Skip to content

Commit a1ffa95

Browse files
pierregondoissforshee
authored andcommitted
NVIDIA: VR: SAUCE: cpufreq: Use policy->min/max init as QoS request
Consider policy->min/max being set in the driver .init() callback as a QoS request. Impacted driver are: - gx-suspmod.c (min) - cppc-cpufreq.c (min) - longrun.c (min/max) Update the documentation accordingly. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> (cherry picked from https://lore.kernel.org/lkml/20260511135538.522653-5-pierre.gondois@arm.com/) Signed-off-by: Seth Forshee <sforshee@nvidia.com>
1 parent 38c090b commit a1ffa95

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

Documentation/cpu-freq/cpu-drivers.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,14 @@ Then, the driver must fill in the following values:
114114
|policy->cur | The current operating frequency of |
115115
| | this CPU (if appropriate) |
116116
+-----------------------------------+--------------------------------------+
117-
|policy->min, | |
118-
|policy->max, | |
117+
|policy->min | If set by the driver in ->init(), |
118+
| | used as initial minimum frequency |
119+
| | QoS request. |
120+
+-----------------------------------+--------------------------------------+
121+
|policy->max | If set by the driver in ->init(), |
122+
| | used as initial maximum frequency |
123+
| | QoS request. |
124+
+-----------------------------------+--------------------------------------+
119125
|policy->policy and, if necessary, | |
120126
|policy->governor | must contain the "default policy" for|
121127
| | this CPU. A few moments later, |

drivers/cpufreq/cpufreq.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,16 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
13931393

13941394
static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
13951395
{
1396+
unsigned int min_freq, max_freq;
13961397
int ret;
13971398

1399+
/* Use policy->min/max set by the driver as QoS requests. */
1400+
min_freq = max(FREQ_QOS_MIN_DEFAULT_VALUE, policy->min);
1401+
if (policy->max)
1402+
max_freq = min(FREQ_QOS_MAX_DEFAULT_VALUE, policy->max);
1403+
else
1404+
max_freq = FREQ_QOS_MAX_DEFAULT_VALUE;
1405+
13981406
/*
13991407
* If the driver didn't set policy->min/max, set them as
14001408
* they are used to clamp frequency requests.
@@ -1412,12 +1420,12 @@ static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
14121420
}
14131421

14141422
ret = freq_qos_add_request(&policy->constraints, &policy->min_freq_req,
1415-
FREQ_QOS_MIN, FREQ_QOS_MIN_DEFAULT_VALUE);
1423+
FREQ_QOS_MIN, min_freq);
14161424
if (ret < 0)
14171425
return ret;
14181426

14191427
ret = freq_qos_add_request(&policy->constraints, &policy->max_freq_req,
1420-
FREQ_QOS_MAX, FREQ_QOS_MAX_DEFAULT_VALUE);
1428+
FREQ_QOS_MAX, max_freq);
14211429
if (ret < 0)
14221430
return ret;
14231431

0 commit comments

Comments
 (0)