Skip to contentSkip to conversation

drm/amdgpu:Correct max uvd handles

PATCH In review James Zhu 3 participants 5 messages Mar 6, 2018 – Mar 7, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

James Zhu

author
#0 lore raw

PATCH 1/2 drm/amdgpu:Correct max uvd handles

Max uvd handles should use adev->uvd.max_handles instead of AMDGPU_MAX_UVD_HANDLES here.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
index 7ad814d..9d037cb 100644
@@ -303,7 +303,7 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 		if (atomic_read(&adev->uvd.handles[i]))
 			break;
 
-	if (i == AMDGPU_MAX_UVD_HANDLES)
+	if (i == adev->uvd.max_handles)
 		return 0;
 
 	size = amdgpu_bo_size(adev->uvd.vcpu_bo);
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1520367246-8734-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/2 drm/amdgpu:Always save uvd vcpu_bo in VM Mode

When UVD is in VM mode, there is not uvd handle exchanged, uvd.handles are always 0. So vcpu_bo always need save, Otherwise amdgpu driver will fail during suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105021

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -1
index 9d037cb..61a31e5 100644
@@ -303,7 +303,8 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 		if (atomic_read(&adev->uvd.handles[i]))
 			break;
 
-	if (i == adev->uvd.max_handles)
+	/* only valid for physical mode */
+	if (i == adev->uvd.max_handles && adev->asic_type < CHIP_POLARIS10)
 		return 0;
 
 	size = amdgpu_bo_size(adev->uvd.vcpu_bo);
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1520367246-8734-2-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu:Always save uvd vcpu_bo in VM Mode

Series are:

Quoted 15 lines · James Zhu

When UVD is in VM mode, there is not uvd handle exchanged, uvd.handles are always 0. So vcpu_bo always need save, Otherwise amdgpu driver will fail during suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105021

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 9d037cb..61a31e5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_suspend(struct amdgpu_device *adev) · line 310

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -1
@@ -303,7 +303,8 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
  		if (atomic_read(&adev->uvd.handles[i]))
  			break;
 
-	if (i == adev->uvd.max_handles)
+	/* only valid for physical mode */
+	if (i == adev->uvd.max_handles && adev->asic_type < CHIP_POLARIS10)
  		return 0;
 
  	size = amdgpu_bo_size(adev->uvd.vcpu_bo);

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

#5 lore raw

Re: [PATCH 2/2] drm/amdgpu:Always save uvd vcpu_bo in VM Mode

In reply to a message not in the archive

Am 06.03.2018 um 21:14 schrieb James Zhu:

Quoted 15 lines

When UVD is in VM mode, there is not uvd handle exchanged, uvd.handles are always 0. So vcpu_bo always need save, Otherwise amdgpu driver will fail during suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105021

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
index 9d037cb..61a31e5 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_suspend(struct amdgpu_device *adev) · line 307

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -1
@@ -303,7 +303,8 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
  		if (atomic_read(&adev->uvd.handles[i]))
  			break;
 
-	if (i == adev->uvd.max_handles)
+	/* only valid for physical mode */
+	if (i == adev->uvd.max_handles && adev->asic_type < CHIP_POLARIS10)

Would be nice to completely skip the check on Polaris and newer. In other words:

If (adev->asic_type < CHIP_POLARIS10) {
    for (i= 0;.....

    if (i== adev->uvd.max_handles)
        return 0;
}

But that is purely nice to have, both patches are Reviewed-by: Christian König <[email protected]>.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c int amdgpu_uvd_suspend(struct amdgpu_device *adev) · line 310

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0 -0
  		return 0;
 
  	size = amdgpu_bo_size(adev->uvd.vcpu_bo);

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

author
#6 lore raw

PATCH v2 2/2 drm/amdgpu:Always save uvd vcpu_bo in VM Mode

In reply to a message not in the archive

When UVD is in VM mode, there is not uvd handle exchanged, uvd.handles are always 0. So vcpu_bo always need save, Otherwise amdgpu driver will fail during suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105021

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +8 -5
index 9d037cb..f3c459b 100644
@@ -299,12 +299,15 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 
 	cancel_delayed_work_sync(&adev->uvd.idle_work);
 
-	for (i = 0; i < adev->uvd.max_handles; ++i)
-		if (atomic_read(&adev->uvd.handles[i]))
-			break;
+	/* only valid for physical mode */
+	if (adev->asic_type < CHIP_POLARIS10) {
+		for (i = 0; i < adev->uvd.max_handles; ++i)
+			if (atomic_read(&adev->uvd.handles[i]))
+				break;
 
-	if (i == adev->uvd.max_handles)
-		return 0;
+		if (i == adev->uvd.max_handles)
+			return 0;
+	}
 
 	size = amdgpu_bo_size(adev->uvd.vcpu_bo);
 	ptr = adev->uvd.cpu_addr;
Signature · 6 lines
2.7.4

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