Skip to contentSkip to conversation

drm/amdgpu: avoid force-completing uninitialized UVD rings

PATCH In review Bob Zhou 4 participants 4 messages Aug 19 – Aug 24

Subsystems (2)
lore
Share & tools
lore

Bob Zhou

author
#0 lore raw

PATCH v3 1/1 drm/amdgpu: avoid force-completing uninitialized UVD rings

uvd_v7_0_sw_init() does not initialize the UVD decode ring for an SR-IOV VF. However, amdgpu_uvd_resume() unconditionally force-completes the decode ring when restoring its fence sequence.

Skip fence completion when the fence driver is not initialized.

Fixes 043f2271e2d0 ("drm/amdgpu: mark force completed fences with -ECANCELED")
---
 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 228a405a94c4f..ecd7caa95d4b2 100644
@@ -517,7 +517,8 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
 			}
 			memset_io(ptr, 0, size);
 			/* to restore uvd fence seq */
-			amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring, NULL);
+			if (adev->uvd.inst[i].ring.fence_drv.initialized)
+				amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring, NULL);
 		}
 	}
 	return 0;
Signature · 1 line
2.34.1
Acked-by on v3 1/1
#1 lore raw

AMD General

Quoted 42 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Bob Zhou
Sent: Wednesday, August 19, 2026 2:43 AM
To: [email protected]; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Min, Frank <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH v3] drm/amdgpu: avoid force-completing uninitialized UVD rings

uvd_v7_0_sw_init() does not initialize the UVD decode ring for an SR-IOV VF. However, amdgpu_uvd_resume() unconditionally force-completes the decode ring when restoring its fence sequence.

Skip fence completion when the fence driver is not initialized.

Fixes 043f2271e2d0 ("drm/amdgpu: mark force completed fences with -

ECANCELED")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +3 -2
index 228a405a94c4f..ecd7caa95d4b2 100644
@@ -517,7 +517,8 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
                      }
                      memset_io(ptr, 0, size);
                      /* to restore uvd fence seq */
-                     amdgpu_fence_driver_force_completion(&adev-
 >uvd.inst[i].ring, NULL);
+                     if (adev->uvd.inst[i].ring.fence_drv.initialized)
+
      amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring,
+NULL);
              }
      }
      return 0;
--

2.34.1

Acked-by on v3 1/1
#2 lore raw
In reply to Bob Zhou

AMD General

-----Original Message-----
From: Bob Zhou <[email protected]>
Sent: Wednesday, August 19, 2026 2:43 PM
To: [email protected]; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Min, Frank <[email protected]>
Cc: Zhou, Bob <[email protected]>
Subject: [PATCH v3] drm/amdgpu: avoid force-completing uninitialized UVD rings

uvd_v7_0_sw_init() does not initialize the UVD decode ring for an SR-IOV VF. However, amdgpu_uvd_resume() unconditionally force-completes the decode ring when restoring its fence sequence.

Skip fence completion when the fence driver is not initialized.

Fixes 043f2271e2d0 ("drm/amdgpu: mark force completed fences with -ECANCELED")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +3 -1
index 228a405a94c4f..ecd7caa95d4b2 100644
@@ -517,7 +517,8 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
                        }
                        memset_io(ptr, 0, size);
                        /* to restore uvd fence seq */
-                       amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring, NULL);
+                       if (adev->uvd.inst[i].ring.fence_drv.initialized)
+                               amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring,
+NULL);
                }
        }
        return 0;

--
2.34.1

maintainer
#3 lore raw
In reply to Bob Zhou
Quoted 17 lines · Bob Zhou

uvd_v7_0_sw_init() does not initialize the UVD decode ring for an SR-IOV VF. However, amdgpu_uvd_resume() unconditionally force-completes the decode ring when restoring its fence sequence.

Skip fence completion when the fence driver is not initialized.

Fixes 043f2271e2d0 ("drm/amdgpu: mark force completed fences with -ECANCELED")
---
 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 228a405a94c4f..ecd7caa95d4b2 100644

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +2 -1
@@ -517,7 +517,8 @@ int amdgpu_uvd_resume(struct amdgpu_device *adev)
 			}
 			memset_io(ptr, 0, size);
 			/* to restore uvd fence seq */
-			amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring, NULL);
+			if (adev->uvd.inst[i].ring.fence_drv.initialized)
+				amdgpu_fence_driver_force_completion(&adev->uvd.inst[i].ring, NULL);

That check should potentially be inside amdgpu_fence_driver_force_completion(), apart from that it looks good to me.

Regards,
Christian.

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