drm/amdgpu: clean up ring_backup code, no need more
authorChunming Zhou <David1.Zhou@amd.com>
Wed, 29 Jun 2016 08:01:49 +0000 (16:01 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:06:18 +0000 (15:06 -0400)
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index 7b923e6509af23c88e2d959ff793914943807f5f..ac686e514e01d86bb7153189eada8347409d4f3c 100644 (file)
@@ -1213,10 +1213,6 @@ void amdgpu_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count);
 void amdgpu_ring_generic_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib);
 void amdgpu_ring_commit(struct amdgpu_ring *ring);
 void amdgpu_ring_undo(struct amdgpu_ring *ring);
-unsigned amdgpu_ring_backup(struct amdgpu_ring *ring,
-                           uint32_t **data);
-int amdgpu_ring_restore(struct amdgpu_ring *ring,
-                       unsigned size, uint32_t *data);
 int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
                     unsigned ring_size, u32 nop, u32 align_mask,
                     struct amdgpu_irq_src *irq_src, unsigned irq_type,
index 29ccd7ca8bc7aaa66e2a44ebd553d04baacf8cb0..29d0055fe50d0005025a836a4d5805b99d37d458 100644 (file)
@@ -1926,11 +1926,6 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
  */
 int amdgpu_gpu_reset(struct amdgpu_device *adev)
 {
-       unsigned ring_sizes[AMDGPU_MAX_RINGS];
-       uint32_t *ring_data[AMDGPU_MAX_RINGS];
-
-       bool saved = false;
-
        int i, r;
        int resched;
 
@@ -1955,19 +1950,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
        amdgpu_atombios_scratch_regs_save(adev);
        r = amdgpu_suspend(adev);
 
-       for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
-               struct amdgpu_ring *ring = adev->rings[i];
-               if (!ring)
-                       continue;
-
-               ring_sizes[i] = amdgpu_ring_backup(ring, &ring_data[i]);
-               if (ring_sizes[i]) {
-                       saved = true;
-                       dev_info(adev->dev, "Saved %d dwords of commands "
-                                "on ring %d.\n", ring_sizes[i], i);
-               }
-       }
-
 retry:
        /* Disable fb access */
        if (adev->mode_info.num_crtc) {
@@ -1990,11 +1972,8 @@ retry:
                r = amdgpu_ib_ring_tests(adev);
                if (r) {
                        dev_err(adev->dev, "ib ring test failed (%d).\n", r);
-                       if (saved) {
-                               saved = false;
-                               r = amdgpu_suspend(adev);
-                               goto retry;
-                       }
+                       r = amdgpu_suspend(adev);
+                       goto retry;
                }
 
                for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
@@ -2003,16 +1982,12 @@ retry:
                                continue;
                        amd_sched_job_recovery(&ring->sched);
                        kthread_unpark(ring->sched.thread);
-                       kfree(ring_data[i]);
-                       ring_sizes[i] = 0;
-                       ring_data[i] = NULL;
                }
        } else {
                dev_err(adev->dev, "asic resume failed (%d).\n", r);
                for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
                        if (adev->rings[i]) {
                                kthread_unpark(adev->rings[i]->sched.thread);
-                               kfree(ring_data[i]);
                        }
                }
        }
index c38203e04efe5d7ba2d407ccf0a9fc59aff77a22..71e146180e8ef3bdbeca1d8e227c75bef4e346ec 100644 (file)
@@ -141,78 +141,6 @@ void amdgpu_ring_undo(struct amdgpu_ring *ring)
        ring->wptr = ring->wptr_old;
 }
 
-/**
- * amdgpu_ring_backup - Back up the content of a ring
- *
- * @ring: the ring we want to back up
- *
- * Saves all unprocessed commits from a ring, returns the number of dwords saved.
- */
-unsigned amdgpu_ring_backup(struct amdgpu_ring *ring,
-                           uint32_t **data)
-{
-       unsigned size, ptr, i;
-
-       *data = NULL;
-
-       if (ring->ring_obj == NULL)
-               return 0;
-
-       /* it doesn't make sense to save anything if all fences are signaled */
-       if (!amdgpu_fence_count_emitted(ring))
-               return 0;
-
-       ptr = le32_to_cpu(*ring->next_rptr_cpu_addr);
-
-       size = ring->wptr + (ring->ring_size / 4);
-       size -= ptr;
-       size &= ring->ptr_mask;
-       if (size == 0)
-               return 0;
-
-       /* and then save the content of the ring */
-       *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL);
-       if (!*data)
-               return 0;
-       for (i = 0; i < size; ++i) {
-               (*data)[i] = ring->ring[ptr++];
-               ptr &= ring->ptr_mask;
-       }
-
-       return size;
-}
-
-/**
- * amdgpu_ring_restore - append saved commands to the ring again
- *
- * @ring: ring to append commands to
- * @size: number of dwords we want to write
- * @data: saved commands
- *
- * Allocates space on the ring and restore the previously saved commands.
- */
-int amdgpu_ring_restore(struct amdgpu_ring *ring,
-                       unsigned size, uint32_t *data)
-{
-       int i, r;
-
-       if (!size || !data)
-               return 0;
-
-       /* restore the saved ring content */
-       r = amdgpu_ring_alloc(ring, size);
-       if (r)
-               return r;
-
-       for (i = 0; i < size; ++i) {
-               amdgpu_ring_write(ring, data[i]);
-       }
-
-       amdgpu_ring_commit(ring);
-       kfree(data);
-       return 0;
-}
-
 /**
  * amdgpu_ring_init - init driver ring struct.
  *