Skip to contentSkip to conversation

drm/amdpu/vce_v3: skip suspend and resume if powergated

PATCH In review Shirish S 4 participants 5 messages Aug 10, 2018 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amdpu/vce_v3: skip suspend and resume if powergated

This patch adds a mechanism by which the VCE 3.0 block shall check if it was enabled or in use before suspending, if it was powergated while entering suspend then there is no need to repeat it in vce_3_0_suspend(). Similarly, if the block was powergated while entering suspend itself then there is no need to resume it.

By this we not only make the suspend and resume sequence more efficient, but also optimize the overall amdgpu suspend and resume time by reducing the ring intialize and tests for unused IP blocks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 07924d4..aa85063 100644
@@ -1035,6 +1035,8 @@ struct amdgpu_device {
 
 	/* vce */
 	struct amdgpu_vce		vce;
+	bool				is_vce_pg;
+	bool				is_vce_disabled;
 
 	/* vcn */
 	struct amdgpu_vcn		vcn;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +21 -0
index cc6ce6c..822cfd6 100644
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
 	WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
 	mutex_unlock(&adev->grbm_idx_mutex);
 
+	adev->is_vce_pg = false;
 	return 0;
 }
 
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct amdgpu_device *adev)
 	WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
 	mutex_unlock(&adev->grbm_idx_mutex);
 
+	adev->is_vce_pg = true;
 	return 0;
 }
 
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void *handle)
 	int r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* Proceed with suspend sequence only if VCE is started
+	 * Mark the block as being disabled if its stopped.
+	 */
+	if (adev->is_vce_pg) {
+		DRM_DEBUG("VCE is already powergated, not suspending\n");
+		adev->is_vce_disabled = true;
+		return 0;
+	}
+
+	adev->is_vce_disabled = false;
+
 	r = vce_v3_0_hw_fini(adev);
 	if (r)
 		return r;
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void *handle)
 	int r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/* Proceed with resume sequence if VCE was enabled
+	 * while suspending.
+	 */
+	if (adev->is_vce_disabled) {
+		DRM_DEBUG("VCE is powergated, not resuming the block\n");
+		return 0;
+	}
+
 	r = amdgpu_vce_resume(adev);
 	if (r)
 		return r;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1533881700-10371-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

#2 lore raw

I am Ok with the check when call vce_v3_0_hw_fini.

But we may still need to call amdpug_vce_suspend/resume.

and not sure whether need to do ring test when resume back.

Best Regards

Rex

________________________________
From: S, Shirish
Sent: Friday, August 10, 2018 2:15 PM
To: Deucher, Alexander; Zhu, Rex; Liu, Leo
Cc: [email protected]; S, Shirish
Subject: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

This patch adds a mechanism by which the VCE 3.0 block shall check if it was enabled or in use before suspending, if it was powergated while entering suspend then there is no need to repeat it in vce_3_0_suspend(). Similarly, if the block was powergated while entering suspend itself then there is no need to resume it.

By this we not only make the suspend and resume sequence more efficient, but also optimize the overall amdgpu suspend and resume time by reducing the ring intialize and tests for unused IP blocks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 07924d4..aa85063 100644
@@ -1035,6 +1035,8 @@ struct amdgpu_device {
 
         /* vce */
         struct amdgpu_vce               vce;
+       bool                            is_vce_pg;
+       bool                            is_vce_disabled;
 
         /* vcn */
         struct amdgpu_vcn               vcn;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +21 -0
index cc6ce6c..822cfd6 100644
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = false;
         return 0;
 }
 
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = true;
         return 0;
 }
 
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with suspend sequence only if VCE is started
+        * Mark the block as being disabled if its stopped.
+        */
+       if (adev->is_vce_pg) {
+               DRM_DEBUG("VCE is already powergated, not suspending\n");
+               adev->is_vce_disabled = true;
+               return 0;
+       }
+
+       adev->is_vce_disabled = false;
+
         r = vce_v3_0_hw_fini(adev);
         if (r)
                 return r;
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with resume sequence if VCE was enabled
+        * while suspending.
+        */
+       if (adev->is_vce_disabled) {
+               DRM_DEBUG("VCE is powergated, not resuming the block\n");
+               return 0;
+       }
+
         r = amdgpu_vce_resume(adev);
         if (r)
                 return r;

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BYAPR12MB2775F1BD12A3F215A6F5C936FB240-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw

There are ASIC reset/ASIC resume during S4 freeze()/throw() process, I am afraid there may be some problem for ring/ib test.

It should be more test to confirm it.

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Zhu, Rex <[email protected]> 发送时间: 2018年8月10日 14:32:36
收件人: S, Shirish; Deucher, Alexander; Liu, Leo
抄送: [email protected]
主题: Re: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

I am Ok with the check when call vce_v3_0_hw_fini.

But we may still need to call amdpug_vce_suspend/resume.

and not sure whether need to do ring test when resume back.

Best Regards

Rex

________________________________
From: S, Shirish
Sent: Friday, August 10, 2018 2:15 PM
To: Deucher, Alexander; Zhu, Rex; Liu, Leo
Cc: [email protected]; S, Shirish
Subject: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

This patch adds a mechanism by which the VCE 3.0 block shall check if it was enabled or in use before suspending, if it was powergated while entering suspend then there is no need to repeat it in vce_3_0_suspend(). Similarly, if the block was powergated while entering suspend itself then there is no need to resume it.

By this we not only make the suspend and resume sequence more efficient, but also optimize the overall amdgpu suspend and resume time by reducing the ring intialize and tests for unused IP blocks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 07924d4..aa85063 100644
@@ -1035,6 +1035,8 @@ struct amdgpu_device {
 
         /* vce */
         struct amdgpu_vce               vce;
+       bool                            is_vce_pg;
+       bool                            is_vce_disabled;
 
         /* vcn */
         struct amdgpu_vcn               vcn;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +21 -0
index cc6ce6c..822cfd6 100644
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = false;
         return 0;
 }
 
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = true;
         return 0;
 }
 
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with suspend sequence only if VCE is started
+        * Mark the block as being disabled if its stopped.
+        */
+       if (adev->is_vce_pg) {
+               DRM_DEBUG("VCE is already powergated, not suspending\n");
+               adev->is_vce_disabled = true;
+               return 0;
+       }
+
+       adev->is_vce_disabled = false;
+
         r = vce_v3_0_hw_fini(adev);
         if (r)
                 return r;
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with resume sequence if VCE was enabled
+        * while suspending.
+        */
+       if (adev->is_vce_disabled) {
+               DRM_DEBUG("VCE is powergated, not resuming the block\n");
+               return 0;
+       }
+
         r = amdgpu_vce_resume(adev);
         if (r)
                 return r;

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BYAPR12MB27913CFE94C60FE8A6BB435C99240-ZGDeBxoHBPmJmDmz9lrjRAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#6 lore raw

Fix typo throw() to thaw().

Thanks
JimQu

________________________________________
发件人: Qu, Jim
发送时间: 2018年8月10日 14:55:09
收件人: Zhu, Rex; S, Shirish; Deucher, Alexander; Liu, Leo
抄送: [email protected]
主题: 答复: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

There are ASIC reset/ASIC resume during S4 freeze()/throw() process, I am afraid there may be some problem for ring/ib test.

It should be more test to confirm it.

Thanks
JimQu

________________________________________
发件人: amd-gfx <[email protected]> 代表 Zhu, Rex <[email protected]> 发送时间: 2018年8月10日 14:32:36
收件人: S, Shirish; Deucher, Alexander; Liu, Leo
抄送: [email protected]
主题: Re: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

I am Ok with the check when call vce_v3_0_hw_fini.

But we may still need to call amdpug_vce_suspend/resume.

and not sure whether need to do ring test when resume back.

Best Regards

Rex

