From 0e81ecf0210ac1770855664753e7afa2280fd3fb Mon Sep 17 00:00:00 2001 From: Sai Gurrappadi Date: Wed, 9 Aug 2017 10:35:44 -0700 Subject: gpu: nvgpu: gk20a: Fix up qos/sysfs limits Userspace sysfs limits devfreq->{min|max}_freq and pmqos min/max limits are treated as the same priority. In case these two ranges don't intersect prefer the max_freq clamp over the min_freq clamp. This is done in order to ensure any thermal throttling isn't bypassed by a userspace sysfs write. MaxQ/MaxP configurations only care about the Fmax limit and not necessarily Fmin, so preferring max_freq over min_freq is consistent with what is required. Bug 1933216 Change-Id: Ie8685306f10dee0f8d340c4b8e0eae533dbfc6ac Signed-off-by: Sai Gurrappadi Reviewed-on: https://git-master.nvidia.com/r/1535937 Reviewed-by: svccoveritychecker Reviewed-by: Aaron Huang Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index 6f4f7dc9..3e6fead6 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -160,19 +160,13 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq, * To get cap (max) freq, we select MIN of max frequencies * * In case we have conflict (min_freq > max_freq) after above - * steps, we ensure that devfreq->min_freq wins over - * qos_max_freq + * steps, we ensure that max_freq wins over min_freq */ min_freq = max_t(u32, devfreq->min_freq, profile->qos_min_freq); max_freq = min_t(u32, devfreq->max_freq, profile->qos_max_freq); - if (min_freq > max_freq) { - if (min_freq == devfreq->min_freq && - max_freq != devfreq->max_freq) { - max_freq = min_t(u32, min_freq, devfreq->max_freq); - } + if (min_freq > max_freq) min_freq = max_freq; - } /* Clip requested frequency */ if (local_freq < min_freq) -- cgit v1.2.2