Skip to contentSkip to conversation

drm/amdgpu: Add gfx doorbell setting for Vangogh

PATCH In review Jinzhou Su 2 participants 2 messages Nov 18, 2020 – Nov 19, 2020

Subsystems (2)
lore
Share & tools
lore

Jinzhou Su

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Add gfx doorbell setting for Vangogh

Using KIQ to map GFX queues instead of MMIO for gfx async ring, add missing doorbell range setting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +14 -10
index a6d03931f7fa..9b4e5d53432f 100644
@@ -5995,17 +5995,19 @@ static void gfx_v10_0_cp_gfx_set_doorbell(struct amdgpu_device *adev,
 {
 	u32 tmp;
 
-	tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);
-	if (ring->use_doorbell) {
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_OFFSET, ring->doorbell_index);
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_EN, 1);
-	} else {
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_EN, 0);
+	if (!amdgpu_async_gfx_ring) {
+	    tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);
+	    if (ring->use_doorbell) {
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_OFFSET, ring->doorbell_index);
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_EN, 1);
+	    } else {
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_EN, 0);
+	    }
+	    WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
 	}
-	WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
 	switch (adev->asic_type) {
 	case CHIP_SIENNA_CICHLID:
 	case CHIP_NAVY_FLOUNDER:
@@ -6349,6 +6351,8 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_ring *ring)
 				    DOORBELL_EN, 0);
 	mqd->cp_rb_doorbell_control = tmp;
 
+	/* set doorbell range */
+	gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
 	/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */
 	ring->wptr = 0;
 	mqd->cp_gfx_hqd_rptr = RREG32_SOC15(GC, 0, mmCP_GFX_HQD_RPTR);
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 17 lines · Jinzhou (Joe)

Using KIQ to map GFX queues instead of MMIO for gfx async ring, add missing doorbell range setting.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -1
index a6d03931f7fa..9b4e5d53432f 100644
@@ -5995,17 +5995,19 @@ static void gfx_v10_0_cp_gfx_set_doorbell(struct amdgpu_device *adev,
 {
 	u32 tmp;
 
-	tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c static void gfx_v10_0_cp_gfx_set_doorbell(struct amdgpu_device *adev, · line 5999

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -8
-	if (ring->use_doorbell) {
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_OFFSET, ring->doorbell_index);
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_EN, 1);
-	} else {
-		tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
-				    DOORBELL_EN, 0);
+	if (!amdgpu_async_gfx_ring) {
+	    tmp = RREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL);

Please use checkpatch.pl to fix the code style issue. And double check it on SIENNA CICHLID card.

Thanks,
Ray

Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +12 -1
+	    if (ring->use_doorbell) {
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_OFFSET, ring->doorbell_index);
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_EN, 1);
+	    } else {
+		    tmp = REG_SET_FIELD(tmp, CP_RB_DOORBELL_CONTROL,
+				        DOORBELL_EN, 0);
+	    }
+	    WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
 	}
-	WREG32_SOC15(GC, 0, mmCP_RB_DOORBELL_CONTROL, tmp);
 	switch (adev->asic_type) {
 	case CHIP_SIENNA_CICHLID:
 	case CHIP_NAVY_FLOUNDER:
@@ -6349,6 +6351,8 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_ring *ring)
 				    DOORBELL_EN, 0);
 	mqd->cp_rb_doorbell_control = tmp;
 
+	/* set doorbell range */
+	gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
 	/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */
 	ring->wptr = 0;
 	mqd->cp_gfx_hqd_rptr = RREG32_SOC15(GC, 0, mmCP_GFX_HQD_RPTR);
Signature · 1 line
2.17.1

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