Skip to contentSkip to conversation

drm/amdgpu: skip vram operation for BAMACO runtime

PATCH Superseded Likun Gao 2 participants 2 messages Dec 11, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Likun Gao

author
#0 lore raw

PATCH 1/1 drm/amdgpu: skip vram operation for BAMACO runtime

From: Likun Gao <[email protected]>

Skip vram related operation for bamaco rumtime suspend and resume as vram is alive when BAMACO.
It can save about 32ms when suspend and about 15ms when resume.

Change-Id I6ad39765de5ed1aac2dc51e96ed7a21a727272cd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  9 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 72 +++++++++++++---------
 2 files changed, 50 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -3
index 0ec7c28c4d5a..66b790dfb151 100644
@@ -2464,7 +2464,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
 	amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
 	amdgpu_device_set_pg_state(adev, AMD_PG_STATE_GATE);
 
-	amdgpu_device_fill_reset_magic(adev);
+	if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+		amdgpu_device_fill_reset_magic(adev);
 
 	r = amdgpu_device_enable_mgpu_fan_boost();
 	if (r)
@@ -3706,7 +3707,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
 	amdgpu_amdkfd_suspend(adev, !fbcon);
 
 	/* evict vram memory */
-	amdgpu_bo_evict_vram(adev);
+	if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+		amdgpu_bo_evict_vram(adev);
 
 	amdgpu_fence_driver_suspend(adev);
 
@@ -3718,7 +3720,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
 	 * This second call to evict vram is to evict the gart page table
 	 * using the CPU.
 	 */
-	amdgpu_bo_evict_vram(adev);
+	if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+		amdgpu_bo_evict_vram(adev);
 
 	return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +44 -28

152 lines not on this page · raw message

Signature · 6 lines
2.25.1

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

[AMD Public Use]

Instead of checking the global parameters everywhere, let's check the runtime pm parameter and then set a local adev variable per device. That way we can have a mix of devices that support different runtime pm modes in the same system and everything works.

Alex

________________________________
From: amd-gfx <[email protected]> on behalf of Likun Gao <[email protected]>
Sent: Friday, December 11, 2020 4:04 AM
To: [email protected] <[email protected]>
Cc: Gao, Likun <[email protected]>; Feng, Kenneth <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amdgpu: skip vram operation for BAMACO runtime

From: Likun Gao <[email protected]>

Skip vram related operation for bamaco rumtime suspend and resume as vram is alive when BAMACO.
It can save about 32ms when suspend and about 15ms when resume.

Change-Id I6ad39765de5ed1aac2dc51e96ed7a21a727272cd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  9 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c    | 72 +++++++++++++---------
 2 files changed, 50 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -3
index 0ec7c28c4d5a..66b790dfb151 100644
@@ -2464,7 +2464,8 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
         amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
         amdgpu_device_set_pg_state(adev, AMD_PG_STATE_GATE);
 
-       amdgpu_device_fill_reset_magic(adev);
+       if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+               amdgpu_device_fill_reset_magic(adev);
 
         r = amdgpu_device_enable_mgpu_fan_boost();
         if (r)
@@ -3706,7 +3707,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
         amdgpu_amdkfd_suspend(adev, !fbcon);
 
         /* evict vram memory */
-       amdgpu_bo_evict_vram(adev);
+       if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+               amdgpu_bo_evict_vram(adev);
 
         amdgpu_fence_driver_suspend(adev);
 
@@ -3718,7 +3720,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
          * This second call to evict vram is to evict the gart page table
          * using the CPU.
          */
-       amdgpu_bo_evict_vram(adev);
+       if ((amdgpu_runtime_pm != 2) || !adev->in_runpm)
+               amdgpu_bo_evict_vram(adev);
 
         return 0;
 }
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +44 -28

152 lines not on this page · raw message

--
2.25.1

_______________________________________________
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%7Calexander.deucher%40amd.com%7C0bee5882ad6142eb967c08d89db4018b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637432743751698480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=1AU6gN6Yqp8yZT%2BHDWfAwFh9UuWh7XoJg2kD%2F%2BbwZjA%3D&amp;reserved=0

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