Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/a6xx: Ensure CX collapse during gpu recovery

Because there could be transient votes from other drivers/tz/hyp which
may keep the cx gdsc enabled, we should poll until cx gdsc collapses.
We can use the reset framework to poll for cx gdsc collapse from gpucc
clk driver.

This feature requires support from the platform's gpucc driver.

Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Patchwork: https://patchwork.freedesktop.org/patch/498397/
Link: https://lore.kernel.org/r/20220819015030.v5.5.I176567525af2b9439a7e485d0ca130528666a55c@changeid
Signed-off-by: Rob Clark <robdclark@chromium.org>

authored by

Akhil P Oommen and committed by
Rob Clark
1f6cca40 f350bfb9

+12
+4
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 10 10 11 11 #include <linux/bitfield.h> 12 12 #include <linux/devfreq.h> 13 + #include <linux/reset.h> 13 14 #include <linux/soc/qcom/llcc-qcom.h> 14 15 15 16 #define GPU_PAS_ID 13 ··· 1297 1296 1298 1297 /* And the final one from recover worker */ 1299 1298 pm_runtime_put_sync(&gpu->pdev->dev); 1299 + 1300 + /* Call into gpucc driver to poll for cx gdsc collapse */ 1301 + reset_control_reset(gpu->cx_collapse); 1300 1302 1301 1303 pm_runtime_use_autosuspend(&gpu->pdev->dev); 1302 1304
+4
drivers/gpu/drm/msm/msm_gpu.c
··· 16 16 #include <generated/utsrelease.h> 17 17 #include <linux/string_helpers.h> 18 18 #include <linux/devcoredump.h> 19 + #include <linux/reset.h> 19 20 #include <linux/sched/task.h> 20 21 21 22 /* ··· 903 902 DBG("gpu_cx: %p", gpu->gpu_cx); 904 903 if (IS_ERR(gpu->gpu_cx)) 905 904 gpu->gpu_cx = NULL; 905 + 906 + gpu->cx_collapse = devm_reset_control_get_optional_exclusive(&pdev->dev, 907 + "cx_collapse"); 906 908 907 909 gpu->pdev = pdev; 908 910 platform_set_drvdata(pdev, &gpu->adreno_smmu);
+4
drivers/gpu/drm/msm/msm_gpu.h
··· 13 13 #include <linux/interconnect.h> 14 14 #include <linux/pm_opp.h> 15 15 #include <linux/regulator/consumer.h> 16 + #include <linux/reset.h> 16 17 17 18 #include "msm_drv.h" 18 19 #include "msm_fence.h" ··· 272 271 bool hw_apriv; 273 272 274 273 struct thermal_cooling_device *cooling; 274 + 275 + /* To poll for cx gdsc collapse during gpu recovery */ 276 + struct reset_control *cx_collapse; 275 277 }; 276 278 277 279 static inline struct msm_gpu *dev_to_gpu(struct device *dev)