Skip to contentSkip to conversation

drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

PATCH In review Prike Liang 3 participants 7 messages Apr 25, 2022 – Apr 27, 2022

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

PATCH 1/1 drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +10 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int gmc_v10_0_set_clockgating_state(void *handle,
 	int r;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+	/*
+	 * The issue mmhub can't disconnect from DF with MMHUB clock gating being disabled
+	 * is a new problem observed at DF 3.0.3, however with the same suspend sequence not
+	 * seen any issue on the DF 3.0.2 series platform.
+	 */
+	if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] > IP_VERSION(3, 0, 2)) {
+		dev_dbg(adev->dev, "keep mmhub clock gating being enabled for s0ix\n");
+		return 0;
+	}
+
 	r = adev->mmhub.funcs->set_clockgating(adev, state);
 	if (r)
 		return r;
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw

[Public]

________________________________
From: amd-gfx <[email protected]> on behalf of Prike Liang <[email protected]>
Sent: Monday, April 25, 2022 2:52 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Lazar, Lijo <[email protected]>; Liang, Prike <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +10 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int gmc_v10_0_set_clockgating_state(void *handle,
         int r;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       /*
+        * The issue mmhub can't disconnect from DF with MMHUB clock gating being disabled
+        * is a new problem observed at DF 3.0.3, however with the same suspend sequence not
+        * seen any issue on the DF 3.0.2 series platform.
+        */
+       if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] > IP_VERSION(3, 0, 2)) {
+               dev_dbg(adev->dev, "keep mmhub clock gating being enabled for s0ix\n");
+               return 0;
+       }
+
         r = adev->mmhub.funcs->set_clockgating(adev, state);
         if (r)
                 return r;

--
2.25.1

#2 lore raw
In reply to Prike Liang
Quoted 17 lines · Prike Liang

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int gmc_v10_0_set_clockgating_state(void *handle,
  	int r;
  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle, · line 1163

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +10 -0
+	/*
+	 * The issue mmhub can't disconnect from DF with MMHUB clock gating being disabled
+	 * is a new problem observed at DF 3.0.3, however with the same suspend sequence not
+	 * seen any issue on the DF 3.0.2 series platform.
+	 */
+	if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] > IP_VERSION(3, 0, 2)) {
+		dev_dbg(adev->dev, "keep mmhub clock gating being enabled for s0ix\n");
+		return 0;
+	}
+

This only ignores clock gating requests as long as s0ix flag is set. As far as I see, s0ix flag is set to true even during resume and set to false only after resume is completed. Is that intention and is this tested to be working fine? I suggest to keep this specifically for suspend calls.

Thanks,
Lijo

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
  	r = adev->mmhub.funcs->set_clockgating(adev, state);
  	if (r)
  		return r;
#3 lore raw

[Public]

Quoted 46 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, April 26, 2022 7:19 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void

Quoted 15 lines · Prike Liang

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int gmc_v10_0_set_clockgating_state(void

*handle,

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
    int r;
    struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+   /*
+    * The issue mmhub can't disconnect from DF with MMHUB clock

gating being disabled

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void · line 1156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
+    * is a new problem observed at DF 3.0.3, however with the same

suspend sequence not

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+    * seen any issue on the DF 3.0.2 series platform.
+    */
+   if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] > IP_VERSION(3,

0, 2)) {

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void · line 1160

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
+           dev_dbg(adev->dev, "keep mmhub clock gating being

enabled for s0ix\n");

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle, · line 1163

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+           return 0;
+   }
+
Quoted 8 lines

This only ignores clock gating requests as long as s0ix flag is set. As far as I see, s0ix flag is set to true even during resume and set to false only after resume is completed. Is that intention and is this tested to be working fine? I suggest to keep this specifically for suspend calls.

Thanks,
Lijo

It reasonable for also not reenable the clock gating on the s2ilde resume since clock gating
not disabled on the s2idle suspend. Have merged the fix for not blocking s0ix support for some
upcoming asic and meanwhile still need dig into whether the DF C-state, MMHUB DS or BIOS mmhub power gate request different on GC 10.3.7 introduce this issue and then make a generic solution for such this issue.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
    r = adev->mmhub.funcs->set_clockgating(adev, state);
    if (r)
            return r;
#4 lore raw
Quoted 53 lines · Prike

[Public]

Quoted 51 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, April 26, 2022 7:19 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void

Quoted 15 lines · Prike Liang

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
   1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int gmc_v10_0_set_clockgating_state(void

*handle,

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
     int r;
     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+   /*
+    * The issue mmhub can't disconnect from DF with MMHUB clock

gating being disabled

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void · line 1156

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
+    * is a new problem observed at DF 3.0.3, however with the same

suspend sequence not

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+    * seen any issue on the DF 3.0.2 series platform.
+    */
+   if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] > IP_VERSION(3,

0, 2)) {

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void · line 1160

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -0
+           dev_dbg(adev->dev, "keep mmhub clock gating being

enabled for s0ix\n");

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle, · line 1163

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+           return 0;
+   }
+

This only ignores clock gating requests as long as s0ix flag is set. As far as I see, s0ix flag is set to true even during resume and set to false only after resume is completed. Is that intention and is this tested to be working fine? I suggest to keep this specifically for suspend calls.

Quoted 5 lines
Quoted 3 lines

Thanks,
Lijo

It reasonable for also not reenable the clock gating on the s2ilde resume since clock gating not disabled on the s2idle suspend.

Generally, the CG setting registers are not in always-on domain and the register settings will be lost once it goes down. Not sure about the state of this particular IP rail during S0i3 cycle.

If the CG settings are driver-enabled, we reprogram CG settings during resume - amdgpu_device_resume->amdgpu_device_ip_late_init -> amdgpu_device_set_cg_state. This logic prevents this. Maybe, it works fine during your testing because it's done by FW. If the settings are programmed by FW components, usually reprogramming is taken care by FW.

Thanks,
Lijo

Have merged the fix for not blocking s0ix support for some

Quoted 6 lines

upcoming asic and meanwhile still need dig into whether the DF C-state, MMHUB DS or BIOS mmhub power gate request different on GC 10.3.7 introduce this issue and then make a generic solution for such this issue.

Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
     r = adev->mmhub.funcs->set_clockgating(adev, state);
     if (r)
             return r;
#5 lore raw

[AMD Official Use Only - General]

Quoted 78 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, April 27, 2022 2:33 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Quoted 54 lines · Prike

[Public]

Quoted 52 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, April 26, 2022 7:19 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Quoted 15 lines · Prike Liang

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
   1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int
Quoted 1 line

gmc_v10_0_set_clockgating_state(void

*handle,

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c

Quoted 5 lines
     int r;
     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
+   /*
+    * The issue mmhub can't disconnect from DF with MMHUB clock

gating being disabled

Quoted 1 line

+ * is a new problem observed at DF 3.0.3, however with the same

suspend sequence not

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +4 -0
+    * seen any issue on the DF 3.0.2 series platform.
+    */
+   if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] >
+ IP_VERSION(3,

0, 2)) {

Quoted 1 line

+ dev_dbg(adev->dev, "keep mmhub clock gating being

enabled for s0ix\n");

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle, · line 1163

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+           return 0;
+   }
+

This only ignores clock gating requests as long as s0ix flag is set. As far as I see, s0ix flag is set to true even during resume and set to false only after resume is completed. Is that intention and is this tested to be working fine? I suggest to keep this specifically for

suspend calls.

Quoted 6 lines
Quoted 4 lines

Thanks,
Lijo

It reasonable for also not reenable the clock gating on the s2ilde resume since clock gating not disabled on the s2idle suspend.

Generally, the CG setting registers are not in always-on domain and the register settings will be lost once it goes down. Not sure about the state of this particular IP rail during S0i3 cycle.

Quoted 9 lines

If the CG settings are driver-enabled, we reprogram CG settings during resume - amdgpu_device_resume->amdgpu_device_ip_late_init -> amdgpu_device_set_cg_state. This logic prevents this. Maybe, it works fine during your testing because it's done by FW. If the settings are programmed by FW components, usually reprogramming is taken care by FW.

Thanks,
Lijo

In the S0i3 entry the gfx power rail will be turn off but MEM_S3 power rail is keeping on and involved device/IP context will be saved in the memory and then each context restored by PM firmware during S0i3 resume.

Quoted 9 lines

Have merged the fix for not blocking s0ix support for some

Quoted 1 line

upcoming asic and meanwhile still need dig into whether the DF C-state,

MMHUB DS or BIOS mmhub power gate request different on GC 10.3.7 introduce this issue and then make a generic solution for such this issue.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
     r = adev->mmhub.funcs->set_clockgating(adev, state);
     if (r)
             return r;
#6 lore raw
Quoted 86 lines · Prike

[AMD Official Use Only - General]

Quoted 84 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, April 27, 2022 2:33 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Quoted 54 lines · Prike

[Public]

Quoted 52 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, April 26, 2022 7:19 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: keep mmhub clock gating being enabled during s2idle suspend

Quoted 15 lines · Prike Liang

Without MMHUB clock gating being enabled then MMHUB will not disconnect from DF and will result in DF C-state entry can't be accessed during S2idle suspend, and eventually s0ix entry will be blocked.

---
    drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 10 ++++++++++
    1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index a455e59f41f4..20946bc7fc93 100644
@@ -1151,6 +1151,16 @@ static int
Quoted 1 line

gmc_v10_0_set_clockgating_state(void

*handle,

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c

Quoted 5 lines
      int r;
      struct amdgpu_device *adev = (struct amdgpu_device *)handle;
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +2 -0
+   /*
+    * The issue mmhub can't disconnect from DF with MMHUB clock

gating being disabled

Quoted 1 line

+ * is a new problem observed at DF 3.0.3, however with the same

suspend sequence not

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +4 -0
+    * seen any issue on the DF 3.0.2 series platform.
+    */
+   if (adev->in_s0ix && adev->ip_versions[DF_HWIP][0] >
+ IP_VERSION(3,

0, 2)) {

Quoted 1 line

+ dev_dbg(adev->dev, "keep mmhub clock gating being

enabled for s0ix\n");

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static int gmc_v10_0_set_clockgating_state(void *handle, · line 1163

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 -0
+           return 0;
+   }
+

This only ignores clock gating requests as long as s0ix flag is set. As far as I see, s0ix flag is set to true even during resume and set to false only after resume is completed. Is that intention and is this tested to be working fine? I suggest to keep this specifically for

suspend calls.

Quoted 6 lines
Quoted 4 lines

Thanks,
Lijo

It reasonable for also not reenable the clock gating on the s2ilde resume since clock gating not disabled on the s2idle suspend.

Generally, the CG setting registers are not in always-on domain and the register settings will be lost once it goes down. Not sure about the state of this particular IP rail during S0i3 cycle.

If the CG settings are driver-enabled, we reprogram CG settings during resume - amdgpu_device_resume->amdgpu_device_ip_late_init -> amdgpu_device_set_cg_state. This logic prevents this. Maybe, it works fine during your testing because it's done by FW. If the settings are programmed by FW components, usually reprogramming is taken care by FW.

Quoted 4 lines
Quoted 3 lines

Thanks,
Lijo

In the S0i3 entry the gfx power rail will be turn off but MEM_S3 power rail is keeping on and involved device/IP context will be saved in the memory and then each context restored by PM firmware during S0i3 resume.

Thanks, that clarifies.

Thanks,
Lijo

Quoted 10 lines
Quoted 10 lines

Have merged the fix for not blocking s0ix support for some

Quoted 1 line

upcoming asic and meanwhile still need dig into whether the DF C-state,

MMHUB DS or BIOS mmhub power gate request different on GC 10.3.7 introduce this issue and then make a generic solution for such this issue.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
      r = adev->mmhub.funcs->set_clockgating(adev, state);
      if (r)
              return r;