Skip to contentSkip to conversation

drm/amd/display: explicitly update clocks when DC is set to D3 in s0i3

PATCH In review Mario Limonciello 3 participants 5 messages Jan 5, 2022 – Jan 7, 2022

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

PATCH v2 1/1 drm/amd/display: explicitly update clocks when DC is set to D3 in s0i3

The WA from commit 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD") causes a regression in s0ix where the system will fail to resume properly. This may be because an HPD was active the last time clocks were updated but clocks didn't get updated again during s0ix.

So add an extra call to update clocks as part of the suspend routine:
dm_suspend->dc_set_power_state->clk_mgr_optimize_pwr_state

In case HPD is set during this time, also check if the call happened during suspend to allow overriding the WA.

Cc Qingqing Zhuo <[email protected]>
Reported-by [email protected]
Fixes 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD")
Fixes 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to dcn20")

---
changes from v1->v2:
* Add fallthrough statement
* Extend case to check if call was explicitly in s0ix since #1852 showed hpd_state can be set at this time too
* Adjust commit message and title
* Add extra commit and bug fixed to metadata

 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc.c                  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +4 -1
index fbda42313bfe..fa5efe10b779 100644
@@ -23,6 +23,8 @@
  *
  */
 
+#include "amdgpu.h"
+
 #include "dccg.h"
 #include "clk_mgr_internal.h"
 
@@ -126,6 +128,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			bool safe_to_lower)
 {
 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	struct amdgpu_device *adev = clk_mgr_base->ctx->driver_context;
 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
 	struct dc *dc = clk_mgr_base->ctx->dc;
 	int display_count;
@@ -157,7 +160,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			}
 
 			/* if we can go lower, go lower */
-			if (display_count == 0 && !hpd_state) {
+			if (display_count == 0 && (adev->in_s0ix || !hpd_state)) {
 				rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER);
 				/* update power state */
 				clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
index 91c4874473d6..8e0c820f6892 100644
@@ -3299,6 +3299,9 @@ void dc_set_power_state(
 		}
 
 		break;
+	case DC_ACPI_CM_POWER_STATE_D3:
+		clk_mgr_optimize_pwr_state(dc, dc->clk_mgr);
+		fallthrough;
 	default:
 		ASSERT(dc->current_state->stream_count == 0);
 		/* Zero out the current context so that on resume we start with
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 46 lines · Mario Limonciello

The WA from commit 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD") causes a regression in s0ix where the system will fail to resume properly. This may be because an HPD was active the last time clocks were updated but clocks didn't get updated again during s0ix.

So add an extra call to update clocks as part of the suspend routine:
dm_suspend->dc_set_power_state->clk_mgr_optimize_pwr_state

In case HPD is set during this time, also check if the call happened during suspend to allow overriding the WA.

Cc Qingqing Zhuo <[email protected]>
Reported-by [email protected]
Fixes 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD")
Fixes 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to dcn20")

---
changes from v1->v2:
* Add fallthrough statement
* Extend case to check if call was explicitly in s0ix since #1852 showed hpd_state can be set at this time too
* Adjust commit message and title
* Add extra commit and bug fixed to metadata

 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc.c                  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +2 -0
index fbda42313bfe..fa5efe10b779 100644
@@ -23,6 +23,8 @@
  *
  */
 
+#include "amdgpu.h"
+
 #include "dccg.h"
 #include "clk_mgr_internal.h"
 

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base, · line 131

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -0
@@ -126,6 +128,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			bool safe_to_lower)
 {
 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	struct amdgpu_device *adev = clk_mgr_base->ctx->driver_context;

DC code is shared on other OSes. driver_context won't be an instance of amdgpu_device in those cases.

If we need adev->in_s0ix we need to find a way to plumb it through DC structs and interfaces.

Harry

Quoted 26 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -1
 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
 	struct dc *dc = clk_mgr_base->ctx->dc;
 	int display_count;
@@ -157,7 +160,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			}
 
 			/* if we can go lower, go lower */