________________________________
From: S, Shirish
Sent: Friday, August 10, 2018 2:15 PM
To: Deucher, Alexander; Zhu, Rex; Liu, Leo
Cc: [email protected]; S, Shirish
Subject: [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated

This patch adds a mechanism by which the VCE 3.0 block shall check if it was enabled or in use before suspending, if it was powergated while entering suspend then there is no need to repeat it in vce_3_0_suspend(). Similarly, if the block was powergated while entering suspend itself then there is no need to resume it.

By this we not only make the suspend and resume sequence more efficient, but also optimize the overall amdgpu suspend and resume time by reducing the ring intialize and tests for unused IP blocks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  2 ++
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 07924d4..aa85063 100644
@@ -1035,6 +1035,8 @@ struct amdgpu_device {
 
         /* vce */
         struct amdgpu_vce               vce;
+       bool                            is_vce_pg;
+       bool                            is_vce_disabled;
 
         /* vcn */
         struct amdgpu_vcn               vcn;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +21 -0
index cc6ce6c..822cfd6 100644
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = false;
         return 0;
 }
 
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct amdgpu_device *adev)
         WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = true;
         return 0;
 }
 
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with suspend sequence only if VCE is started
+        * Mark the block as being disabled if its stopped.
+        */
+       if (adev->is_vce_pg) {
+               DRM_DEBUG("VCE is already powergated, not suspending\n");
+               adev->is_vce_disabled = true;
+               return 0;
+       }
+
+       adev->is_vce_disabled = false;
+
         r = vce_v3_0_hw_fini(adev);
         if (r)
                 return r;
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void *handle)
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with resume sequence if VCE was enabled
+        * while suspending.
+        */
+       if (adev->is_vce_disabled) {
+               DRM_DEBUG("VCE is powergated, not resuming the block\n");
+               return 0;
+       }
+
         r = amdgpu_vce_resume(adev);
         if (r)
                 return r;

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw
In reply to a message not in the archive
Quoted 6 lines · Rex

I am Ok with the check when call vce_v3_0_hw_fini.

But we may still need to call amdpug_vce_suspend/resume.

Done in V2. Have moved the check such that both are executed. Regards,
Shirish S

Quoted 102 lines

and not sure whether need to do ring test when resume back.

Best Regards

Rex

------------------------------------------------------------------------
*From:* S, Shirish
*Sent:* Friday, August 10, 2018 2:15 PM
*To:* Deucher, Alexander; Zhu, Rex; Liu, Leo
*Cc:* [email protected]; S, Shirish *Subject:* [PATCH] drm/amdpu/vce_v3: skip suspend and resume if powergated This patch adds a mechanism by which the VCE 3.0 block
shall check if it was enabled or in use before suspending,
if it was powergated while entering suspend then there
is no need to repeat it in vce_3_0_suspend().
Similarly, if the block was powergated while entering suspend itself then there is no need to resume it.

By this we not only make the suspend and resume sequence more efficient, but also optimize the overall amdgpu suspend and resume time by reducing the ring intialize and tests for unused IP blocks.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  2 ++ drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 21 +++++++++++++++++++++

 2 files changed, 23 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 07924d4..aa85063 100644
@@ -1035,6 +1035,8 @@ struct amdgpu_device {
 
          /* vce */
          struct amdgpu_vce               vce;
+       bool                            is_vce_pg;
+       bool is_vce_disabled;
 
          /* vcn */
          struct amdgpu_vcn               vcn;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +21 -0
index cc6ce6c..822cfd6 100644
@@ -326,6 +326,7 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
          WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
          mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = false;
          return 0;
  }
 
@@ -355,6 +356,7 @@ static int vce_v3_0_stop(struct amdgpu_device *adev)
          WREG32(mmGRBM_GFX_INDEX, mmGRBM_GFX_INDEX_DEFAULT);
          mutex_unlock(&adev->grbm_idx_mutex);
 
+       adev->is_vce_pg = true;
          return 0;
  }
 
@@ -506,6 +508,17 @@ static int vce_v3_0_suspend(void *handle)
          int r;
          struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with suspend sequence only if VCE is started
+        * Mark the block as being disabled if its stopped.
+        */
+       if (adev->is_vce_pg) {
+               DRM_DEBUG("VCE is already powergated, not suspending\n");
+               adev->is_vce_disabled = true;
+               return 0;
+       }
+
+       adev->is_vce_disabled = false;
+
          r = vce_v3_0_hw_fini(adev);
          if (r)
                  return r;
@@ -518,6 +531,14 @@ static int vce_v3_0_resume(void *handle)
          int r;
          struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /* Proceed with resume sequence if VCE was enabled
+        * while suspending.
+        */
+       if (adev->is_vce_disabled) {
+               DRM_DEBUG("VCE is powergated, not resuming the block\n");
+               return 0;
+       }
+
          r = amdgpu_vce_resume(adev);
          if (r)
                  return r;
Signature · 1 line
2.7.4
Signature · 2 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx