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_v12_0.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index bc282958fa37..375621f657bc 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -3071,13 +3071,13 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device 
*adev, void *m,
        return 0;
 }
 
-static int gfx_v12_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
+static int gfx_v12_0_kgq_init_queue(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
        struct v12_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);
                soc24_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -3104,7 +3104,7 @@ static int gfx_v12_0_cp_async_gfx_ring_resume(struct 
amdgpu_device *adev)
        int i, r;
 
        for (i = 0; i < adev->gfx.num_gfx_rings; i++) {
-               r = gfx_v12_0_kgq_init_queue(&adev->gfx.gfx_ring[i], false);
+               r = gfx_v12_0_kgq_init_queue(&adev->gfx.gfx_ring[i]);
                if (r)
                        return r;
        }
@@ -3441,13 +3441,13 @@ static int gfx_v12_0_kiq_init_queue(struct amdgpu_ring 
*ring)
        return 0;
 }
 
-static int gfx_v12_0_kcq_init_queue(struct amdgpu_ring *ring, bool reset)
+static int gfx_v12_0_kcq_init_queue(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
        struct v12_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);
                soc24_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -3485,7 +3485,7 @@ static int gfx_v12_0_kcq_resume(struct amdgpu_device 
*adev)
                gfx_v12_0_cp_compute_enable(adev, true);
 
        for (i = 0; i < adev->gfx.num_compute_rings; i++) {
-               r = gfx_v12_0_kcq_init_queue(&adev->gfx.compute_ring[i], false);
+               r = gfx_v12_0_kcq_init_queue(&adev->gfx.compute_ring[i]);
                if (r)
                        return r;
        }
@@ -5226,11 +5226,7 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring,
                return r;
 
        if (use_mmio) {
-               r = gfx_v12_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) {
@@ -5257,11 +5253,8 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring,
                return r;
 
        if (use_mmio) {
-               r = gfx_v12_0_kcq_init_queue(ring, true);
-               if (r) {
-                       dev_err(adev->dev, "failed 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