amdgpu_device_pre_asic_reset() runs for every device in the reset list,
but dumps the IP state of reset_context->reset_req_dev rather than the
device it was called for. This was carried over from when the dump was
done once in amdgpu_do_asic_reset() for the first device in the list.

For an XGMI hive, the requesting device is first in the list, so the
dump for every later device dumps the requesting device again after its
IP blocks have been suspended, replacing its registers with the state
after suspend. The other devices are never dumped, yet
amdgpu_device_reinit_after_reset() emits a coredump for each of them.

Dump the device being prepared.

Fixes: 13d8850a3387 ("drm/amdgpu: trigger ip dump before suspend of IP's")
Signed-off-by: Matt Turner <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index d0ed92761ef9..85a22af69ba4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5133,7 +5133,6 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device 
*adev,
 {
        struct amdgpu_job *job = NULL;
        struct dma_fence *fence = NULL;
-       struct amdgpu_device *tmp_adev = reset_context->reset_req_dev;
        bool need_full_reset =
                test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags);
        int i, r;
@@ -5199,13 +5198,13 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device 
*adev,
                need_full_reset = true;
 
                if (!test_bit(AMDGPU_SKIP_COREDUMP, &reset_context->flags)) {
-                       dev_info(tmp_adev->dev, "Dumping IP State\n");
+                       dev_info(adev->dev, "Dumping IP State\n");
                        /* Trigger ip dump before we reset the asic */
-                       for (i = 0; i < tmp_adev->num_ip_blocks; i++)
-                               if 
(tmp_adev->ip_blocks[i].version->funcs->dump_ip_state)
-                                       tmp_adev->ip_blocks[i].version->funcs
-                                               ->dump_ip_state((void 
*)&tmp_adev->ip_blocks[i]);
-                       dev_info(tmp_adev->dev, "Dumping IP State Completed\n");
+                       for (i = 0; i < adev->num_ip_blocks; i++)
+                               if 
(adev->ip_blocks[i].version->funcs->dump_ip_state)
+                                       adev->ip_blocks[i].version->funcs
+                                               ->dump_ip_state((void 
*)&adev->ip_blocks[i]);
+                       dev_info(adev->dev, "Dumping IP State Completed\n");
                }
 
                if (need_full_reset)

-- 
2.56.1

Reply via email to