Skip to contentSkip to conversation

drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

PATCH In review Evan Quan 4 participants 6 messages Dec 24, 2021

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some proper cleanups and put itself into a state ready for PNP(which fits the scenario BOCO stands for). That can address some random resuming failure observed on BOCO capable platforms.

Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -0
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 	if (amdgpu_device_supports_px(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
+	/*
+	 * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some
+	 * proper cleanups and put itself into a state ready for PNP. That
+	 * can address some random resuming failure observed on BOCO capable
+	 * platforms.
+	 * TODO: this may be also needed for PX capable platform.
+	 */
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
 	ret = amdgpu_device_suspend(drm_dev, false);
 	if (ret) {
 		adev->in_runpm = false;
+		if (amdgpu_device_supports_boco(drm_dev))
+			adev->mp1_state = PP_MP1_STATE_NONE;
 		return ret;
 	}
 
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_NONE;
+
 	if (amdgpu_device_supports_px(drm_dev)) {
 		/* Only need to handle PCI state in the driver for ATPX
 		 * PCI core handles it for _PR3.
Signature · 1 line
2.29.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Evan Quan

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some proper cleanups and put itself into a state ready for PNP(which fits the scenario BOCO stands for). That can address some random resuming failure observed on BOCO capable platforms.

Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -1
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
        if (amdgpu_device_supports_px(drm_dev))
                drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
+       /*
+        * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some
+        * proper cleanups and put itself into a state ready for PNP. That
+        * can address some random resuming failure observed on BOCO capable
+        * platforms.
+        * TODO: this may be also needed for PX capable platform.
+        */
+       if (amdgpu_device_supports_boco(drm_dev))
+               adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
        ret = amdgpu_device_suspend(drm_dev, false);
        if (ret) {
                adev->in_runpm = false;
+               if (amdgpu_device_supports_boco(drm_dev))
+                       adev->mp1_state = PP_MP1_STATE_NONE;
                return ret;
        }
 
+       if (amdgpu_device_supports_boco(drm_dev))
+               adev->mp1_state = PP_MP1_STATE_NONE;
+
        if (amdgpu_device_supports_px(drm_dev)) {
                /* Only need to handle PCI state in the driver for ATPX
                 * PCI core handles it for _PR3.
--

2.29.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Evan Quan

[Public]

Thank you Evan. Shall we limit it to dGPU only?

With above concern clarified, the patch is:

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, December 24, 2021 11:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some proper cleanups and put itself into a state ready for PNP(which fits the scenario BOCO stands for). That can address some random resuming failure observed on BOCO capable platforms.

Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -0
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 	if (amdgpu_device_supports_px(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
+	/*
+	 * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some
+	 * proper cleanups and put itself into a state ready for PNP. That
+	 * can address some random resuming failure observed on BOCO capable
+	 * platforms.
+	 * TODO: this may be also needed for PX capable platform.
+	 */
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
 	ret = amdgpu_device_suspend(drm_dev, false);
 	if (ret) {
 		adev->in_runpm = false;
+		if (amdgpu_device_supports_boco(drm_dev))
+			adev->mp1_state = PP_MP1_STATE_NONE;
 		return ret;
 	}
 
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_NONE;
+
 	if (amdgpu_device_supports_px(drm_dev)) {
 		/* Only need to handle PCI state in the driver for ATPX
 		 * PCI core handles it for _PR3.

--
2.29.0

Reviewed-by
#3 lore raw

[Public]

Never mind. I checked the code in amdgpu_device_supports_boco, it's only true on dGPU. So pls skip my question.

Regards,
Guchun

-----Original Message-----
From: Chen, Guchun
Sent: Friday, December 24, 2021 12:42 PM
To: Evan Quan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

[Public]

Thank you Evan. Shall we limit it to dGPU only?

With above concern clarified, the patch is:

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Friday, December 24, 2021 11:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Chen, Guchun <[email protected]>
Subject: [PATCH] drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some proper cleanups and put itself into a state ready for PNP(which fits the scenario BOCO stands for). That can address some random resuming failure observed on BOCO capable platforms.

Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -0
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 	if (amdgpu_device_supports_px(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
+	/*
+	 * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some
+	 * proper cleanups and put itself into a state ready for PNP. That
+	 * can address some random resuming failure observed on BOCO capable
+	 * platforms.
+	 * TODO: this may be also needed for PX capable platform.
+	 */
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
 	ret = amdgpu_device_suspend(drm_dev, false);
 	if (ret) {
 		adev->in_runpm = false;
+		if (amdgpu_device_supports_boco(drm_dev))
+			adev->mp1_state = PP_MP1_STATE_NONE;
 		return ret;
 	}
 
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_NONE;
+
 	if (amdgpu_device_supports_px(drm_dev)) {
 		/* Only need to handle PCI state in the driver for ATPX
 		 * PCI core handles it for _PR3.

--
2.29.0

Reviewed-by on v1 1/1
#4 lore raw
In reply to Evan Quan
Quoted 2 lines · Evan Quan

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some proper cleanups and put itself into a state ready for PNP(which fits the scenario BOCO stands for).

"BOCO similar to PNP" is not correct. Mention this as a workaround. With that changed

Thanks,
Lijo

Quoted 41 lines

That can address some random resuming failure observed on BOCO capable platforms.

Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -0
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
  	if (amdgpu_device_supports_px(drm_dev))
  		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
+	/*
+	 * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some
+	 * proper cleanups and put itself into a state ready for PNP. That
+	 * can address some random resuming failure observed on BOCO capable
+	 * platforms.
+	 * TODO: this may be also needed for PX capable platform.
+	 */
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
  	ret = amdgpu_device_suspend(drm_dev, false);
  	if (ret) {
  		adev->in_runpm = false;
+		if (amdgpu_device_supports_boco(drm_dev))
+			adev->mp1_state = PP_MP1_STATE_NONE;
  		return ret;
  	}
 
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_NONE;
+
  	if (amdgpu_device_supports_px(drm_dev)) {
  		/* Only need to handle PCI state in the driver for ATPX
  		 * PCI core handles it for _PR3.
author
#5 lore raw

[AMD Official Use Only]

Quoted 11 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, December 24, 2021 12:44 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: put SMU into proper state on runpm suspending for BOCO capable platform

Quoted 8 lines
Quoted 1 line · Evan Quan

By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some

proper

Quoted 1 line

cleanups and put itself into a state ready for PNP(which fits the scenario

BOCO stands for).

"BOCO similar to PNP" is not correct. Mention this as a workaround. With that changed

[Quan, Evan] Sorry for the confusing. I did not mean "BOCO" == "PNP". What I wanted to express is for BOCO/PNP(unlike BACO), SMU does not have to be alive. From that perspective, it's reasonable to share the SMU cleanup process designed for PNP for BOCO. Anyway thanks for pointing this out. I will drop that confusing expression.

BR
Evan

Quoted 52 lines

Thanks,
Lijo

Quoted 1 line

That can address some random resuming failure observed on BOCO

capable platforms.

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int

Quoted 13 lines
Change-Id I9804c4f04b6d2ef737b076cabf85d2880179efe2
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index e431c7f10755..ad8370b41e74 100644
@@ -2235,12 +2235,27 @@ static int

amdgpu_pmops_runtime_suspend(struct device *dev)

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int · line 2236

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
  	if (amdgpu_device_supports_px(drm_dev))
  		drm_dev->switch_power_state =

DRM_SWITCH_POWER_CHANGING;

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int · line 2238

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+	/*
+	 * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do

some

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int · line 2240

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+	 * proper cleanups and put itself into a state ready for PNP. That
+	 * can address some random resuming failure observed on BOCO

capable

Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +11 -0
+	 * platforms.
+	 * TODO: this may be also needed for PX capable platform.
+	 */
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
+
  	ret = amdgpu_device_suspend(drm_dev, false);
  	if (ret) {
  		adev->in_runpm = false;
+		if (amdgpu_device_supports_boco(drm_dev))
+			adev->mp1_state = PP_MP1_STATE_NONE;
  		return ret;
  	}
 
+	if (amdgpu_device_supports_boco(drm_dev))
+		adev->mp1_state = PP_MP1_STATE_NONE;
+
  	if (amdgpu_device_supports_px(drm_dev)) {
  		/* Only need to handle PCI state in the driver for ATPX
  		 * PCI core handles it for _PR3.