drm/msm/a6xx: don't try to set GPU frequency when GMU is suspended
Subsystems (4)
PATCH 1/1 drm/msm/a6xx: don't try to set GPU frequency when GMU is suspended
This fixes changing the frequency in sysfs while suspended, for example when doing something like this:
cat devfreq/3d00000.gpu/max_freq > devfreq/3d00000.gpu/min_freq
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +9 -2
@@ -151,13 +151,20 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq)break ; gmu->current_perf_index = perf_index; + gmu->freq = gmu->gpu_freqs[perf_index]; + +/* +* devfreq may try to change frequency target even when suspended +* this can happen when changing frequency through sysfs +* don't try to set freq when suspended, it will be set on resume +*/ +if (!pm_runtime_active (gmu->dev)) +return ;if (gmu->legacy)__a6xx_gmu_set_freq (gmu, perf_index);else a6xx_hfi_set_freq (gmu, perf_index); - - gmu->freq = gmu->gpu_freqs[perf_index]; }unsigned long a6xx_gmu_get_freq (struct msm_gpu *gpu)
Signature · 1 line
2.26.1
Quoted 4 lines · Jonathan Marek
This fixes changing the frequency in sysfs while suspended, for example when doing something like this:
cat devfreq/3d00000.gpu/max_freq > devfreq/3d00000.gpu/min_freq
A patch landed to fix this [1] but it crossed paths in the night with the a640/a650 support. Can you respin this to move the pm_runtime_get_if_in_use() check in _a6xx_gmu_set_freq() to the higher level function and then we should be covered.
Thanks,
Jordan
[1] https://patchwork.freedesktop.org/patch/364089/?series=76829&rev=3
Quoted 35 lines
Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/gpu/drm/msm/adreno/a6xx_gmu.c +9
-2@@ -151,13 +151,20 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq)break ; gmu->current_perf_index = perf_index; + gmu->freq = gmu->gpu_freqs[perf_index]; + +/* +* devfreq may try to change frequency target even when suspended +* this can happen when changing frequency through sysfs +* don't try to set freq when suspended, it will be set on resume +*/ +if (!pm_runtime_active (gmu->dev)) +return ;if (gmu->legacy)__a6xx_gmu_set_freq (gmu, perf_index);else a6xx_hfi_set_freq (gmu, perf_index); - - gmu->freq = gmu->gpu_freqs[perf_index]; }unsigned long a6xx_gmu_get_freq (struct msm_gpu *gpu)Signature · 1 line
2.26.1
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v2 1/1 drm/msm/a6xx: skip HFI set freq if GMU is powered down
Also skip the newly added HFI set freq path if the GMU is powered down, which was missing because of patches crossing paths.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +9 -9
@@ -110,13 +110,6 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)struct msm_gpu *gpu = &adreno_gpu->base;int ret; -/* -* This can get called from devfreq while the hardware is idle. Don't -* bring up the power if it isn't already active -*/ -if (pm_runtime_get_if_in_use (gmu->dev) ==0 ) -return ; -gmu_write (gmu,REG_A6XX_GMU_DCVS_ACK_OPTION ,0 ); gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,
@@ -141,7 +134,6 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)* for now leave it at max so that the performance is nominal. */ icc_set_bw (gpu->icc_path,0 ,MBps_to_icc (7216 )); -pm_runtime_put (gmu->dev); }void a6xx_gmu_set_freq (struct msm_gpu *gpu,unsigned long freq)
@@ -159,13 +151,21 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq)break ; gmu->current_perf_index = perf_index; + gmu->freq = gmu->gpu_freqs[perf_index]; + +/* +* This can get called from devfreq while the hardware is idle. Don't +* bring up the power if it isn't already active +*/ +if (pm_runtime_get_if_in_use (gmu->dev) ==0 ) +return ;if (gmu->legacy)__a6xx_gmu_set_freq (gmu, perf_index);else a6xx_hfi_set_freq (gmu, perf_index); - gmu->freq = gmu->gpu_freqs[perf_index]; +pm_runtime_put (gmu->dev); }unsigned long a6xx_gmu_get_freq (struct msm_gpu *gpu)
Signature · 1 line
2.26.1
Re: [PATCH v2] drm/msm/a6xx: skip HFI set freq if GMU is powered down
Quoted 2 lines · Jonathan Marek
Also skip the newly added HFI set freq path if the GMU is powered down, which was missing because of patches crossing paths.
I saw the 5.8 pull later in my inbox so I'm not sure if this made it or not but it qualifies as a -fix if it didn't.
Quoted 57 lines
Signed-off-by Jonathan Marek <[email protected]>--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/gpu/drm/msm/adreno/a6xx_gmu.c +9
-9@@ -110,13 +110,6 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)struct msm_gpu *gpu = &adreno_gpu->base;int ret; -/* -* This can get called from devfreq while the hardware is idle. Don't -* bring up the power if it isn't already active -*/ -if (pm_runtime_get_if_in_use (gmu->dev) ==0 ) -return ; -gmu_write (gmu,REG_A6XX_GMU_DCVS_ACK_OPTION ,0 ); gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,@@ -141,7 +134,6 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)* for now leave it at max so that the performance is nominal. */ icc_set_bw (gpu->icc_path,0 ,MBps_to_icc (7216 )); -pm_runtime_put (gmu->dev); }void a6xx_gmu_set_freq (struct msm_gpu *gpu,unsigned long freq)@@ -159,13 +151,21 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, unsigned long freq)break ; gmu->current_perf_index = perf_index; + gmu->freq = gmu->gpu_freqs[perf_index]; + +/* +* This can get called from devfreq while the hardware is idle. Don't +* bring up the power if it isn't already active +*/ +if (pm_runtime_get_if_in_use (gmu->dev) ==0 ) +return ;if (gmu->legacy)__a6xx_gmu_set_freq (gmu, perf_index);else a6xx_hfi_set_freq (gmu, perf_index); - gmu->freq = gmu->gpu_freqs[perf_index]; +pm_runtime_put (gmu->dev); }unsigned long a6xx_gmu_get_freq (struct msm_gpu *gpu)Signature · 1 line
2.26.1
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project