Skip to content

Commit 194bcf3

Browse files
Tianci.Yinalexdeucher
authored andcommitted
drm/amdgpu: disable 3D pipe 1 on Navi1x
[why] CP firmware decide to skip setting the state for 3D pipe 1 for Navi1x as there is no use case. [how] Disable 3D pipe 1 on Navi1x. Reviewed-by: Feifei Xu <Feifei.Xu@amd.com> Reviewed-by: Monk Liu <monk.liu@amd.com> Signed-off-by: Tianci.Yin <tianci.yin@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 2ab7e27 commit 194bcf3

File tree

1 file changed

+51
-46
lines changed

1 file changed

+51
-46
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* 1. Primary ring
5353
* 2. Async ring
5454
*/
55-
#define GFX10_NUM_GFX_RINGS 2
55+
#define GFX10_NUM_GFX_RINGS_NV1X 1
5656
#define GFX10_MEC_HPD_SIZE 2048
5757

5858
#define F32_CE_PROGRAM_RAM_SIZE 65536
@@ -1304,7 +1304,7 @@ static int gfx_v10_0_sw_init(void *handle)
13041304
case CHIP_NAVI14:
13051305
case CHIP_NAVI12:
13061306
adev->gfx.me.num_me = 1;
1307-
adev->gfx.me.num_pipe_per_me = 2;
1307+
adev->gfx.me.num_pipe_per_me = 1;
13081308
adev->gfx.me.num_queue_per_pipe = 1;
13091309
adev->gfx.mec.num_mec = 2;
13101310
adev->gfx.mec.num_pipe_per_mec = 4;
@@ -2710,18 +2710,20 @@ static int gfx_v10_0_cp_gfx_start(struct amdgpu_device *adev)
27102710
amdgpu_ring_commit(ring);
27112711

27122712
/* submit cs packet to copy state 0 to next available state */
2713-
ring = &adev->gfx.gfx_ring[1];
2714-
r = amdgpu_ring_alloc(ring, 2);
2715-
if (r) {
2716-
DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);
2717-
return r;
2718-
}
2719-
2720-
amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));
2721-
amdgpu_ring_write(ring, 0);
2713+
if (adev->gfx.num_gfx_rings > 1) {
2714+
/* maximum supported gfx ring is 2 */
2715+
ring = &adev->gfx.gfx_ring[1];
2716+
r = amdgpu_ring_alloc(ring, 2);
2717+
if (r) {
2718+
DRM_ERROR("amdgpu: cp failed to lock ring (%d).\n", r);
2719+
return r;
2720+
}
27222721

2723-
amdgpu_ring_commit(ring);
2722+
amdgpu_ring_write(ring, PACKET3(PACKET3_CLEAR_STATE, 0));
2723+
amdgpu_ring_write(ring, 0);
27242724

2725+
amdgpu_ring_commit(ring);
2726+
}
27252727
return 0;
27262728
}
27272729

@@ -2818,39 +2820,41 @@ static int gfx_v10_0_cp_gfx_resume(struct amdgpu_device *adev)
28182820
mutex_unlock(&adev->srbm_mutex);
28192821

28202822
/* Init gfx ring 1 for pipe 1 */
2821-
mutex_lock(&adev->srbm_mutex);
2822-
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);
2823-
ring = &adev->gfx.gfx_ring[1];
2824-
rb_bufsz = order_base_2(ring->ring_size / 8);
2825-
tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);
2826-
tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);
2827-
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
2828-
/* Initialize the ring buffer's write pointers */
2829-
ring->wptr = 0;
2830-
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));
2831-
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));
2832-
/* Set the wb address wether it's enabled or not */
2833-
rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
2834-
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));
2835-
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &
2836-
CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);
2837-
wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);
2838-
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,
2839-
lower_32_bits(wptr_gpu_addr));
2840-
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
2841-
upper_32_bits(wptr_gpu_addr));
2842-
2843-
mdelay(1);
2844-
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
2845-
2846-
rb_addr = ring->gpu_addr >> 8;
2847-
WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);
2848-
WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));
2849-
WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);
2850-
2851-
gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
2852-
mutex_unlock(&adev->srbm_mutex);
2853-
2823+
if (adev->gfx.num_gfx_rings > 1) {
2824+
mutex_lock(&adev->srbm_mutex);
2825+
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID1);
2826+
/* maximum supported gfx ring is 2 */
2827+
ring = &adev->gfx.gfx_ring[1];
2828+
rb_bufsz = order_base_2(ring->ring_size / 8);
2829+
tmp = REG_SET_FIELD(0, CP_RB1_CNTL, RB_BUFSZ, rb_bufsz);
2830+
tmp = REG_SET_FIELD(tmp, CP_RB1_CNTL, RB_BLKSZ, rb_bufsz - 2);
2831+
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
2832+
/* Initialize the ring buffer's write pointers */
2833+
ring->wptr = 0;
2834+
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR, lower_32_bits(ring->wptr));
2835+
WREG32_SOC15(GC, 0, mmCP_RB1_WPTR_HI, upper_32_bits(ring->wptr));
2836+
/* Set the wb address wether it's enabled or not */
2837+
rptr_addr = adev->wb.gpu_addr + (ring->rptr_offs * 4);
2838+
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR, lower_32_bits(rptr_addr));
2839+
WREG32_SOC15(GC, 0, mmCP_RB1_RPTR_ADDR_HI, upper_32_bits(rptr_addr) &
2840+
CP_RB1_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK);
2841+
wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4);
2842+
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_LO,
2843+
lower_32_bits(wptr_gpu_addr));
2844+
WREG32_SOC15(GC, 0, mmCP_RB_WPTR_POLL_ADDR_HI,
2845+
upper_32_bits(wptr_gpu_addr));
2846+
2847+
mdelay(1);
2848+
WREG32_SOC15(GC, 0, mmCP_RB1_CNTL, tmp);
2849+
2850+
rb_addr = ring->gpu_addr >> 8;
2851+
WREG32_SOC15(GC, 0, mmCP_RB1_BASE, rb_addr);
2852+
WREG32_SOC15(GC, 0, mmCP_RB1_BASE_HI, upper_32_bits(rb_addr));
2853+
WREG32_SOC15(GC, 0, mmCP_RB1_ACTIVE, 1);
2854+
2855+
gfx_v10_0_cp_gfx_set_doorbell(adev, ring);
2856+
mutex_unlock(&adev->srbm_mutex);
2857+
}
28542858
/* Switch to pipe 0 */
28552859
mutex_lock(&adev->srbm_mutex);
28562860
gfx_v10_0_cp_gfx_switch_pipe(adev, PIPE_ID0);
@@ -3967,7 +3971,8 @@ static int gfx_v10_0_early_init(void *handle)
39673971
{
39683972
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
39693973

3970-
adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS;
3974+
adev->gfx.num_gfx_rings = GFX10_NUM_GFX_RINGS_NV1X;
3975+
39713976
adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS;
39723977

39733978
gfx_v10_0_set_kiq_pm4_funcs(adev);

0 commit comments

Comments
 (0)