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

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/gpu: Add devfreq tuning debugfs

Make the handful of tuning knobs available visible via debugfs.

v2: select DEVFREQ_GOV_SIMPLE_ONDEMAND because for some reason
struct devfreq_simple_ondemand_data depends on this

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/517784/
Link: https://lore.kernel.org/r/20230110231447.1939101-2-robdclark@gmail.com
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>

+27 -6
+1
drivers/gpu/drm/msm/Kconfig
··· 23 23 select SHMEM 24 24 select TMPFS 25 25 select QCOM_SCM 26 + select DEVFREQ_GOV_SIMPLE_ONDEMAND 26 27 select WANT_DEV_COREDUMP 27 28 select SND_SOC_HDMI_CODEC if SND_SOC 28 29 select SYNC_FILE
+1 -1
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 2021 2021 * to cause power supply issues: 2022 2022 */ 2023 2023 if (adreno_is_a618(adreno_gpu) || adreno_is_7c3(adreno_gpu)) 2024 - gpu->clamp_to_idle = true; 2024 + priv->gpu_clamp_to_idle = true; 2025 2025 2026 2026 /* Check if there is a GMU phandle and set it up */ 2027 2027 node = of_parse_phandle(pdev->dev.of_node, "qcom,gmu", 0);
+12
drivers/gpu/drm/msm/msm_debugfs.c
··· 305 305 { 306 306 struct drm_device *dev = minor->dev; 307 307 struct msm_drm_private *priv = dev->dev_private; 308 + struct dentry *gpu_devfreq; 308 309 309 310 drm_debugfs_create_files(msm_debugfs_list, 310 311 ARRAY_SIZE(msm_debugfs_list), ··· 325 324 326 325 debugfs_create_file("shrink", S_IRWXU, minor->debugfs_root, 327 326 dev, &shrink_fops); 327 + 328 + gpu_devfreq = debugfs_create_dir("devfreq", minor->debugfs_root); 329 + 330 + debugfs_create_bool("idle_clamp",0600, gpu_devfreq, 331 + &priv->gpu_clamp_to_idle); 332 + 333 + debugfs_create_u32("upthreshold",0600, gpu_devfreq, 334 + &priv->gpu_devfreq_config.upthreshold); 335 + 336 + debugfs_create_u32("downdifferential",0600, gpu_devfreq, 337 + &priv->gpu_devfreq_config.downdifferential); 328 338 329 339 if (priv->kms && priv->kms->funcs->debugfs_init) 330 340 priv->kms->funcs->debugfs_init(priv->kms, minor);
+9
drivers/gpu/drm/msm/msm_drv.h
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/clk.h> 13 13 #include <linux/cpufreq.h> 14 + #include <linux/devfreq.h> 14 15 #include <linux/module.h> 15 16 #include <linux/component.h> 16 17 #include <linux/platform_device.h> ··· 233 232 * "have the CP position registers changed since last time?" 234 233 */ 235 234 unsigned int hangcheck_period; 235 + 236 + /** gpu_devfreq_config: Devfreq tuning config for the GPU. */ 237 + struct devfreq_simple_ondemand_data gpu_devfreq_config; 238 + 239 + /** 240 + * gpu_clamp_to_idle: Enable clamping to idle freq when inactive 241 + */ 242 + bool gpu_clamp_to_idle; 236 243 237 244 /** 238 245 * disable_err_irq:
-3
drivers/gpu/drm/msm/msm_gpu.h
··· 275 275 276 276 struct msm_gpu_state *crashstate; 277 277 278 - /* Enable clamping to idle freq when inactive: */ 279 - bool clamp_to_idle; 280 - 281 278 /* True if the hardware supports expanded apriv (a650 and newer) */ 282 279 bool hw_apriv; 283 280
+4 -2
drivers/gpu/drm/msm/msm_gpu_devfreq.c
··· 183 183 void msm_devfreq_init(struct msm_gpu *gpu) 184 184 { 185 185 struct msm_gpu_devfreq *df = &gpu->devfreq; 186 + struct msm_drm_private *priv = gpu->dev->dev_private; 186 187 187 188 /* We need target support to do devfreq */ 188 189 if (!gpu->funcs->gpu_busy) ··· 210 209 211 210 df->devfreq = devm_devfreq_add_device(&gpu->pdev->dev, 212 211 &msm_devfreq_profile, DEVFREQ_GOV_SIMPLE_ONDEMAND, 213 - NULL); 212 + &priv->gpu_devfreq_config); 214 213 215 214 if (IS_ERR(df->devfreq)) { 216 215 DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); ··· 359 358 struct msm_gpu_devfreq *df = container_of(work, 360 359 struct msm_gpu_devfreq, idle_work.work); 361 360 struct msm_gpu *gpu = container_of(df, struct msm_gpu, devfreq); 361 + struct msm_drm_private *priv = gpu->dev->dev_private; 362 362 363 363 df->idle_time = ktime_get(); 364 364 365 - if (gpu->clamp_to_idle) 365 + if (priv->gpu_clamp_to_idle) 366 366 dev_pm_qos_update_request(&df->idle_freq, 0); 367 367 } 368 368