Skip to contentSkip to conversation

drm/amd/amdgpu: Enable gfx pipe1 and fix related issues

PATCH Superseded Emily Deng 2 participants 2 messages Nov 4, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Emily Deng

author
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: Enable gfx pipe1 and fix related issues

Starting from SIENNA CICHLID asic supports two gfx pipes, enabling two graphics queues for performance concern.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 42 ++++++++++++-------------
 2 files changed, 22 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
index 331aa191910c..0072f36b44d1 100644
@@ -33,7 +33,7 @@
 	container_of((e), struct amdgpu_ctx_entity, entity)
 
 const unsigned int amdgpu_ctx_num_entities[AMDGPU_HW_IP_NUM] = {
-	[AMDGPU_HW_IP_GFX]	=	1,
+	[AMDGPU_HW_IP_GFX]	=	2,
 	[AMDGPU_HW_IP_COMPUTE]	=	4,
 	[AMDGPU_HW_IP_DMA]	=	2,
 	[AMDGPU_HW_IP_UVD]	=	1,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +21 -21

72 lines not on this page · raw message

Signature · 1 line
2.36.1
#1 lore raw

Am 04.11.22 um 12:19 schrieb Emily Deng:

Quoted 14 lines

Starting from SIENNA CICHLID asic supports two gfx pipes, enabling two graphics queues for performance concern.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  2 +-
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 42 ++++++++++++-------------
  2 files changed, 22 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
index 331aa191910c..0072f36b44d1 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c line 36

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
@@ -33,7 +33,7 @@
  	container_of((e), struct amdgpu_ctx_entity, entity)
 
  const unsigned int amdgpu_ctx_num_entities[AMDGPU_HW_IP_NUM] = {
-	[AMDGPU_HW_IP_GFX]	=	1,
+	[AMDGPU_HW_IP_GFX]	=	2,

Again, please completely drop this. That change absolutely makes no sense at all.

Regards,
Christian.

Quoted 84 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
  	[AMDGPU_HW_IP_COMPUTE]	=	4,
  	[AMDGPU_HW_IP_DMA]	=	2,
  	[AMDGPU_HW_IP_UVD]	=	1,
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +21 -21
index 49d34c7bbf20..bbf18060611e 100644
@@ -4606,7 +4606,7 @@ static int gfx_v10_0_sw_init(void *handle)
  	case IP_VERSION(10, 3, 3):
  	case IP_VERSION(10, 3, 7):
  		adev->gfx.me.num_me = 1;
-		adev->gfx.me.num_pipe_per_me = 1;
+		adev->gfx.me.num_pipe_per_me = 2;
  		adev->gfx.me.num_queue_per_pipe = 1;
  		adev->gfx.mec.num_mec = 2;
  		adev->gfx.mec.num_pipe_per_mec = 4;
@@ -6008,6 +6008,24 @@ static int gfx_v10_0_cp_gfx_load_microcode(struct amdgpu_device *adev)
  	return 0;
  }
 
+static int gfx_v10_0_wait_for_idle(void *handle)
+{
+	unsigned i;
+	u32 tmp;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	for (i = 0; i < adev->usec_timeout; i++) {
+		/* read MC_STATUS */
+		tmp = RREG32_SOC15(GC, 0, mmGRBM_STATUS) &
+			GRBM_STATUS__GUI_ACTIVE_MASK;
+
+		if (!REG_GET_FIELD(tmp, GRBM_STATUS, GUI_ACTIVE))
+			return 0;
+		udelay(1);
+	}
+	return -ETIMEDOUT;
+}
+
  static int gfx_v10_0_cp_gfx_start(struct amdgpu_device *adev)
  {
  	struct amdgpu_ring *ring;
@@ -6069,7 +6087,7 @@ static int gfx_v10_0_cp_gfx_start(struct amdgpu_device *adev)
  	amdgpu_ring_write(ring, 0x8000);
 
  	amdgpu_ring_commit(ring);
-
+	gfx_v10_0_wait_for_idle(adev);
  	/* submit cs packet to copy state 0 to next available state */
  	if (adev->gfx.num_gfx_rings > 1) {
  		/* maximum supported gfx ring is 2 */
@@ -7404,24 +7422,6 @@ static bool gfx_v10_0_is_idle(void *handle)
  		return true;
  }
 
-static int gfx_v10_0_wait_for_idle(void *handle)
-{
-	unsigned i;
-	u32 tmp;
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-	for (i = 0; i < adev->usec_timeout; i++) {
-		/* read MC_STATUS */
-		tmp = RREG32_SOC15(GC, 0, mmGRBM_STATUS) &
-			GRBM_STATUS__GUI_ACTIVE_MASK;
-
-		if (!REG_GET_FIELD(tmp, GRBM_STATUS, GUI_ACTIVE))
-			return 0;
-		udelay(1);
-	}
-	return -ETIMEDOUT;
-}
-
  static int gfx_v10_0_soft_reset(void *handle)
  {
  	u32 grbm_soft_reset = 0;
@@ -8466,7 +8466,7 @@ static void gfx_v10_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
  		}
  		reg_mem_engine = 0;
  	} else {
-		ref_and_mask = nbio_hf_reg->ref_and_mask_cp0;
+		ref_and_mask = nbio_hf_reg->ref_and_mask_cp0 << ring->pipe;
  		reg_mem_engine = 1; /* pfp */
  	}