Skip to contentSkip to conversation

drm/amdgpu: drop extra drm_kms_helper_poll_enable/disable calls

PATCH In review Alex Deucher 3 participants 5 messages Feb 4, 2021 – Feb 5, 2021

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

PATCH 1/3 drm/amdgpu: drop extra drm_kms_helper_poll_enable/disable calls

These are already called in amdgpu_device_suspend/resume which are already called in the same functions.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 2 --
 2 files changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -2
index 51bea409e513..151c649e4d11 100644
@@ -1433,10 +1433,8 @@ static void amdgpu_switcheroo_set_state(struct pci_dev *pdev,
 		amdgpu_device_resume(dev, true);
 
 		dev->switch_power_state = DRM_SWITCH_POWER_ON;
-		drm_kms_helper_poll_enable(dev);
 	} else {
 		pr_info("switched off\n");
-		drm_kms_helper_poll_disable(dev);
 		dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 		amdgpu_device_suspend(dev, true);
 		amdgpu_device_cache_pci_state(pdev);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
index 05ed82e4d805..c9821f1dc357 100644
@@ -1367,7 +1367,6 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 	adev->in_runpm = true;
 	if (amdgpu_device_supports_atpx(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
-	drm_kms_helper_poll_disable(drm_dev);
 
 	ret = amdgpu_device_suspend(drm_dev, false);
 	if (ret)
@@ -1424,7 +1423,6 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
 		amdgpu_device_baco_exit(drm_dev);
 	}
 	ret = amdgpu_device_resume(drm_dev, false);
-	drm_kms_helper_poll_enable(drm_dev);
 	if (amdgpu_device_supports_atpx(drm_dev))
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
 	adev->in_runpm = false;
Signature · 6 lines
2.29.2

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

PATCH 2/3 drm/amdgpu: use runpm flag rather than fbcon for kfd runtime suspend

the flag used by kfd is not actually related to fbcon, it just happens to align. Use the runpm flag instead so that we can decouple it from the fbcon flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 151c649e4d11..053e134b1245 100644
@@ -3722,7 +3722,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
 
 	r = amdgpu_device_ip_suspend_phase1(adev);
 
-	amdgpu_amdkfd_suspend(adev, !fbcon);
+	amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
 	/* evict vram memory */
 	amdgpu_bo_evict_vram(adev);
Signature · 6 lines
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/amdgpu: use runpm flag rather than fbcon for kfd runtime suspend

Am 2021-02-04 um 9:43 a.m. schrieb Alex Deucher:

Quoted 5 lines

the flag used by kfd is not actually related to fbcon, it just happens to align. Use the runpm flag instead so that we can decouple it from the fbcon flag.

Quoted 9 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 151c649e4d11..053e134b1245 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) · line 3728

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3722,7 +3722,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
 
 	r = amdgpu_device_ip_suspend_phase1(adev);
 
-	amdgpu_amdkfd_suspend(adev, !fbcon);
+	amdgpu_amdkfd_suspend(adev, adev->in_runpm);
 
 	/* evict vram memory */
 	amdgpu_bo_evict_vram(adev);

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

#3 lore raw

PATCH 3/3 drm/amdgpu: reset runpm flag if device suspend fails

In reply to Alex Deucher

If device suspend fails when we attempt to runtime suspend, reset the runpm flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index c9821f1dc357..e5c2377a54f8 100644
@@ -1369,8 +1369,10 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 		drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
 	ret = amdgpu_device_suspend(drm_dev, false);
-	if (ret)
+	if (ret) {
+		adev->in_runpm = false;
 		return ret;
+	}
 
 	if (amdgpu_device_supports_atpx(drm_dev)) {
 		/* Only need to handle PCI state in the driver for ATPX
Signature · 6 lines
2.29.2

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

RE: [PATCH 3/3] drm/amdgpu: reset runpm flag if device suspend fails

[AMD Official Use Only - Internal Distribution Only]

Series is acked-by: Evan Quan <[email protected]>

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, February 4, 2021 10:43 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: reset runpm flag if device suspend fails

If device suspend fails when we attempt to runtime suspend, reset the runpm flag.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -1
index c9821f1dc357..e5c2377a54f8 100644
@@ -1369,8 +1369,10 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
 
 ret = amdgpu_device_suspend(drm_dev, false);
-if (ret)
+if (ret) {
+adev->in_runpm = false;
 return ret;
+}
 
 if (amdgpu_device_supports_atpx(drm_dev)) {
 /* Only need to handle PCI state in the driver for ATPX

--
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cevan.quan%40amd.com%7C5402b357d36044fe5da108d8c91b4c7e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637480466394703835%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=JoZXlRyAtQ0pDgsDEne7%2FuwRTud0hvFBe23j1cMUL10%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx