From: Greg Kroah-Hartman Date: Sun, 27 Mar 2022 09:31:31 +0000 (+0200) Subject: 5.17-stable patches X-Git-Tag: v4.9.309~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4751493c8067d9a6024347f88ed12a3705970dc;p=thirdparty%2Fkernel%2Fstable-queue.git 5.17-stable patches added patches: drm-msm-gpu-fix-crash-on-devices-without-devfreq-support-v2.patch --- diff --git a/queue-5.17/drm-msm-gpu-fix-crash-on-devices-without-devfreq-support-v2.patch b/queue-5.17/drm-msm-gpu-fix-crash-on-devices-without-devfreq-support-v2.patch new file mode 100644 index 00000000000..499bbe9ad59 --- /dev/null +++ b/queue-5.17/drm-msm-gpu-fix-crash-on-devices-without-devfreq-support-v2.patch @@ -0,0 +1,106 @@ +From 05afd57f4d34602a652fdaf58e0a2756b3c20fd4 Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Tue, 8 Mar 2022 10:48:44 -0800 +Subject: drm/msm/gpu: Fix crash on devices without devfreq support (v2) + +From: Rob Clark + +commit 05afd57f4d34602a652fdaf58e0a2756b3c20fd4 upstream. + +Avoid going down devfreq paths on devices where devfreq is not +initialized. + +v2: Change has_devfreq() logic [Dmitry] + +Reported-by: Linux Kernel Functional Testing +Reported-by: Anders Roxell +Signed-off-by: Rob Clark +Fixes: 6aa89ae1fb04 ("drm/msm/gpu: Cancel idle/boost work on suspend") +Reviewed-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20220308184844.1121029-1-robdclark@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/msm/msm_gpu_devfreq.c | 30 +++++++++++++++++++++++++----- + 1 file changed, 25 insertions(+), 5 deletions(-) + +--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c ++++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c +@@ -83,6 +83,12 @@ static struct devfreq_dev_profile msm_de + static void msm_devfreq_boost_work(struct kthread_work *work); + static void msm_devfreq_idle_work(struct kthread_work *work); + ++static bool has_devfreq(struct msm_gpu *gpu) ++{ ++ struct msm_gpu_devfreq *df = &gpu->devfreq; ++ return !!df->devfreq; ++} ++ + void msm_devfreq_init(struct msm_gpu *gpu) + { + struct msm_gpu_devfreq *df = &gpu->devfreq; +@@ -149,6 +155,9 @@ void msm_devfreq_cleanup(struct msm_gpu + { + struct msm_gpu_devfreq *df = &gpu->devfreq; + ++ if (!has_devfreq(gpu)) ++ return; ++ + devfreq_cooling_unregister(gpu->cooling); + dev_pm_qos_remove_request(&df->boost_freq); + dev_pm_qos_remove_request(&df->idle_freq); +@@ -156,16 +165,24 @@ void msm_devfreq_cleanup(struct msm_gpu + + void msm_devfreq_resume(struct msm_gpu *gpu) + { +- gpu->devfreq.busy_cycles = 0; +- gpu->devfreq.time = ktime_get(); ++ struct msm_gpu_devfreq *df = &gpu->devfreq; + +- devfreq_resume_device(gpu->devfreq.devfreq); ++ if (!has_devfreq(gpu)) ++ return; ++ ++ df->busy_cycles = 0; ++ df->time = ktime_get(); ++ ++ devfreq_resume_device(df->devfreq); + } + + void msm_devfreq_suspend(struct msm_gpu *gpu) + { + struct msm_gpu_devfreq *df = &gpu->devfreq; + ++ if (!has_devfreq(gpu)) ++ return; ++ + devfreq_suspend_device(df->devfreq); + + cancel_idle_work(df); +@@ -185,6 +202,9 @@ void msm_devfreq_boost(struct msm_gpu *g + struct msm_gpu_devfreq *df = &gpu->devfreq; + uint64_t freq; + ++ if (!has_devfreq(gpu)) ++ return; ++ + freq = get_freq(gpu); + freq *= factor; + +@@ -207,7 +227,7 @@ void msm_devfreq_active(struct msm_gpu * + struct devfreq_dev_status status; + unsigned int idle_time; + +- if (!df->devfreq) ++ if (!has_devfreq(gpu)) + return; + + /* +@@ -253,7 +273,7 @@ void msm_devfreq_idle(struct msm_gpu *gp + { + struct msm_gpu_devfreq *df = &gpu->devfreq; + +- if (!df->devfreq) ++ if (!has_devfreq(gpu)) + return; + + msm_hrtimer_queue_work(&df->idle_work, ms_to_ktime(1), diff --git a/queue-5.17/series b/queue-5.17/series index b194aea5833..781c1d2a380 100644 --- a/queue-5.17/series +++ b/queue-5.17/series @@ -37,3 +37,4 @@ tpm-use-try_get_ops-in-tpm-space.c.patch wcn36xx-differentiate-wcn3660-from-wcn3620.patch m68k-fix-access_ok-for-coldfire.patch nds32-fix-access_ok-checks-in-get-put_user.patch +drm-msm-gpu-fix-crash-on-devices-without-devfreq-support-v2.patch