-			if (display_count == 0 && !hpd_state) {
+			if (display_count == 0 && (adev->in_s0ix || !hpd_state)) {
 				rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER);
 				/* update power state */
 				clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
index 91c4874473d6..8e0c820f6892 100644
@@ -3299,6 +3299,9 @@ void dc_set_power_state(
 		}
 
 		break;
+	case DC_ACPI_CM_POWER_STATE_D3:
+		clk_mgr_optimize_pwr_state(dc, dc->clk_mgr);
+		fallthrough;
 	default:
 		ASSERT(dc->current_state->stream_count == 0);
 		/* Zero out the current context so that on resume we start with
#2 lore raw

[Public]

Quoted 65 lines

-----Original Message-----
From: Wentland, Harry <[email protected]>
Sent: Wednesday, January 5, 2022 15:26
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Cc: Zhuo, Qingqing (Lillian) <[email protected]>; Scott Bruce <[email protected]>; Chris Hixon <[email protected]>; [email protected]
Subject: Re: [PATCH v2] drm/amd/display: explicitly update clocks when DC is set to D3 in s0i3

Quoted 11 lines · Mario Limonciello

The WA from commit 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD") causes a regression in s0ix where the system will fail to resume properly. This may be because an HPD was active the last time clocks were updated but clocks didn't get updated again during s0ix.

So add an extra call to update clocks as part of the suspend routine:
dm_suspend->dc_set_power_state->clk_mgr_optimize_pwr_state

In case HPD is set during this time, also check if the call happened during suspend to allow overriding the WA.

Quoted 9 lines
Cc Qingqing Zhuo <[email protected]>
Reported-by [email protected]
Fixes 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD")
Fixes 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to

dcn20")

Quoted 5 lines

---
changes from v1->v2:
* Add fallthrough statement
* Extend case to check if call was explicitly in s0ix since #1852 showed

hpd_state

Review

Quoted 8 lines

can be set at this time too
* Adjust commit message and title
* Add extra commit and bug fixed to metadata

 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc.c                  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr

Quoted 13 lines

index fbda42313bfe..fa5efe10b779 100644

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +2 -0
@@ -23,6 +23,8 @@
  *
  */
 
+#include "amdgpu.h"
+
 #include "dccg.h"
 #include "clk_mgr_internal.h"
 
@@ -126,6 +128,7 @@ static void rn_update_clocks(struct clk_mgr

*clk_mgr_base,

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base,

Quoted 3 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +0 -0
 			bool safe_to_lower)
 {
 	struct clk_mgr_internal *clk_mgr =
Quoted 9 lines

TO_CLK_MGR_INTERNAL(clk_mgr_base);

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base, · line 131

Quoted 1 line
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -0
+	struct amdgpu_device *adev = clk_mgr_base->ctx->driver_context;

DC code is shared on other OSes. driver_context won't be an instance of amdgpu_device in those cases.

If we need adev->in_s0ix we need to find a way to plumb it through DC structs and interfaces.

OK. I'll see what that takes to do. I was hoping the original version would have sufficed but Chris (on CC) had reported that hpd_state was still active When this was called again during the suspend context.

<snip>

Jan 05 15:39:08.562580 kernel: kauditd_printk_skb: 35 callbacks suppressed
Jan 05 15:43:54.575923 kernel: wlo1: deauthenticating from ZZ:ZZ:ZZ:ZZ:ZZ:ZZ by local choice (Reason: 3=DEAUTH_LEAVING)
Jan 05 15:43:54.699223 kernel: amdgpu 0000:04:00.0: amdgpu: [rn_update_clocks] display count: 0, in_s0ix: 0, hpd_state: 0
Jan 05 15:43:55.922674 kernel: amdgpu 0000:04:00.0: amdgpu: [rn_update_clocks] display count: 1, in_s0ix: 0, hpd_state: 1
Jan 05 15:43:55.979221 kernel: rfkill: input handler enabled
Jan 05 15:43:57.712689 kernel: PM: suspend entry (s2idle)
Jan 05 15:44:07.302069 kernel: Filesystems sync: 0.008 seconds
Jan 05 15:44:07.302256 kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
Jan 05 15:44:07.302306 kernel: OOM killer disabled.
Jan 05 15:44:07.302344 kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Jan 05 15:44:07.302378 kernel: printk: Suspending console(s) (use no_console_suspend to debug)
Jan 05 15:44:07.302416 kernel: amdgpu 0000:04:00.0: amdgpu: [rn_update_clocks] display count: 0, in_s0ix: 1, hpd_state: 1

</snip>

So I suppose the other question to ask though - why is that hpd interrupt still active? Shouldn't it have been suspended by then? @Zhuo, Qingqing (Lillian) Maybe some other code is needed to suspend it on the way down?

It was for [email protected] (which is why I had the simpler version of the patch for v1).

Quoted 34 lines

Harry

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +0 -0
 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
 	struct dc *dc = clk_mgr_base->ctx->dc;
 	int display_count;
@@ -157,7 +160,7 @@ static void rn_update_clocks(struct clk_mgr

*clk_mgr_base,

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base,

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -1
 			}
 
 			/* if we can go lower, go lower */
-			if (display_count == 0 && !hpd_state) {
+			if (display_count == 0 && (adev->in_s0ix || !hpd_state))

{

Quoted 1 line

rn_vbios_smu_set_dcn_low_power_state(clk_mgr,
DCN_PWR_STATE_LOW_POWER);

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +0 -0
 				/* update power state */
 				clk_mgr_base->clks.pwr_state =

DCN_PWR_STATE_LOW_POWER;

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/core/dc.c

Quoted 13 lines

index 91c4874473d6..8e0c820f6892 100644

drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
@@ -3299,6 +3299,9 @@ void dc_set_power_state(
 		}
 
 		break;
+	case DC_ACPI_CM_POWER_STATE_D3:
+		clk_mgr_optimize_pwr_state(dc, dc->clk_mgr);
+		fallthrough;
 	default:
 		ASSERT(dc->current_state->stream_count == 0);
 		/* Zero out the current context so that on resume we start with
#3 lore raw
In reply to Mario Limonciello

Hi, this is your Linux kernel regression tracker speaking.

Quoted 10 lines · Mario Limonciello

The WA from commit 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD") causes a regression in s0ix where the system will fail to resume properly. This may be because an HPD was active the last time clocks were updated but clocks didn't get updated again during s0ix.

So add an extra call to update clocks as part of the suspend routine:
dm_suspend->dc_set_power_state->clk_mgr_optimize_pwr_state

In case HPD is set during this time, also check if the call happened during suspend to allow overriding the WA.

Thx for this. Our of interest: is that something that should still go into v5.16?

Quoted 7 lines

What is "BugLink"? It's not mention in the kernel's documentation, which tells people to use "Link:" for linking to bug reports:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

That is not new, bug recently was made more explicit.

Hence, please consider changing them to "Link:", there are tools out there that repy on them (I'm running such a tool, but there might be others out there we are not aware of).

FWIW, in principe I agree that we need a seperate tag for this. But then we should get this discussed and blessed through the usual channels. That's why I recently proposed "Reported:", without much success so far:
https://lore.kernel.org/lkml/c6724c7fb534a46e095e6aef13d996ed9589e578.1639042966.git.linux@leemhuis.info/

Ciao, Thorsten

Quoted 58 lines
Fixes 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD")
Fixes 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to dcn20")

---
changes from v1->v2:
* Add fallthrough statement
* Extend case to check if call was explicitly in s0ix since #1852 showed hpd_state can be set at this time too
* Adjust commit message and title
* Add extra commit and bug fixed to metadata

 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc.c                  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +4 -1
index fbda42313bfe..fa5efe10b779 100644
@@ -23,6 +23,8 @@
  *
  */
 
+#include "amdgpu.h"
+
 #include "dccg.h"
 #include "clk_mgr_internal.h"
 
@@ -126,6 +128,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			bool safe_to_lower)
 {
 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	struct amdgpu_device *adev = clk_mgr_base->ctx->driver_context;
 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
 	struct dc *dc = clk_mgr_base->ctx->dc;
 	int display_count;
@@ -157,7 +160,7 @@ static void rn_update_clocks(struct clk_mgr *clk_mgr_base,
 			}
 
 			/* if we can go lower, go lower */
-			if (display_count == 0 && !hpd_state) {
+			if (display_count == 0 && (adev->in_s0ix || !hpd_state)) {
 				rn_vbios_smu_set_dcn_low_power_state(clk_mgr, DCN_PWR_STATE_LOW_POWER);
 				/* update power state */
 				clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER;
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
index 91c4874473d6..8e0c820f6892 100644
@@ -3299,6 +3299,9 @@ void dc_set_power_state(
 		}
 
 		break;
+	case DC_ACPI_CM_POWER_STATE_D3:
+		clk_mgr_optimize_pwr_state(dc, dc->clk_mgr);
+		fallthrough;
 	default:
 		ASSERT(dc->current_state->stream_count == 0);
 		/* Zero out the current context so that on resume we start with
#4 lore raw

[Public]

Quoted 19 lines

-----Original Message-----
From: Thorsten Leemhuis <[email protected]>
Sent: Thursday, January 6, 2022 05:39
To: Limonciello, Mario <[email protected]>; amd- [email protected]
Cc: Zhuo, Qingqing (Lillian) <[email protected]>; Scott Bruce <[email protected]>; Chris Hixon <[email protected]>; [email protected]
Subject: Re: [PATCH v2] drm/amd/display: explicitly update clocks when DC is set to D3 in s0i3

Hi, this is your Linux kernel regression tracker speaking.

Quoted 5 lines · Mario Limonciello

The WA from commit 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD") causes a regression in s0ix where the system will fail to resume properly. This may be because an HPD was active the last time clocks were updated but clocks didn't get updated again during s0ix.

Quoted 8 lines
Quoted 5 lines

So add an extra call to update clocks as part of the suspend routine:
dm_suspend->dc_set_power_state->clk_mgr_optimize_pwr_state

In case HPD is set during this time, also check if the call happened during suspend to allow overriding the WA.

Thx for this. Our of interest: is that something that should still go into v5.16?

Not in v2. There were review comments that led to creating a V3. Once V3 is reviewed if there is time remaining, yes. If not, then it will be a great candidate for 5.16.1.

Quoted 43 lines
Quoted 6 lines

BugLink:

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.
kernel.org%2Fshow_bug.cgi%3Fid%3D215436&amp;data=04%7C01%7Cmario.li monciello%40amd.com%7C024b889dd8af440abbb008d9d1091f27%7C3dd8961f e4884e608e11a82d994e183d%7C0%7C0%7C637770660416166334%7CUnknow n%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW wiLCJXVCI6Mn0%3D%7C3000&amp;sdata=rzNDgWba05cL5Z6CTvlblJS96R%2F1 8Vh7ku0S%2FQTRbHQ%3D&amp;reserved=0

Quoted 1 line

BugLink:

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.fr
eedesktop.org%2Fdrm%2Famd%2F- %2Fissues%2F1821&amp;data=04%7C01%7Cmario.limonciello%40amd.com%7 C024b889dd8af440abbb008d9d1091f27%7C3dd8961fe4884e608e11a82d994e1 83d%7C0%7C0%7C637770660416166334%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 3000&amp;sdata=TQW1vagoGW1DdNvsTVFKlA7gdJVvWhnxZU6BZPn3MH4%3D &amp;reserved=0

Quoted 1 line

BugLink:

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.fr
eedesktop.org%2Fdrm%2Famd%2F- %2Fissues%2F1852&amp;data=04%7C01%7Cmario.limonciello%40amd.com%7 C024b889dd8af440abbb008d9d1091f27%7C3dd8961fe4884e608e11a82d994e1 83d%7C0%7C0%7C637770660416166334%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 3000&amp;sdata=N4C5PRnke4%2Bpswb3oAMhNsPq3AMLK5VuJG7Ht%2F1n0jk %3D&amp;reserved=0

What is "BugLink"? It's not mention in the kernel's documentation, which tells people to use "Link:" for linking to bug reports:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ke
rnel.org%2Fdoc%2Fhtml%2Flatest%2Fprocess%2Fsubmitting- patches.html&amp;data=04%7C01%7Cmario.limonciello%40amd.com%7C024b 889dd8af440abbb008d9d1091f27%7C3dd8961fe4884e608e11a82d994e183d%7 C0%7C0%7C637770660416166334%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC 4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a mp;sdata=GntDRw3WuCUZ%2Fys9uDAltqDs2zsBR4qQm3KdDA3VBKo%3D&amp; reserved=0

Quoted 5 lines

That is not new, bug recently was made more explicit.

Hence, please consider changing them to "Link:", there are tools out there that repy on them (I'm running such a tool, but there might be others out there we are not aware of).

Thanks for enlightening me. If I need to spin for v4 I'll fix it up on next submission, otherwise I'll fix it up v3 manually before it goes into amd-staging-drm-next.

Quoted 12 lines

FWIW, in principe I agree that we need a seperate tag for this. But then we should get this discussed and blessed through the usual channels. That's why I recently proposed "Reported:", without much success so far:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
nel.org%2Flkml%2Fc6724c7fb534a46e095e6aef13d996ed9589e578.163904296 6.git.linux%40leemhuis.info%2F&amp;data=04%7C01%7Cmario.limonciello%40 amd.com%7C024b889dd8af440abbb008d9d1091f27%7C3dd8961fe4884e608e1 1a82d994e183d%7C0%7C0%7C637770660416166334%7CUnknown%7CTWFpb GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M n0%3D%7C3000&amp;sdata=oBGtPqXfzBcn%2FqUrH7hDQtMIXwIKBY6xh3Qqd0 xkRjg%3D&amp;reserved=0

At least some distributions kernel teams use BugLink (presumably from their own tools).

Quoted 72 lines

Ciao, Thorsten

Quoted 2 lines
Fixes 5965280abd30 ("drm/amd/display: Apply w/a for hard hang on HPD")
Fixes 1bd3bc745e7f ("drm/amd/display: Extend w/a for hard hang on HPD to

dcn20")

Quoted 5 lines

---
changes from v1->v2:
* Add fallthrough statement
* Extend case to check if call was explicitly in s0ix since #1852 showed

hpd_state

Review

Quoted 8 lines

can be set at this time too
* Adjust commit message and title
* Add extra commit and bug fixed to metadata

 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 5 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc.c                  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr

Quoted 13 lines

index fbda42313bfe..fa5efe10b779 100644

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +2 -0
@@ -23,6 +23,8 @@
  *
  */
 
+#include "amdgpu.h"
+
 #include "dccg.h"
 #include "clk_mgr_internal.h"
 
@@ -126,6 +128,7 @@ static void rn_update_clocks(struct clk_mgr

*clk_mgr_base,

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base,

Quoted 3 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +0 -0
 			bool safe_to_lower)
 {
 	struct clk_mgr_internal *clk_mgr =

TO_CLK_MGR_INTERNAL(clk_mgr_base);

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -0
+	struct amdgpu_device *adev = clk_mgr_base->ctx->driver_context;
 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
 	struct dc *dc = clk_mgr_base->ctx->dc;
 	int display_count;
@@ -157,7 +160,7 @@ static void rn_update_clocks(struct clk_mgr

*clk_mgr_base,

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c static void rn_update_clocks(struct clk_mgr *clk_mgr_base,

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -1
 			}
 
 			/* if we can go lower, go lower */
-			if (display_count == 0 && !hpd_state) {
+			if (display_count == 0 && (adev->in_s0ix || !hpd_state))

{

Quoted 1 line

rn_vbios_smu_set_dcn_low_power_state(clk_mgr,
DCN_PWR_STATE_LOW_POWER);

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +0 -0
 				/* update power state */
 				clk_mgr_base->clks.pwr_state =

DCN_PWR_STATE_LOW_POWER;

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/display/dc/core/dc.c

Quoted 13 lines

index 91c4874473d6..8e0c820f6892 100644

drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
@@ -3299,6 +3299,9 @@ void dc_set_power_state(
 		}
 
 		break;
+	case DC_ACPI_CM_POWER_STATE_D3:
+		clk_mgr_optimize_pwr_state(dc, dc->clk_mgr);
+		fallthrough;
 	default:
 		ASSERT(dc->current_state->stream_count == 0);
 		/* Zero out the current context so that on resume we start with