Skip to contentSkip to conversation

Revert "drm/amdgpu: Delete user queue doorbell variables"

PATCH In review Zhao, Yong 3 participants 5 messages Feb 19, 2019 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Zhao, Yong

author
#0 lore raw

PATCH 1/2 Revert "drm/amdgpu: Delete user queue doorbell variables"

This reverts commit 9006c6bd9059cb9807fa863bafc1d776222cb61b.

Change-Id: I92be80cd78886e7ad840cab6ce718cd6ad973dd6

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 2 ++
 3 files changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h +8 -0
index 5587fac671bb..68959b923f89 100644
@@ -48,6 +48,8 @@ struct amdgpu_doorbell_index {
 	uint32_t mec_ring5;
 	uint32_t mec_ring6;
 	uint32_t mec_ring7;
+	uint32_t userqueue_start;
+	uint32_t userqueue_end;
 	uint32_t gfx_ring0;
 	uint32_t sdma_engine[8];
 	uint32_t ih;
@@ -111,6 +113,8 @@ typedef enum _AMDGPU_VEGA20_DOORBELL_ASSIGNMENT
 	AMDGPU_VEGA20_DOORBELL_MEC_RING5               = 0x008,
 	AMDGPU_VEGA20_DOORBELL_MEC_RING6               = 0x009,
 	AMDGPU_VEGA20_DOORBELL_MEC_RING7               = 0x00A,
+	AMDGPU_VEGA20_DOORBELL_USERQUEUE_START	       = 0x00B,
+	AMDGPU_VEGA20_DOORBELL_USERQUEUE_END	       = 0x08A,
 	AMDGPU_VEGA20_DOORBELL_GFX_RING0               = 0x08B,
 	/* SDMA:256~335*/
 	AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0            = 0x100,
@@ -178,6 +182,10 @@ typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT
 	AMDGPU_DOORBELL64_MEC_RING6               = 0x09,
 	AMDGPU_DOORBELL64_MEC_RING7               = 0x0a,
 
+	/* User queue doorbell range (128 doorbells) */
+	AMDGPU_DOORBELL64_USERQUEUE_START         = 0x0b,
+	AMDGPU_DOORBELL64_USERQUEUE_END           = 0x8a,
+
 	/* Graphics engine */
 	AMDGPU_DOORBELL64_GFX_RING0               = 0x8b,
 
drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c +2 -0
index 5e9e53143a8e..a8e92638a2e8 100644
@@ -67,6 +67,8 @@ void vega10_doorbell_index_init(struct amdgpu_device *adev)
 	adev->doorbell_index.mec_ring5 = AMDGPU_DOORBELL64_MEC_RING5;
 	adev->doorbell_index.mec_ring6 = AMDGPU_DOORBELL64_MEC_RING6;
 	adev->doorbell_index.mec_ring7 = AMDGPU_DOORBELL64_MEC_RING7;
+	adev->doorbell_index.userqueue_start = AMDGPU_DOORBELL64_USERQUEUE_START;
+	adev->doorbell_index.userqueue_end = AMDGPU_DOORBELL64_USERQUEUE_END;
 	adev->doorbell_index.gfx_ring0 = AMDGPU_DOORBELL64_GFX_RING0;
 	adev->doorbell_index.sdma_engine[0] = AMDGPU_DOORBELL64_sDMA_ENGINE0;
 	adev->doorbell_index.sdma_engine[1] = AMDGPU_DOORBELL64_sDMA_ENGINE1;
drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c +2 -0
index fb6398e38be9..0db84386252a 100644
@@ -65,6 +65,8 @@ void vega20_doorbell_index_init(struct amdgpu_device *adev)
 	adev->doorbell_index.mec_ring5 = AMDGPU_VEGA20_DOORBELL_MEC_RING5;
 	adev->doorbell_index.mec_ring6 = AMDGPU_VEGA20_DOORBELL_MEC_RING6;
 	adev->doorbell_index.mec_ring7 = AMDGPU_VEGA20_DOORBELL_MEC_RING7;
+	adev->doorbell_index.userqueue_start = AMDGPU_VEGA20_DOORBELL_USERQUEUE_START;
+	adev->doorbell_index.userqueue_end = AMDGPU_VEGA20_DOORBELL_USERQUEUE_END;
 	adev->doorbell_index.gfx_ring0 = AMDGPU_VEGA20_DOORBELL_GFX_RING0;
 	adev->doorbell_index.sdma_engine[0] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0;
 	adev->doorbell_index.sdma_engine[1] = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

PATCH 2/2 Revert "drm/amdgpu: Fix bugs in setting CP RB/MEC DOORBELL_RANGE registers"

The original change caused regression, so revert it until the new fix is ready.
https://bugs.freedesktop.org/show_bug.cgi?id=109650

This reverts commit 764c85fef41722db0f21558c6c2fb38bee172d19.

Change-Id I6c634d8bdb98efcfdec33581d92f7ba02416061b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 19 ++++---------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 19 +++++--------------
 2 files changed, 9 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -15
index 41cf9d0224d9..b8e50a34bdb3 100644
@@ -4223,8 +4223,8 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu
 					adev->doorbell_index.gfx_ring0);
 	WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-	/* There is only one GFX queue */
