diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 209 |
1 files changed, 120 insertions, 89 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index ee6a48a09214..1c2544f314c0 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -1058,6 +1058,19 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
1058 | adev->firmware.fw_size += | 1058 | adev->firmware.fw_size += |
1059 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); | 1059 | ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); |
1060 | 1060 | ||
1061 | /* we need account JT in */ | ||
1062 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
1063 | adev->firmware.fw_size += | ||
1064 | ALIGN(le32_to_cpu(cp_hdr->jt_size) << 2, PAGE_SIZE); | ||
1065 | |||
1066 | if (amdgpu_sriov_vf(adev)) { | ||
1067 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_STORAGE]; | ||
1068 | info->ucode_id = AMDGPU_UCODE_ID_STORAGE; | ||
1069 | info->fw = adev->gfx.mec_fw; | ||
1070 | adev->firmware.fw_size += | ||
1071 | ALIGN(le32_to_cpu(64 * PAGE_SIZE), PAGE_SIZE); | ||
1072 | } | ||
1073 | |||
1061 | if (adev->gfx.mec2_fw) { | 1074 | if (adev->gfx.mec2_fw) { |
1062 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2]; | 1075 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CP_MEC2]; |
1063 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2; | 1076 | info->ucode_id = AMDGPU_UCODE_ID_CP_MEC2; |
@@ -1127,34 +1140,8 @@ static void gfx_v8_0_get_csb_buffer(struct amdgpu_device *adev, | |||
1127 | buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2)); | 1140 | buffer[count++] = cpu_to_le32(PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
1128 | buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - | 1141 | buffer[count++] = cpu_to_le32(mmPA_SC_RASTER_CONFIG - |
1129 | PACKET3_SET_CONTEXT_REG_START); | 1142 | PACKET3_SET_CONTEXT_REG_START); |
1130 | switch (adev->asic_type) { | 1143 | buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config); |
1131 | case CHIP_TONGA: | 1144 | buffer[count++] = cpu_to_le32(adev->gfx.config.rb_config[0][0].raster_config_1); |
1132 | case CHIP_POLARIS10: | ||
1133 | buffer[count++] = cpu_to_le32(0x16000012); | ||
1134 | buffer[count++] = cpu_to_le32(0x0000002A); | ||
1135 | break; | ||
1136 | case CHIP_POLARIS11: | ||
1137 | buffer[count++] = cpu_to_le32(0x16000012); | ||
1138 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1139 | break; | ||
1140 | case CHIP_FIJI: | ||
1141 | buffer[count++] = cpu_to_le32(0x3a00161a); | ||
1142 | buffer[count++] = cpu_to_le32(0x0000002e); | ||
1143 | break; | ||
1144 | case CHIP_TOPAZ: | ||
1145 | case CHIP_CARRIZO: | ||
1146 | buffer[count++] = cpu_to_le32(0x00000002); | ||
1147 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1148 | break; | ||
1149 | case CHIP_STONEY: | ||
1150 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1151 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1152 | break; | ||
1153 | default: | ||
1154 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1155 | buffer[count++] = cpu_to_le32(0x00000000); | ||
1156 | break; | ||
1157 | } | ||
1158 | 1145 | ||
1159 | buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); | 1146 | buffer[count++] = cpu_to_le32(PACKET3(PACKET3_PREAMBLE_CNTL, 0)); |
1160 | buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); | 1147 | buffer[count++] = cpu_to_le32(PACKET3_PREAMBLE_END_CLEAR_STATE); |
@@ -1273,7 +1260,8 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev) | |||
1273 | if (adev->gfx.rlc.clear_state_obj == NULL) { | 1260 | if (adev->gfx.rlc.clear_state_obj == NULL) { |
1274 | r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, | 1261 | r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, |
1275 | AMDGPU_GEM_DOMAIN_VRAM, | 1262 | AMDGPU_GEM_DOMAIN_VRAM, |
1276 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, | 1263 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
1264 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | ||
1277 | NULL, NULL, | 1265 | NULL, NULL, |
1278 | &adev->gfx.rlc.clear_state_obj); | 1266 | &adev->gfx.rlc.clear_state_obj); |
1279 | if (r) { | 1267 | if (r) { |
@@ -1315,7 +1303,8 @@ static int gfx_v8_0_rlc_init(struct amdgpu_device *adev) | |||
1315 | if (adev->gfx.rlc.cp_table_obj == NULL) { | 1303 | if (adev->gfx.rlc.cp_table_obj == NULL) { |
1316 | r = amdgpu_bo_create(adev, adev->gfx.rlc.cp_table_size, PAGE_SIZE, true, | 1304 | r = amdgpu_bo_create(adev, adev->gfx.rlc.cp_table_size, PAGE_SIZE, true, |
1317 | AMDGPU_GEM_DOMAIN_VRAM, | 1305 | AMDGPU_GEM_DOMAIN_VRAM, |
1318 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, | 1306 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
1307 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | ||
1319 | NULL, NULL, | 1308 | NULL, NULL, |
1320 | &adev->gfx.rlc.cp_table_obj); | 1309 | &adev->gfx.rlc.cp_table_obj); |
1321 | if (r) { | 1310 | if (r) { |
@@ -2045,10 +2034,8 @@ static int gfx_v8_0_sw_init(void *handle) | |||
2045 | ring->doorbell_index = AMDGPU_DOORBELL_GFX_RING0; | 2034 | ring->doorbell_index = AMDGPU_DOORBELL_GFX_RING0; |
2046 | } | 2035 | } |
2047 | 2036 | ||
2048 | r = amdgpu_ring_init(adev, ring, 1024, | 2037 | r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq, |
2049 | PACKET3(PACKET3_NOP, 0x3FFF), 0xf, | 2038 | AMDGPU_CP_IRQ_GFX_EOP); |
2050 | &adev->gfx.eop_irq, AMDGPU_CP_IRQ_GFX_EOP, | ||
2051 | AMDGPU_RING_TYPE_GFX); | ||
2052 | if (r) | 2039 | if (r) |
2053 | return r; | 2040 | return r; |
2054 | } | 2041 | } |
@@ -2072,10 +2059,8 @@ static int gfx_v8_0_sw_init(void *handle) | |||
2072 | sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue); | 2059 | sprintf(ring->name, "comp_%d.%d.%d", ring->me, ring->pipe, ring->queue); |
2073 | irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; | 2060 | irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP + ring->pipe; |
2074 | /* type-2 packets are deprecated on MEC, use type-3 instead */ | 2061 | /* type-2 packets are deprecated on MEC, use type-3 instead */ |
2075 | r = amdgpu_ring_init(adev, ring, 1024, | 2062 | r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq, |
2076 | PACKET3(PACKET3_NOP, 0x3FFF), 0xf, | 2063 | irq_type); |
2077 | &adev->gfx.eop_irq, irq_type, | ||
2078 | AMDGPU_RING_TYPE_COMPUTE); | ||
2079 | if (r) | 2064 | if (r) |
2080 | return r; | 2065 | return r; |
2081 | } | 2066 | } |
@@ -3679,6 +3664,21 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev) | |||
3679 | num_rb_pipes); | 3664 | num_rb_pipes); |
3680 | } | 3665 | } |
3681 | 3666 | ||
3667 | /* cache the values for userspace */ | ||
3668 | for (i = 0; i < adev->gfx.config.max_shader_engines; i++) { | ||
3669 | for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) { | ||
3670 | gfx_v8_0_select_se_sh(adev, i, j, 0xffffffff); | ||
3671 | adev->gfx.config.rb_config[i][j].rb_backend_disable = | ||
3672 | RREG32(mmCC_RB_BACKEND_DISABLE); | ||
3673 | adev->gfx.config.rb_config[i][j].user_rb_backend_disable = | ||
3674 | RREG32(mmGC_USER_RB_BACKEND_DISABLE); | ||
3675 | adev->gfx.config.rb_config[i][j].raster_config = | ||
3676 | RREG32(mmPA_SC_RASTER_CONFIG); | ||
3677 | adev->gfx.config.rb_config[i][j].raster_config_1 = | ||
3678 | RREG32(mmPA_SC_RASTER_CONFIG_1); | ||
3679 | } | ||
3680 | } | ||
3681 | gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff); | ||
3682 | mutex_unlock(&adev->grbm_idx_mutex); | 3682 | mutex_unlock(&adev->grbm_idx_mutex); |
3683 | } | 3683 | } |
3684 | 3684 | ||
@@ -4331,7 +4331,7 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
4331 | struct amdgpu_ring *ring; | 4331 | struct amdgpu_ring *ring; |
4332 | u32 tmp; | 4332 | u32 tmp; |
4333 | u32 rb_bufsz; | 4333 | u32 rb_bufsz; |
4334 | u64 rb_addr, rptr_addr; | 4334 | u64 rb_addr, rptr_addr, wptr_gpu_addr; |
4335 | int r; | 4335 | int r; |
4336 | 4336 | ||
4337 | /* Set the write pointer delay */ | 4337 | /* Set the write pointer delay */ |
@@ -4362,6 +4362,9 @@ static int gfx_v8_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
4362 | WREG32(mmCP_RB0_RPTR_ADDR, lower_32_bits(rptr_addr)); | 4362 | WREG32(mmCP_RB0_RPTR_ADDR, lower_32_bits(rptr_addr)); |
4363 | WREG32(mmCP_RB0_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF); | 4363 | WREG32(mmCP_RB0_RPTR_ADDR_HI, upper_32_bits(rptr_addr) & 0xFF); |
4364 | 4364 | ||
4365 | wptr_gpu_addr = adev->wb.gpu_addr + (ring->wptr_offs * 4); | ||
4366 | WREG32(mmCP_RB_WPTR_POLL_ADDR_LO, lower_32_bits(wptr_gpu_addr)); | ||
4367 | WREG32(mmCP_RB_WPTR_POLL_ADDR_HI, upper_32_bits(wptr_gpu_addr)); | ||
4365 | mdelay(1); | 4368 | mdelay(1); |
4366 | WREG32(mmCP_RB0_CNTL, tmp); | 4369 | WREG32(mmCP_RB0_CNTL, tmp); |
4367 | 4370 | ||
@@ -5438,9 +5441,41 @@ static void gfx_v8_0_ring_emit_gds_switch(struct amdgpu_ring *ring, | |||
5438 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); | 5441 | amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); |
5439 | } | 5442 | } |
5440 | 5443 | ||
5444 | static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t address) | ||
5445 | { | ||
5446 | WREG32(mmSQ_IND_INDEX, (wave & 0xF) | ((simd & 0x3) << 4) | (address << 16) | (1 << 13)); | ||
5447 | return RREG32(mmSQ_IND_DATA); | ||
5448 | } | ||
5449 | |||
5450 | static void gfx_v8_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields) | ||
5451 | { | ||
5452 | /* type 0 wave data */ | ||
5453 | dst[(*no_fields)++] = 0; | ||
5454 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_STATUS); | ||
5455 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_PC_LO); | ||
5456 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_PC_HI); | ||
5457 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_EXEC_LO); | ||
5458 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_EXEC_HI); | ||
5459 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_HW_ID); | ||
5460 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_INST_DW0); | ||
5461 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_INST_DW1); | ||
5462 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_GPR_ALLOC); | ||
5463 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_LDS_ALLOC); | ||
5464 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TRAPSTS); | ||
5465 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_STS); | ||
5466 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TBA_LO); | ||
5467 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TBA_HI); | ||
5468 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TMA_LO); | ||
5469 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_TMA_HI); | ||
5470 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_IB_DBG0); | ||
5471 | dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0); | ||
5472 | } | ||
5473 | |||
5474 | |||
5441 | static const struct amdgpu_gfx_funcs gfx_v8_0_gfx_funcs = { | 5475 | static const struct amdgpu_gfx_funcs gfx_v8_0_gfx_funcs = { |
5442 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | 5476 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, |
5443 | .select_se_sh = &gfx_v8_0_select_se_sh, | 5477 | .select_se_sh = &gfx_v8_0_select_se_sh, |
5478 | .read_wave_data = &gfx_v8_0_read_wave_data, | ||
5444 | }; | 5479 | }; |
5445 | 5480 | ||
5446 | static int gfx_v8_0_early_init(void *handle) | 5481 | static int gfx_v8_0_early_init(void *handle) |
@@ -6120,7 +6155,7 @@ static void gfx_v8_0_ring_emit_hdp_flush(struct amdgpu_ring *ring) | |||
6120 | { | 6155 | { |
6121 | u32 ref_and_mask, reg_mem_engine; | 6156 | u32 ref_and_mask, reg_mem_engine; |
6122 | 6157 | ||
6123 | if (ring->type == AMDGPU_RING_TYPE_COMPUTE) { | 6158 | if (ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE) { |
6124 | switch (ring->me) { | 6159 | switch (ring->me) { |
6125 | case 1: | 6160 | case 1: |
6126 | ref_and_mask = GPU_HDP_FLUSH_DONE__CP2_MASK << ring->pipe; | 6161 | ref_and_mask = GPU_HDP_FLUSH_DONE__CP2_MASK << ring->pipe; |
@@ -6222,7 +6257,7 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr, | |||
6222 | 6257 | ||
6223 | static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) | 6258 | static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) |
6224 | { | 6259 | { |
6225 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | 6260 | int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX); |
6226 | uint32_t seq = ring->fence_drv.sync_seq; | 6261 | uint32_t seq = ring->fence_drv.sync_seq; |
6227 | uint64_t addr = ring->fence_drv.gpu_addr; | 6262 | uint64_t addr = ring->fence_drv.gpu_addr; |
6228 | 6263 | ||
@@ -6240,11 +6275,7 @@ static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) | |||
6240 | static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, | 6275 | static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring, |
6241 | unsigned vm_id, uint64_t pd_addr) | 6276 | unsigned vm_id, uint64_t pd_addr) |
6242 | { | 6277 | { |
6243 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | 6278 | int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX); |
6244 | |||
6245 | /* GFX8 emits 128 dw nop to prevent DE do vm_flush before CE finish CEIB */ | ||
6246 | if (usepfp) | ||
6247 | amdgpu_ring_insert_nop(ring, 128); | ||
6248 | 6279 | ||
6249 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 6280 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
6250 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | 6281 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
@@ -6360,42 +6391,6 @@ static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) | |||
6360 | amdgpu_ring_write(ring, 0); | 6391 | amdgpu_ring_write(ring, 0); |
6361 | } | 6392 | } |
6362 | 6393 | ||
6363 | static unsigned gfx_v8_0_ring_get_emit_ib_size_gfx(struct amdgpu_ring *ring) | ||
6364 | { | ||
6365 | return | ||
6366 | 4; /* gfx_v8_0_ring_emit_ib_gfx */ | ||
6367 | } | ||
6368 | |||
6369 | static unsigned gfx_v8_0_ring_get_dma_frame_size_gfx(struct amdgpu_ring *ring) | ||
6370 | { | ||
6371 | return | ||
6372 | 20 + /* gfx_v8_0_ring_emit_gds_switch */ | ||
6373 | 7 + /* gfx_v8_0_ring_emit_hdp_flush */ | ||
6374 | 5 + /* gfx_v8_0_ring_emit_hdp_invalidate */ | ||
6375 | 6 + 6 + 6 +/* gfx_v8_0_ring_emit_fence_gfx x3 for user fence, vm fence */ | ||
6376 | 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ | ||
6377 | 256 + 19 + /* gfx_v8_0_ring_emit_vm_flush */ | ||
6378 | 2 + /* gfx_v8_ring_emit_sb */ | ||
6379 | 3; /* gfx_v8_ring_emit_cntxcntl */ | ||
6380 | } | ||
6381 | |||
6382 | static unsigned gfx_v8_0_ring_get_emit_ib_size_compute(struct amdgpu_ring *ring) | ||
6383 | { | ||
6384 | return | ||
6385 | 4; /* gfx_v8_0_ring_emit_ib_compute */ | ||
6386 | } | ||
6387 | |||
6388 | static unsigned gfx_v8_0_ring_get_dma_frame_size_compute(struct amdgpu_ring *ring) | ||
6389 | { | ||
6390 | return | ||
6391 | 20 + /* gfx_v8_0_ring_emit_gds_switch */ | ||
6392 | 7 + /* gfx_v8_0_ring_emit_hdp_flush */ | ||
6393 | 5 + /* gfx_v8_0_ring_emit_hdp_invalidate */ | ||
6394 | 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ | ||
6395 | 17 + /* gfx_v8_0_ring_emit_vm_flush */ | ||
6396 | 7 + 7 + 7; /* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ | ||
6397 | } | ||
6398 | |||
6399 | static void gfx_v8_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev, | 6394 | static void gfx_v8_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev, |
6400 | enum amdgpu_interrupt_state state) | 6395 | enum amdgpu_interrupt_state state) |
6401 | { | 6396 | { |
@@ -6541,7 +6536,7 @@ static int gfx_v8_0_priv_inst_irq(struct amdgpu_device *adev, | |||
6541 | return 0; | 6536 | return 0; |
6542 | } | 6537 | } |
6543 | 6538 | ||
6544 | const struct amd_ip_funcs gfx_v8_0_ip_funcs = { | 6539 | static const struct amd_ip_funcs gfx_v8_0_ip_funcs = { |
6545 | .name = "gfx_v8_0", | 6540 | .name = "gfx_v8_0", |
6546 | .early_init = gfx_v8_0_early_init, | 6541 | .early_init = gfx_v8_0_early_init, |
6547 | .late_init = gfx_v8_0_late_init, | 6542 | .late_init = gfx_v8_0_late_init, |
@@ -6562,10 +6557,22 @@ const struct amd_ip_funcs gfx_v8_0_ip_funcs = { | |||
6562 | }; | 6557 | }; |
6563 | 6558 | ||
6564 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { | 6559 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { |
6560 | .type = AMDGPU_RING_TYPE_GFX, | ||
6561 | .align_mask = 0xff, | ||
6562 | .nop = PACKET3(PACKET3_NOP, 0x3FFF), | ||
6565 | .get_rptr = gfx_v8_0_ring_get_rptr, | 6563 | .get_rptr = gfx_v8_0_ring_get_rptr, |
6566 | .get_wptr = gfx_v8_0_ring_get_wptr_gfx, | 6564 | .get_wptr = gfx_v8_0_ring_get_wptr_gfx, |
6567 | .set_wptr = gfx_v8_0_ring_set_wptr_gfx, | 6565 | .set_wptr = gfx_v8_0_ring_set_wptr_gfx, |
6568 | .parse_cs = NULL, | 6566 | .emit_frame_size = |
6567 | 20 + /* gfx_v8_0_ring_emit_gds_switch */ | ||
6568 | 7 + /* gfx_v8_0_ring_emit_hdp_flush */ | ||
6569 | 5 + /* gfx_v8_0_ring_emit_hdp_invalidate */ | ||
6570 | 6 + 6 + 6 +/* gfx_v8_0_ring_emit_fence_gfx x3 for user fence, vm fence */ | ||
6571 | 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ | ||
6572 | 128 + 19 + /* gfx_v8_0_ring_emit_vm_flush */ | ||
6573 | 2 + /* gfx_v8_ring_emit_sb */ | ||
6574 | 3, /* gfx_v8_ring_emit_cntxcntl */ | ||
6575 | .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_gfx */ | ||
6569 | .emit_ib = gfx_v8_0_ring_emit_ib_gfx, | 6576 | .emit_ib = gfx_v8_0_ring_emit_ib_gfx, |
6570 | .emit_fence = gfx_v8_0_ring_emit_fence_gfx, | 6577 | .emit_fence = gfx_v8_0_ring_emit_fence_gfx, |
6571 | .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync, | 6578 | .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync, |
@@ -6579,15 +6586,23 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { | |||
6579 | .pad_ib = amdgpu_ring_generic_pad_ib, | 6586 | .pad_ib = amdgpu_ring_generic_pad_ib, |
6580 | .emit_switch_buffer = gfx_v8_ring_emit_sb, | 6587 | .emit_switch_buffer = gfx_v8_ring_emit_sb, |
6581 | .emit_cntxcntl = gfx_v8_ring_emit_cntxcntl, | 6588 | .emit_cntxcntl = gfx_v8_ring_emit_cntxcntl, |
6582 | .get_emit_ib_size = gfx_v8_0_ring_get_emit_ib_size_gfx, | ||
6583 | .get_dma_frame_size = gfx_v8_0_ring_get_dma_frame_size_gfx, | ||
6584 | }; | 6589 | }; |
6585 | 6590 | ||
6586 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { | 6591 | static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { |
6592 | .type = AMDGPU_RING_TYPE_COMPUTE, | ||
6593 | .align_mask = 0xff, | ||
6594 | .nop = PACKET3(PACKET3_NOP, 0x3FFF), | ||
6587 | .get_rptr = gfx_v8_0_ring_get_rptr, | 6595 | .get_rptr = gfx_v8_0_ring_get_rptr, |
6588 | .get_wptr = gfx_v8_0_ring_get_wptr_compute, | 6596 | .get_wptr = gfx_v8_0_ring_get_wptr_compute, |
6589 | .set_wptr = gfx_v8_0_ring_set_wptr_compute, | 6597 | .set_wptr = gfx_v8_0_ring_set_wptr_compute, |
6590 | .parse_cs = NULL, | 6598 | .emit_frame_size = |
6599 | 20 + /* gfx_v8_0_ring_emit_gds_switch */ | ||
6600 | 7 + /* gfx_v8_0_ring_emit_hdp_flush */ | ||
6601 | 5 + /* gfx_v8_0_ring_emit_hdp_invalidate */ | ||
6602 | 7 + /* gfx_v8_0_ring_emit_pipeline_sync */ | ||
6603 | 17 + /* gfx_v8_0_ring_emit_vm_flush */ | ||
6604 | 7 + 7 + 7, /* gfx_v8_0_ring_emit_fence_compute x3 for user fence, vm fence */ | ||
6605 | .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_compute */ | ||
6591 | .emit_ib = gfx_v8_0_ring_emit_ib_compute, | 6606 | .emit_ib = gfx_v8_0_ring_emit_ib_compute, |
6592 | .emit_fence = gfx_v8_0_ring_emit_fence_compute, | 6607 | .emit_fence = gfx_v8_0_ring_emit_fence_compute, |
6593 | .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync, | 6608 | .emit_pipeline_sync = gfx_v8_0_ring_emit_pipeline_sync, |
@@ -6599,8 +6614,6 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_compute = { | |||
6599 | .test_ib = gfx_v8_0_ring_test_ib, | 6614 | .test_ib = gfx_v8_0_ring_test_ib, |
6600 | .insert_nop = amdgpu_ring_insert_nop, | 6615 | .insert_nop = amdgpu_ring_insert_nop, |
6601 | .pad_ib = amdgpu_ring_generic_pad_ib, | 6616 | .pad_ib = amdgpu_ring_generic_pad_ib, |
6602 | .get_emit_ib_size = gfx_v8_0_ring_get_emit_ib_size_compute, | ||
6603 | .get_dma_frame_size = gfx_v8_0_ring_get_dma_frame_size_compute, | ||
6604 | }; | 6617 | }; |
6605 | 6618 | ||
6606 | static void gfx_v8_0_set_ring_funcs(struct amdgpu_device *adev) | 6619 | static void gfx_v8_0_set_ring_funcs(struct amdgpu_device *adev) |
@@ -6753,3 +6766,21 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev) | |||
6753 | cu_info->number = active_cu_number; | 6766 | cu_info->number = active_cu_number; |
6754 | cu_info->ao_cu_mask = ao_cu_mask; | 6767 | cu_info->ao_cu_mask = ao_cu_mask; |
6755 | } | 6768 | } |
6769 | |||
6770 | const struct amdgpu_ip_block_version gfx_v8_0_ip_block = | ||
6771 | { | ||
6772 | .type = AMD_IP_BLOCK_TYPE_GFX, | ||
6773 | .major = 8, | ||
6774 | .minor = 0, | ||
6775 | .rev = 0, | ||
6776 | .funcs = &gfx_v8_0_ip_funcs, | ||
6777 | }; | ||
6778 | |||
6779 | const struct amdgpu_ip_block_version gfx_v8_1_ip_block = | ||
6780 | { | ||
6781 | .type = AMD_IP_BLOCK_TYPE_GFX, | ||
6782 | .major = 8, | ||
6783 | .minor = 1, | ||
6784 | .rev = 0, | ||
6785 | .funcs = &gfx_v8_0_ip_funcs, | ||
6786 | }; | ||