All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
@ 2018-10-16  5:33 Rex Zhu
       [not found] ` <1539668026-4854-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Rex Zhu @ 2018-10-16  5:33 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, alexander.deucher-5C7GfCeVMHo
  Cc: Rex Zhu

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
 
 	for (j = 0; j < adev->num_ip_blocks; j++) {
 		i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+		/* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+		if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+		    adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+		    adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+		    adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+		    adev->ip_blocks[i].version->funcs->set_powergating_state) {
+			if (!adev->ip_blocks[i].status.valid) {
+				r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+											state);
+				if (r) {
+					DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+					  adev->ip_blocks[i].version->funcs->name, r);
+					return r;
+				}
+			}
+		}
+
 		if (!adev->ip_blocks[i].status.late_initialized)
 			continue;
 		/* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
 			}
 		}
 	}
+
 	return 0;
 }
 
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found] ` <1539668026-4854-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-10-16 14:43   ` Deucher, Alexander
       [not found]     ` <BN6PR12MB1809AE48F3B1FD9CCB1DEFA0F7FE0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Deucher, Alexander @ 2018-10-16 14:43 UTC (permalink / raw)
  To: Zhu, Rex, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 2977 bytes --]

Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 7262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found]     ` <BN6PR12MB1809AE48F3B1FD9CCB1DEFA0F7FE0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-10-16 17:12       ` S, Shirish
       [not found]         ` <BLUPR12MB0452631CCD03B605244486CFF2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: S, Shirish @ 2018-10-16 17:12 UTC (permalink / raw)
  To: Deucher, Alexander, Zhu, Rex, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 5161 bytes --]

This patch fails on the very first resume as below:
[   53.632732] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   54.653212] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   55.673692] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   56.694203] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   57.714683] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   58.735164] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   59.755643] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   60.776124] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   61.796608] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.817092] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.837108] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, giving up!!!
[   62.837112] Power gating vce_v3_0 failed
[   62.837118] [drm:amdgpu_device_ip_suspend_phase1] *ERROR* set_powergating_state(gate) of IP block <vce_v3_0> failed -110

I believe there is some more work left to be done with it.

Regards,
Shirish S

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Deucher, Alexander
Sent: Tuesday, October 16, 2018 9:44 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user


Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org<mailto:alexander.deucher-5C7GfCeVMHo@public.gmane.org>>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 12269 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found]         ` <BLUPR12MB0452631CCD03B605244486CFF2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-10-16 17:14           ` Zhu, Rex
       [not found]             ` <BYAPR12MB27751B1475028EAE09DD4E84FBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Zhu, Rex @ 2018-10-16 17:14 UTC (permalink / raw)
  To: S, Shirish, Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 5698 bytes --]

Do you test based on drm-next branch?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:12 AM
To: Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>; Zhu, Rex <Rex.Zhu@amd.com>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

This patch fails on the very first resume as below:
[   53.632732] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   54.653212] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   55.673692] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   56.694203] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   57.714683] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   58.735164] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   59.755643] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   60.776124] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   61.796608] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.817092] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.837108] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, giving up!!!
[   62.837112] Power gating vce_v3_0 failed
[   62.837118] [drm:amdgpu_device_ip_suspend_phase1] *ERROR* set_powergating_state(gate) of IP block <vce_v3_0> failed -110

I believe there is some more work left to be done with it.

Regards,
Shirish S

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Deucher, Alexander
Sent: Tuesday, October 16, 2018 9:44 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx-PD4FTy7X32mMSPqsTGOZug@public.gmane.orgesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user


Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org<mailto:alexander.deucher-5C7GfCeVMHo@public.gmane.org>>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 13644 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found]             ` <BYAPR12MB27751B1475028EAE09DD4E84FBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-10-16 17:25               ` S, Shirish
       [not found]                 ` <BLUPR12MB045259BF2DFB784D669B3189F2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: S, Shirish @ 2018-10-16 17:25 UTC (permalink / raw)
  To: Zhu, Rex, Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 6251 bytes --]

Nope, I have just cherry-picked this patch.
Is there any dependency?

Regards,
Shirish S

From: Zhu, Rex
Sent: Tuesday, October 16, 2018 12:15 PM
To: S, Shirish <Shirish.S-5C7GfCeVMHo@public.gmane.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Do you test based on drm-next branch?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:12 AM
To: Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher@amd.com>>; Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

This patch fails on the very first resume as below:
[   53.632732] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   54.653212] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   55.673692] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   56.694203] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   57.714683] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   58.735164] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   59.755643] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   60.776124] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   61.796608] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.817092] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.837108] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, giving up!!!
[   62.837112] Power gating vce_v3_0 failed
[   62.837118] [drm:amdgpu_device_ip_suspend_phase1] *ERROR* set_powergating_state(gate) of IP block <vce_v3_0> failed -110

I believe there is some more work left to be done with it.

Regards,
Shirish S

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Deucher, Alexander
Sent: Tuesday, October 16, 2018 9:44 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx-PD4FTy7X32mMSPqsTGOZug@public.gmane.orgesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user


Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org<mailto:alexander.deucher-5C7GfCeVMHo@public.gmane.org>>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 14947 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found]                 ` <BLUPR12MB045259BF2DFB784D669B3189F2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-10-16 17:28                   ` Zhu, Rex
       [not found]                     ` <BYAPR12MB27755045315022D06DCC17EEFBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Zhu, Rex @ 2018-10-16 17:28 UTC (permalink / raw)
  To: S, Shirish, Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 6835 bytes --]

The code base is different.
And do you set ip_block_mask = 0xeff to diable vce?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:25 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Nope, I have just cherry-picked this patch.
Is there any dependency?

Regards,
Shirish S

From: Zhu, Rex
Sent: Tuesday, October 16, 2018 12:15 PM
To: S, Shirish <Shirish.S-5C7GfCeVMHo@public.gmane.org<mailto:Shirish.S-5C7GfCeVMHo@public.gmane.org>>; Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Do you test based on drm-next branch?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:12 AM
To: Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher@amd.com>>; Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

This patch fails on the very first resume as below:
[   53.632732] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   54.653212] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   55.673692] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   56.694203] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   57.714683] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   58.735164] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   59.755643] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   60.776124] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   61.796608] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.817092] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.837108] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, giving up!!!
[   62.837112] Power gating vce_v3_0 failed
[   62.837118] [drm:amdgpu_device_ip_suspend_phase1] *ERROR* set_powergating_state(gate) of IP block <vce_v3_0> failed -110

I believe there is some more work left to be done with it.

Regards,
Shirish S

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Deucher, Alexander
Sent: Tuesday, October 16, 2018 9:44 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx-PD4FTy7X32mMSPqsTGOZug@public.gmane.orgesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user


Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org<mailto:alexander.deucher-5C7GfCeVMHo@public.gmane.org>>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 16342 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user
       [not found]                     ` <BYAPR12MB27755045315022D06DCC17EEFBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-10-16 17:31                       ` S, Shirish
  0 siblings, 0 replies; 7+ messages in thread
From: S, Shirish @ 2018-10-16 17:31 UTC (permalink / raw)
  To: Zhu, Rex, Deucher, Alexander, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 7377 bytes --]

Yes.
Is there any dependant patches?

Regards,
Shirish S

From: Zhu, Rex
Sent: Tuesday, October 16, 2018 12:29 PM
To: S, Shirish <Shirish.S-5C7GfCeVMHo@public.gmane.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

The code base is different.
And do you set ip_block_mask = 0xeff to diable vce?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:25 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Nope, I have just cherry-picked this patch.
Is there any dependency?

Regards,
Shirish S

From: Zhu, Rex
Sent: Tuesday, October 16, 2018 12:15 PM
To: S, Shirish <Shirish.S-5C7GfCeVMHo@public.gmane.org<mailto:Shirish.S-5C7GfCeVMHo@public.gmane.org>>; Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

Do you test based on drm-next branch?

Best Regards
Rex

From: S, Shirish
Sent: Wednesday, October 17, 2018 1:12 AM
To: Deucher, Alexander <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org<mailto:Alexander.Deucher@amd.com>>; Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx@lists.freedesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: RE: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

This patch fails on the very first resume as below:
[   53.632732] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   54.653212] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   55.673692] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   56.694203] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   57.714683] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   58.735164] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   59.755643] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   60.776124] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   61.796608] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.817092] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, trying to reset the ECPU!!!
[   62.837108] [drm:vce_v3_0_set_powergating_state] *ERROR* VCE not responding, giving up!!!
[   62.837112] Power gating vce_v3_0 failed
[   62.837118] [drm:amdgpu_device_ip_suspend_phase1] *ERROR* set_powergating_state(gate) of IP block <vce_v3_0> failed -110

I believe there is some more work left to be done with it.

Regards,
Shirish S

From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> On Behalf Of Deucher, Alexander
Sent: Tuesday, October 16, 2018 9:44 AM
To: Zhu, Rex <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>; amd-gfx-PD4FTy7X32mMSPqsTGOZug@public.gmane.orgesktop.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user


Reviewed-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org<mailto:alexander.deucher-5C7GfCeVMHo@public.gmane.org>>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-bounces@lists.freedesktop.org>> on behalf of Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
Sent: Tuesday, October 16, 2018 1:33:46 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user

If user disable uvd/vce/vcn/acp blocks via module
parameter ip_block_mask,
driver power off thoser blocks to save power.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org<mailto:Rex.Zhu-5C7GfCeVMHo@public.gmane.org>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1e4dd09..3ffee08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1774,6 +1774,24 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power

         for (j = 0; j < adev->num_ip_blocks; j++) {
                 i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
+
+               /* try to power off VCE/UVD/VCN/ACP if they were disabled by user */
+               if ((adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_UVD ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCE ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_VCN ||
+                   adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_ACP) &&
+                   adev->ip_blocks[i].version->funcs->set_powergating_state) {
+                       if (!adev->ip_blocks[i].status.valid) {
+                               r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
+                                                                                       state);
+                               if (r) {
+                                       DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                                       return r;
+                               }
+                       }
+               }
+
                 if (!adev->ip_blocks[i].status.late_initialized)
                         continue;
                 /* skip CG for VCE/UVD, it's handled specially */
@@ -1791,6 +1809,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
                         }
                 }
         }
+
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 17361 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-10-16 17:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16  5:33 [PATCH] drm/amdgpu: Poweroff uvd/vce/vcn/acp block if they were disabled by user Rex Zhu
     [not found] ` <1539668026-4854-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-10-16 14:43   ` Deucher, Alexander
     [not found]     ` <BN6PR12MB1809AE48F3B1FD9CCB1DEFA0F7FE0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-16 17:12       ` S, Shirish
     [not found]         ` <BLUPR12MB0452631CCD03B605244486CFF2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-16 17:14           ` Zhu, Rex
     [not found]             ` <BYAPR12MB27751B1475028EAE09DD4E84FBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-16 17:25               ` S, Shirish
     [not found]                 ` <BLUPR12MB045259BF2DFB784D669B3189F2FE0-7LeqcoF/hwohIaQXubWUmgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-16 17:28                   ` Zhu, Rex
     [not found]                     ` <BYAPR12MB27755045315022D06DCC17EEFBFE0-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-10-16 17:31                       ` S, Shirish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.