-	WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+	WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,
+		CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 }
 
 static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)
@@ -4646,19 +4646,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev)
 {
 	if (adev->asic_type > CHIP_TONGA) {
-		/* The first few doorbells in pci doorbell bar are for GFX RB
-		 * rings and all the leftover for MEC.
-		 * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-		 * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-		 * GFX RB rings.
-		 */
-		u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-				DOORBELL_RANGE_LOWER,
-				adev->gfx.gfx_ring[0].doorbell_index + 1);
-
-		WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
-		WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
-				CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+		WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq << 2);
+		WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 << 2);
 	}
 	/* enable doorbells */
 	WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -14
index 36f417fd6ba9..5533f6e4f4a4 100644
@@ -2631,8 +2631,8 @@ static int gfx_v9_0_cp_gfx_resume(struct amdgpu_device *adev)
 			DOORBELL_RANGE_LOWER, ring->doorbell_index);
 	WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-	/* There is only one GFX queue */
-	WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+	WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER,
+		       CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 
 
 	/* start the ring */
@@ -2995,19 +2995,10 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
 
 	/* enable the doorbell if requested */
 	if (ring->use_doorbell) {
-		/* The first few doorbells in pci doorbell bar are for GFX RB
-		 * rings and all the leftover for MEC.
-		 * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-		 * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-		 * GFX RB rings.
-		 */
-		u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-				DOORBELL_RANGE_LOWER,
-				adev->gfx.gfx_ring[0].doorbell_index + 2);
-
-		WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
+		WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
+					(adev->doorbell_index.kiq * 2) << 2);
 		WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
-				CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+					(adev->doorbell_index.userqueue_end * 2) << 2);
 	}
 
 	WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Acked-by
#4 lore raw

Re: [PATCH 2/2] Revert "drm/amdgpu: Fix bugs in setting CP RB/MEC DOORBELL_RANGE registers"

Quoted 4 lines · Yong

The original change caused regression, so revert it until the new fix is ready.
https://bugs.freedesktop.org/show_bug.cgi?id=109650

Make this:

With that fixed:

Quoted 88 lines

This reverts commit 764c85fef41722db0f21558c6c2fb38bee172d19.

Change-Id I6c634d8bdb98efcfdec33581d92f7ba02416061b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 19 ++++---------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 19 +++++--------------
 2 files changed, 9 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -15
index 41cf9d0224d9..b8e50a34bdb3 100644
@@ -4223,8 +4223,8 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu
                                        adev->doorbell_index.gfx_ring0);
        WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,
+               CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 }
 
 static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)
@@ -4646,19 +4646,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev)
 {
        if (adev->asic_type > CHIP_TONGA) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 1);
-
-               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
-               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq << 2);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 << 2);
        }
        /* enable doorbells */
        WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -15
index 36f417fd6ba9..5533f6e4f4a4 100644
@@ -2631,8 +2631,8 @@ static int gfx_v9_0_cp_gfx_resume(struct amdgpu_device *adev)
                        DOORBELL_RANGE_LOWER, ring->doorbell_index);
        WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER,
+                      CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 
 
        /* start the ring */
@@ -2995,19 +2995,10 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
 
        /* enable the doorbell if requested */
        if (ring->use_doorbell) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 2);
-
-               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
+               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
+                                       (adev->doorbell_index.kiq * 2) << 2);
                WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+                                       (adev->doorbell_index.userqueue_end * 2) << 2);
        }
 
        WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_NyHKfZhw0Tj1zY2vcbAbVK0qkqkeswkxFA3eLs+tHRdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] Revert "drm/amdgpu: Fix bugs in setting CP RB/MEC DOORBELL_RANGE registers"

Quoted 11 lines · Alex Deucher
Quoted 4 lines · Yong

The original change caused regression, so revert it until the new fix is ready.
https://bugs.freedesktop.org/show_bug.cgi?id=109650

Make this:

With that fixed:

With that fixed, For the series,

Quoted 86 lines
Quoted 84 lines

This reverts commit 764c85fef41722db0f21558c6c2fb38bee172d19.

Change-Id I6c634d8bdb98efcfdec33581d92f7ba02416061b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 19 ++++---------------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 19 +++++--------------
 2 files changed, 9 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -15
index 41cf9d0224d9..b8e50a34bdb3 100644
@@ -4223,8 +4223,8 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu
                                        adev->doorbell_index.gfx_ring0);
        WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,
+               CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 }
 
 static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)
@@ -4646,19 +4646,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
 static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev)
 {
        if (adev->asic_type > CHIP_TONGA) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 1);
-
-               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
-               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq << 2);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 << 2);
        }
        /* enable doorbells */
        WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -14
index 36f417fd6ba9..5533f6e4f4a4 100644
@@ -2631,8 +2631,8 @@ static int gfx_v9_0_cp_gfx_resume(struct amdgpu_device *adev)
                        DOORBELL_RANGE_LOWER, ring->doorbell_index);
        WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER,
+                      CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 
 
        /* start the ring */
@@ -2995,19 +2995,10 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
 
        /* enable the doorbell if requested */
        if (ring->use_doorbell) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 2);
-
-               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
+               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
+                                       (adev->doorbell_index.kiq * 2) << 2);
                WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+                                       (adev->doorbell_index.userqueue_end * 2) << 2);
        }
 
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
        WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
--

2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_PADjwxFrLCat-0tBFC21V8GZshSNAcH+5Q=PA1cU+yGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] Revert "drm/amdgpu: Fix bugs in setting CP RB/MEC DOORBELL_RANGE registers"

Quoted 12 lines · Alex Deucher
Quoted 8 lines · Alex Deucher
Quoted 3 lines · Yong

The original change caused regression, so revert it until the new fix is ready.
https://bugs.freedesktop.org/show_bug.cgi?id=109650

Make this:

With that fixed:

With that fixed, For the series,

Quoted 1 line

With Alex's comment addressed, the series is Reviewed-by: Felix Kuehling <[email protected]>

Quoted 88 lines
Quoted 88 lines
Quoted 88 lines

This reverts commit 764c85fef41722db0f21558c6c2fb38bee172d19.

Change-Id I6c634d8bdb98efcfdec33581d92f7ba02416061b
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 19 ++++---------------
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 19 +++++--------------
  2 files changed, 9 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -15
index 41cf9d0224d9..b8e50a34bdb3 100644
@@ -4223,8 +4223,8 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu
                                         adev->doorbell_index.gfx_ring0);
         WREG32(mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,
+               CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
  }
 
  static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev)
@@ -4646,19 +4646,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
  static void gfx_v8_0_set_mec_doorbell_range(struct amdgpu_device *adev)
  {
         if (adev->asic_type > CHIP_TONGA) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 1);
-
-               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
-               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq << 2);
+               WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 << 2);
         }
         /* enable doorbells */
         WREG32_FIELD(CP_PQ_STATUS, DOORBELL_ENABLE, 1);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -15
index 36f417fd6ba9..5533f6e4f4a4 100644
@@ -2631,8 +2631,8 @@ static int gfx_v9_0_cp_gfx_resume(struct amdgpu_device *adev)
                         DOORBELL_RANGE_LOWER, ring->doorbell_index);
         WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_LOWER, tmp);
 
-       /* There is only one GFX queue */
-       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER, tmp);
+       WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_RANGE_UPPER,
+                      CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
 
 
         /* start the ring */
@@ -2995,19 +2995,10 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)
 
         /* enable the doorbell if requested */
         if (ring->use_doorbell) {
-               /* The first few doorbells in pci doorbell bar are for GFX RB
-                * rings and all the leftover for MEC.
-                * So CP_MEC_DOORBELL_RANGE_LOWER should be set one index after
-                * CP_RB_DOORBELL_RANGE_UPPER, as we assume there is only one
-                * GFX RB rings.
-                */
-               u32 tmp = REG_SET_FIELD(0, CP_MEC_DOORBELL_RANGE_LOWER,
-                               DOORBELL_RANGE_LOWER,
-                               adev->gfx.gfx_ring[0].doorbell_index + 2);
-
-               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER, tmp);
+               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,
+                                       (adev->doorbell_index.kiq * 2) << 2);
                 WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,
-                               CP_MEC_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK);
+                                       (adev->doorbell_index.userqueue_end * 2) << 2);
         }
 
         WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
--

2.17.1

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx