Skip to contentSkip to conversation

drm/msm/adreno/a6xx: Set the GPU frequency after turning on the GMU

PATCH In review Jordan Crouse 3 participants 3 messages Aug 3, 2018 – Aug 4, 2018 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/adreno/a6xx: Set the GPU frequency after turning on the GMU

Set the correct initial GPU frequency on the GMU just after turning on or resetting the GMU so it doesn't keep running at a horribly slow speed.

---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +26 -0
index c49ca275a3b3..f8227f38b8cd 100644
@@ -65,6 +65,26 @@ static bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu)
 		A6XX_GMU_SPTPRAC_PWR_CLK_STATUS_GX_HM_CLK_OFF));
 }
 
+static int a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)
+{
+	gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0);
+
+	gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,
+		((index << 24) & 0xff) | (3 & 0xf));
+
+	/*
+	 * Send an invalid index as a vote for the bus bandwidth and let the
+	 * firmware decide on the right vote
+	 */
+	gmu_write(gmu, REG_A6XX_GMU_DCVS_BW_SETTING, 0xff);
+
+	/* Set and clear the OOB for DCVS to trigger the GMU */
+	a6xx_gmu_set_oob(gmu, GMU_OOB_DCVS_SET);
+	a6xx_gmu_clear_oob(gmu, GMU_OOB_DCVS_SET);
+
+	return gmu_read(gmu, REG_A6XX_GMU_DCVS_RETURN);
+}
+
 static bool a6xx_gmu_check_idle_level(struct a6xx_gmu *gmu)
 {
 	u32 val;
@@ -602,6 +622,9 @@ int a6xx_gmu_reset(struct a6xx_gpu *a6xx_gpu)
 	if (!ret)
 		ret = a6xx_hfi_start(gmu, GMU_COLD_BOOT);
 
+	/* Set the GPU back to the highest power frequency */
+	a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
 	if (ret)
 		a6xx_gmu_clear_oob(gmu, GMU_OOB_BOOT_SLUMBER);
 
@@ -635,6 +658,9 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 
 	ret = a6xx_hfi_start(gmu, status);
 
+	/* Set the GPU to the highest power frequency */
+	a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
 out:
 	/* Make sure to turn off the boot OOB request on error */
 	if (ret)
Signature · 6 lines
2.18.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): 20180803210606.15363-1-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org

Tested-by
#2 lore raw
Quoted 6 lines · Jordan Crouse

Set the correct initial GPU frequency on the GMU just after turning on or resetting the GMU so it doesn't keep running at a horribly slow speed.

*much* better :-)

Quoted 56 lines
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +26 -1
index c49ca275a3b3..f8227f38b8cd 100644
@@ -65,6 +65,26 @@ static bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu)
                A6XX_GMU_SPTPRAC_PWR_CLK_STATUS_GX_HM_CLK_OFF));
 }
 
+static int a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)
+{
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0);
+
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,
+               ((index << 24) & 0xff) | (3 & 0xf));
+
+       /*
+        * Send an invalid index as a vote for the bus bandwidth and let the
+        * firmware decide on the right vote
+        */
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_BW_SETTING, 0xff);
+
+       /* Set and clear the OOB for DCVS to trigger the GMU */
+       a6xx_gmu_set_oob(gmu, GMU_OOB_DCVS_SET);
+       a6xx_gmu_clear_oob(gmu, GMU_OOB_DCVS_SET);
+
+       return gmu_read(gmu, REG_A6XX_GMU_DCVS_RETURN);
+}
+
 static bool a6xx_gmu_check_idle_level(struct a6xx_gmu *gmu)
 {
        u32 val;
@@ -602,6 +622,9 @@ int a6xx_gmu_reset(struct a6xx_gpu *a6xx_gpu)
        if (!ret)
                ret = a6xx_hfi_start(gmu, GMU_COLD_BOOT);
 
+       /* Set the GPU back to the highest power frequency */
+       a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
        if (ret)
                a6xx_gmu_clear_oob(gmu, GMU_OOB_BOOT_SLUMBER);
 
@@ -635,6 +658,9 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 
        ret = a6xx_hfi_start(gmu, status);
 
+       /* Set the GPU to the highest power frequency */
+       a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
 out:
        /* Make sure to turn off the boot OOB request on error */
        if (ret)
--
Quoted 2 lines

2.18.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

A message that is not in the archive (sent off-list or not yet received): CAF6AEGuFeXmo1toVZHArT01EBnHQn+XZ5g6R-hagxLfTYjNwww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 11 lines · Rob Clark
Quoted 6 lines · Jordan Crouse

Set the correct initial GPU frequency on the GMU just after turning on or resetting the GMU so it doesn't keep running at a horribly slow speed.

*much* better :-)

Awesome, thanks Jordan.

Quoted 51 lines
Quoted 49 lines
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +23 -0
index c49ca275a3b3..f8227f38b8cd 100644
@@ -65,6 +65,26 @@ static bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu)
                A6XX_GMU_SPTPRAC_PWR_CLK_STATUS_GX_HM_CLK_OFF));
 }
 
+static int a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int index)
+{
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0);
+
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,
+               ((index << 24) & 0xff) | (3 & 0xf));
+
+       /*
+        * Send an invalid index as a vote for the bus bandwidth and let the
+        * firmware decide on the right vote
+        */
+       gmu_write(gmu, REG_A6XX_GMU_DCVS_BW_SETTING, 0xff);
+
+       /* Set and clear the OOB for DCVS to trigger the GMU */
+       a6xx_gmu_set_oob(gmu, GMU_OOB_DCVS_SET);
+       a6xx_gmu_clear_oob(gmu, GMU_OOB_DCVS_SET);
+
+       return gmu_read(gmu, REG_A6XX_GMU_DCVS_RETURN);
+}
+
 static bool a6xx_gmu_check_idle_level(struct a6xx_gmu *gmu)
 {
        u32 val;
@@ -602,6 +622,9 @@ int a6xx_gmu_reset(struct a6xx_gpu *a6xx_gpu)
        if (!ret)
                ret = a6xx_hfi_start(gmu, GMU_COLD_BOOT);
 
+       /* Set the GPU back to the highest power frequency */
+       a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
        if (ret)
                a6xx_gmu_clear_oob(gmu, GMU_OOB_BOOT_SLUMBER);
 
@@ -635,6 +658,9 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 
        ret = a6xx_hfi_start(gmu, status);
 
Quoted 13 lines
Quoted 9 lines
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +3 -1
+       /* Set the GPU to the highest power frequency */
+       a6xx_gmu_set_freq(gmu, gmu->nr_gpu_freqs - 1);
+
 out:
        /* Make sure to turn off the boot OOB request on error */
        if (ret)
--

2.18.0

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno