From: Alex Deucher <[email protected]>

And while we are at it remove the reset parameter as it's
no longer needed.

Signed-off-by: Alex Deucher <[email protected]>
Reviewed-by: Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index f268d46e0759..1dd35aa6199d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -4212,13 +4212,13 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device 
*adev, void *m,
        return 0;
 }
 
-static int gfx_v11_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
+static int gfx_v11_0_kgq_init_queue(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
        struct v11_gfx_mqd *mqd = ring->mqd_ptr;
        int mqd_idx = ring - &adev->gfx.gfx_ring[0];
 
-       if (!reset && !amdgpu_in_reset(adev) && !adev->in_suspend) {
+       if (!amdgpu_in_reset(adev) && !adev->in_suspend) {
                memset((void *)mqd, 0, sizeof(*mqd));
                mutex_lock(&adev->srbm_mutex);
                soc21_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -4245,7 +4245,7 @@ static int gfx_v11_0_cp_async_gfx_ring_resume(struct 
amdgpu_device *adev)
        int r, i;
 
        for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
-               r = gfx_v11_0_kgq_init_queue(&adev->gfx.gfx_ring[i], false);
+               r = gfx_v11_0_kgq_init_queue(&adev->gfx.gfx_ring[i]);
                if (r)
                        return r;
        }
@@ -4582,13 +4582,13 @@ static int gfx_v11_0_kiq_init_queue(struct amdgpu_ring 
*ring)
        return 0;
 }
 
-static int gfx_v11_0_kcq_init_queue(struct amdgpu_ring *ring, bool reset)
+static int gfx_v11_0_kcq_init_queue(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
        struct v11_compute_mqd *mqd = ring->mqd_ptr;
        int mqd_idx = ring - &adev->gfx.compute_ring[0];
 
-       if (!reset && !amdgpu_in_reset(adev) && !adev->in_suspend) {
+       if (!amdgpu_in_reset(adev) && !adev->in_suspend) {
                memset((void *)mqd, 0, sizeof(*mqd));
                mutex_lock(&adev->srbm_mutex);
                soc21_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -4625,7 +4625,7 @@ static int gfx_v11_0_kcq_resume(struct amdgpu_device 
*adev)
                gfx_v11_0_cp_compute_enable(adev, true);
 
        for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-               r = gfx_v11_0_kcq_init_queue(&adev->gfx.compute_ring[i], false);
+               r = gfx_v11_0_kcq_init_queue(&adev->gfx.compute_ring[i]);
                if (r)
                        return r;
        }
@@ -6790,11 +6790,7 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring,
                return r;
 
        if (use_mmio) {
-               r = gfx_v11_0_kgq_init_queue(ring, true);
-               if (r) {
-                       dev_err(adev->dev, "failed to init kgq\n");
-                       return r;
-               }
+               amdgpu_gfx_mqd_reset_restore(ring);
 
                r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
                if (r) {
@@ -6821,11 +6817,8 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring,
                return r;
 
        if (use_mmio) {
-               r = gfx_v11_0_kcq_init_queue(ring, true);
-               if (r) {
-                       dev_err(adev->dev, "fail to init kcq\n");
-                       return r;
-               }
+               amdgpu_gfx_mqd_reset_restore(ring);
+
                r = amdgpu_mes_map_legacy_queue(adev, ring, 0);
                if (r) {
                        dev_err(adev->dev, "failed to remap kcq\n");
-- 
2.49.0

Reply via email to