amdgpu_multi_ring_reset_helper_begin() and _end() take the device from
the guilty ring. A reset triggered by a hung user queue has no guilty
kernel ring, so pass the device explicitly and allow a NULL guilty ring.

No functional change.

Reviewed-by: Timur Kristóf <[email protected]>
Signed-off-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c   |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 14 ++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h |  6 ++++--
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c
index 734f2a0bc79a..d0b0d3eaffc5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c
@@ -465,11 +465,11 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring 
*guilty_ring,
        ring_type_mask = amdgpu_ring_mask_from_ip(ip_type);
 
        amdgpu_device_lock_reset_domain(adev->reset_domain);
-       amdgpu_multi_ring_reset_helper_begin(ring_type_mask, guilty_ring, 
guilty_fence);
+       amdgpu_multi_ring_reset_helper_begin(adev, ring_type_mask, guilty_ring, 
guilty_fence);
 
        r = ip_block->version->funcs->soft_reset(ip_block);
 
-       r = amdgpu_multi_ring_reset_helper_end(ring_type_mask, guilty_ring, r);
+       r = amdgpu_multi_ring_reset_helper_end(adev, ring_type_mask, 
guilty_ring, r);
        amdgpu_device_unlock_reset_domain(adev->reset_domain);
 
        if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 411c74802d20..be91143d9aed 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -928,8 +928,9 @@ int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
 /**
  * amdgpu_multi_ring_reset_helper_begin() - Prepare multiple rings for a reset.
  *
+ * @adev: amdgpu device
  * @ring_type_mask: Bitmask of affected ring types
- * @guilty_ring: The ring which is guilty of causing a reset.
+ * @guilty_ring: The ring which is guilty of causing a reset, or NULL.
  * @guilty_fence: The fence which didn't signal on the guilty ring.
  *
  * Useful when performing a GPU reset method that affects
@@ -947,11 +948,11 @@ int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
  * After the reset is complete, the caller should then call
  * amdgpu_multi_ring_reset_helper_end() to restore the rings.
  */
-void amdgpu_multi_ring_reset_helper_begin(const u32 ring_type_mask,
+void amdgpu_multi_ring_reset_helper_begin(struct amdgpu_device *adev,
+                                         const u32 ring_type_mask,
                                          struct amdgpu_ring *guilty_ring,
                                          struct amdgpu_fence *guilty_fence)
 {
-       struct amdgpu_device *adev = guilty_ring->adev;
        struct amdgpu_fence *ring_guilty_fence;
        struct amdgpu_ring *ring;
        bool rings_busy;
@@ -1043,8 +1044,9 @@ void amdgpu_multi_ring_reset_helper_begin(const u32 
ring_type_mask,
 /**
  * amdgpu_multi_ring_reset_helper_end() - Prepare multiple rings for a reset.
  *
+ * @adev: amdgpu device
  * @ring_type_mask: Bitmask of affected ring types
- * @guilty_ring: The ring which is guilty of causing a reset.
+ * @guilty_ring: The ring which is guilty of causing a reset, or NULL.
  * @ret: Return code from the reset function.
  *
  * After calling amdgpu_multi_ring_reset_helper_begin()
@@ -1055,10 +1057,10 @@ void amdgpu_multi_ring_reset_helper_begin(const u32 
ring_type_mask,
  * be called to restore preemption state, but it won't attempt to
  * fully restore the ring contents.
  */
-int amdgpu_multi_ring_reset_helper_end(const u32 ring_type_mask,
+int amdgpu_multi_ring_reset_helper_end(struct amdgpu_device *adev,
+                                      const u32 ring_type_mask,
                                       struct amdgpu_ring *guilty_ring, int ret)
 {
-       struct amdgpu_device *adev = guilty_ring->adev;
        struct amdgpu_ring *ring;
        int i, r;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
index 6224a9f94826..db8fbe92a261 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
@@ -638,10 +638,12 @@ void amdgpu_ring_reset_helper_begin(struct amdgpu_ring 
*ring,
                                    struct amdgpu_fence *guilty_fence);
 int amdgpu_ring_reset_helper_end(struct amdgpu_ring *ring,
                                 struct amdgpu_fence *guilty_fence);
-void amdgpu_multi_ring_reset_helper_begin(const u32 ring_type_mask,
+void amdgpu_multi_ring_reset_helper_begin(struct amdgpu_device *adev,
+                                         const u32 ring_type_mask,
                                          struct amdgpu_ring *guilty_ring,
                                          struct amdgpu_fence *guilty_fence);
-int amdgpu_multi_ring_reset_helper_end(const u32 ring_type_mask,
+int amdgpu_multi_ring_reset_helper_end(struct amdgpu_device *adev,
+                                      const u32 ring_type_mask,
                                       struct amdgpu_ring *guilty_ring, int 
ret);
 bool amdgpu_ring_is_reset_type_supported(struct amdgpu_ring *ring,
                                         u32 reset_type);
-- 
2.50.1

Reply via email to