Rev 5179 | Rev 6104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5179 | Rev 5271 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | #include "cikd.h" |
30 | #include "cikd.h" |
31 | #include "atom.h" |
31 | #include "atom.h" |
32 | #include "cik_blit_shaders.h" |
32 | #include "cik_blit_shaders.h" |
33 | #include "radeon_ucode.h" |
33 | #include "radeon_ucode.h" |
34 | #include "clearstate_ci.h" |
34 | #include "clearstate_ci.h" |
- | 35 | #include "radeon_kfd.h" |
|
Line 35... | Line 36... | ||
35 | 36 | ||
36 | MODULE_FIRMWARE("radeon/BONAIRE_pfp.bin"); |
37 | MODULE_FIRMWARE("radeon/BONAIRE_pfp.bin"); |
37 | MODULE_FIRMWARE("radeon/BONAIRE_me.bin"); |
38 | MODULE_FIRMWARE("radeon/BONAIRE_me.bin"); |
38 | MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); |
39 | MODULE_FIRMWARE("radeon/BONAIRE_ce.bin"); |
Line 1561... | Line 1562... | ||
1561 | }; |
1562 | }; |
Line 1562... | Line 1563... | ||
1562 | 1563 | ||
1563 | 1564 | ||
- | 1565 | static void cik_init_golden_registers(struct radeon_device *rdev) |
|
- | 1566 | { |
|
1564 | static void cik_init_golden_registers(struct radeon_device *rdev) |
1567 | /* Some of the registers might be dependent on GRBM_GFX_INDEX */ |
1565 | { |
1568 | mutex_lock(&rdev->grbm_idx_mutex); |
1566 | switch (rdev->family) { |
1569 | switch (rdev->family) { |
1567 | case CHIP_BONAIRE: |
1570 | case CHIP_BONAIRE: |
1568 | radeon_program_register_sequence(rdev, |
1571 | radeon_program_register_sequence(rdev, |
Line 1635... | Line 1638... | ||
1635 | (const u32)ARRAY_SIZE(hawaii_golden_spm_registers)); |
1638 | (const u32)ARRAY_SIZE(hawaii_golden_spm_registers)); |
1636 | break; |
1639 | break; |
1637 | default: |
1640 | default: |
1638 | break; |
1641 | break; |
1639 | } |
1642 | } |
- | 1643 | mutex_unlock(&rdev->grbm_idx_mutex); |
|
1640 | } |
1644 | } |
Line 1641... | Line 1645... | ||
1641 | 1645 | ||
1642 | /** |
1646 | /** |
1643 | * cik_get_xclk - get the xclk |
1647 | * cik_get_xclk - get the xclk |
Line 1804... | Line 1808... | ||
1804 | */ |
1808 | */ |
1805 | int ci_mc_load_microcode(struct radeon_device *rdev) |
1809 | int ci_mc_load_microcode(struct radeon_device *rdev) |
1806 | { |
1810 | { |
1807 | const __be32 *fw_data = NULL; |
1811 | const __be32 *fw_data = NULL; |
1808 | const __le32 *new_fw_data = NULL; |
1812 | const __le32 *new_fw_data = NULL; |
1809 | u32 running, blackout = 0; |
1813 | u32 running, blackout = 0, tmp; |
1810 | u32 *io_mc_regs = NULL; |
1814 | u32 *io_mc_regs = NULL; |
1811 | const __le32 *new_io_mc_regs = NULL; |
1815 | const __le32 *new_io_mc_regs = NULL; |
1812 | int i, regs_size, ucode_size; |
1816 | int i, regs_size, ucode_size; |
Line 1813... | Line 1817... | ||
1813 | 1817 | ||
Line 1864... | Line 1868... | ||
1864 | } else { |
1868 | } else { |
1865 | WREG32(MC_SEQ_IO_DEBUG_INDEX, io_mc_regs[(i << 1)]); |
1869 | WREG32(MC_SEQ_IO_DEBUG_INDEX, io_mc_regs[(i << 1)]); |
1866 | WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]); |
1870 | WREG32(MC_SEQ_IO_DEBUG_DATA, io_mc_regs[(i << 1) + 1]); |
1867 | } |
1871 | } |
1868 | } |
1872 | } |
- | 1873 | ||
- | 1874 | tmp = RREG32(MC_SEQ_MISC0); |
|
- | 1875 | if ((rdev->pdev->device == 0x6649) && ((tmp & 0xff00) == 0x5600)) { |
|
- | 1876 | WREG32(MC_SEQ_IO_DEBUG_INDEX, 5); |
|
- | 1877 | WREG32(MC_SEQ_IO_DEBUG_DATA, 0x00000023); |
|
- | 1878 | WREG32(MC_SEQ_IO_DEBUG_INDEX, 9); |
|
- | 1879 | WREG32(MC_SEQ_IO_DEBUG_DATA, 0x000001f0); |
|
- | 1880 | } |
|
- | 1881 | ||
1869 | /* load the MC ucode */ |
1882 | /* load the MC ucode */ |
1870 | for (i = 0; i < ucode_size; i++) { |
1883 | for (i = 0; i < ucode_size; i++) { |
1871 | if (rdev->new_fw) |
1884 | if (rdev->new_fw) |
1872 | WREG32(MC_SEQ_SUP_PGM, le32_to_cpup(new_fw_data++)); |
1885 | WREG32(MC_SEQ_SUP_PGM, le32_to_cpup(new_fw_data++)); |
1873 | else |
1886 | else |
Line 3417... | Line 3430... | ||
3417 | int i, j; |
3430 | int i, j; |
3418 | u32 data, mask; |
3431 | u32 data, mask; |
3419 | u32 disabled_rbs = 0; |
3432 | u32 disabled_rbs = 0; |
3420 | u32 enabled_rbs = 0; |
3433 | u32 enabled_rbs = 0; |
Line -... | Line 3434... | ||
- | 3434 | ||
3421 | 3435 | mutex_lock(&rdev->grbm_idx_mutex); |
|
3422 | for (i = 0; i < se_num; i++) { |
3436 | for (i = 0; i < se_num; i++) { |
3423 | for (j = 0; j < sh_per_se; j++) { |
3437 | for (j = 0; j < sh_per_se; j++) { |
3424 | cik_select_se_sh(rdev, i, j); |
3438 | cik_select_se_sh(rdev, i, j); |
3425 | data = cik_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se); |
3439 | data = cik_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se); |
Line 3428... | Line 3442... | ||
3428 | else |
3442 | else |
3429 | disabled_rbs |= data << ((i * sh_per_se + j) * CIK_RB_BITMAP_WIDTH_PER_SH); |
3443 | disabled_rbs |= data << ((i * sh_per_se + j) * CIK_RB_BITMAP_WIDTH_PER_SH); |
3430 | } |
3444 | } |
3431 | } |
3445 | } |
3432 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
3446 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
- | 3447 | mutex_unlock(&rdev->grbm_idx_mutex); |
|
Line 3433... | Line 3448... | ||
3433 | 3448 | ||
3434 | mask = 1; |
3449 | mask = 1; |
3435 | for (i = 0; i < max_rb_num_per_se * se_num; i++) { |
3450 | for (i = 0; i < max_rb_num_per_se * se_num; i++) { |
3436 | if (!(disabled_rbs & mask)) |
3451 | if (!(disabled_rbs & mask)) |
3437 | enabled_rbs |= mask; |
3452 | enabled_rbs |= mask; |
3438 | mask <<= 1; |
3453 | mask <<= 1; |
Line 3439... | Line 3454... | ||
3439 | } |
3454 | } |
Line -... | Line 3455... | ||
- | 3455 | ||
3440 | 3456 | rdev->config.cik.backend_enable_mask = enabled_rbs; |
|
3441 | rdev->config.cik.backend_enable_mask = enabled_rbs; |
3457 | |
3442 | 3458 | mutex_lock(&rdev->grbm_idx_mutex); |
|
3443 | for (i = 0; i < se_num; i++) { |
3459 | for (i = 0; i < se_num; i++) { |
3444 | cik_select_se_sh(rdev, i, 0xffffffff); |
3460 | cik_select_se_sh(rdev, i, 0xffffffff); |
Line 3465... | Line 3481... | ||
3465 | enabled_rbs >>= 2; |
3481 | enabled_rbs >>= 2; |
3466 | } |
3482 | } |
3467 | WREG32(PA_SC_RASTER_CONFIG, data); |
3483 | WREG32(PA_SC_RASTER_CONFIG, data); |
3468 | } |
3484 | } |
3469 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
3485 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
- | 3486 | mutex_unlock(&rdev->grbm_idx_mutex); |
|
3470 | } |
3487 | } |
Line 3471... | Line 3488... | ||
3471 | 3488 | ||
3472 | /** |
3489 | /** |
3473 | * cik_gpu_init - setup the 3D engine |
3490 | * cik_gpu_init - setup the 3D engine |
Line 3682... | Line 3699... | ||
3682 | } |
3699 | } |
Line 3683... | Line 3700... | ||
3683 | 3700 | ||
3684 | /* set HW defaults for 3D engine */ |
3701 | /* set HW defaults for 3D engine */ |
Line -... | Line 3702... | ||
- | 3702 | WREG32(CP_MEQ_THRESHOLDS, MEQ1_START(0x30) | MEQ2_START(0x60)); |
|
- | 3703 | ||
- | 3704 | mutex_lock(&rdev->grbm_idx_mutex); |
|
- | 3705 | /* |
|
- | 3706 | * making sure that the following register writes will be broadcasted |
|
- | 3707 | * to all the shaders |
|
3685 | WREG32(CP_MEQ_THRESHOLDS, MEQ1_START(0x30) | MEQ2_START(0x60)); |
3708 | */ |
Line 3686... | Line 3709... | ||
3686 | 3709 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
|
Line 3687... | Line 3710... | ||
3687 | WREG32(SX_DEBUG_1, 0x20); |
3710 | WREG32(SX_DEBUG_1, 0x20); |
Line 3737... | Line 3760... | ||
3737 | hdp_host_path_cntl = RREG32(HDP_HOST_PATH_CNTL); |
3760 | hdp_host_path_cntl = RREG32(HDP_HOST_PATH_CNTL); |
3738 | WREG32(HDP_HOST_PATH_CNTL, hdp_host_path_cntl); |
3761 | WREG32(HDP_HOST_PATH_CNTL, hdp_host_path_cntl); |
Line 3739... | Line 3762... | ||
3739 | 3762 | ||
3740 | WREG32(PA_CL_ENHANCE, CLIP_VTX_REORDER_ENA | NUM_CLIP_SEQ(3)); |
3763 | WREG32(PA_CL_ENHANCE, CLIP_VTX_REORDER_ENA | NUM_CLIP_SEQ(3)); |
- | 3764 | WREG32(PA_SC_ENHANCE, ENABLE_PA_SC_OUT_OF_ORDER); |
|
Line 3741... | Line 3765... | ||
3741 | WREG32(PA_SC_ENHANCE, ENABLE_PA_SC_OUT_OF_ORDER); |
3765 | mutex_unlock(&rdev->grbm_idx_mutex); |
3742 | 3766 | ||
Line 3743... | Line 3767... | ||
3743 | udelay(50); |
3767 | udelay(50); |
Line 3957... | Line 3981... | ||
3957 | * |
3981 | * |
3958 | * @rdev: radeon_device pointer |
3982 | * @rdev: radeon_device pointer |
3959 | * @src_offset: src GPU address |
3983 | * @src_offset: src GPU address |
3960 | * @dst_offset: dst GPU address |
3984 | * @dst_offset: dst GPU address |
3961 | * @num_gpu_pages: number of GPU pages to xfer |
3985 | * @num_gpu_pages: number of GPU pages to xfer |
3962 | * @fence: radeon fence object |
3986 | * @resv: reservation object to sync to |
3963 | * |
3987 | * |
3964 | * Copy GPU paging using the CP DMA engine (CIK+). |
3988 | * Copy GPU paging using the CP DMA engine (CIK+). |
3965 | * Used by the radeon ttm implementation to move pages if |
3989 | * Used by the radeon ttm implementation to move pages if |
3966 | * registered as the asic copy callback. |
3990 | * registered as the asic copy callback. |
3967 | */ |
3991 | */ |
3968 | int cik_copy_cpdma(struct radeon_device *rdev, |
3992 | struct radeon_fence *cik_copy_cpdma(struct radeon_device *rdev, |
3969 | uint64_t src_offset, uint64_t dst_offset, |
3993 | uint64_t src_offset, uint64_t dst_offset, |
3970 | unsigned num_gpu_pages, |
3994 | unsigned num_gpu_pages, |
3971 | struct radeon_fence **fence) |
3995 | struct reservation_object *resv) |
3972 | { |
3996 | { |
3973 | struct radeon_semaphore *sem = NULL; |
3997 | struct radeon_fence *fence; |
- | 3998 | struct radeon_sync sync; |
|
3974 | int ring_index = rdev->asic->copy.blit_ring_index; |
3999 | int ring_index = rdev->asic->copy.blit_ring_index; |
3975 | struct radeon_ring *ring = &rdev->ring[ring_index]; |
4000 | struct radeon_ring *ring = &rdev->ring[ring_index]; |
3976 | u32 size_in_bytes, cur_size_in_bytes, control; |
4001 | u32 size_in_bytes, cur_size_in_bytes, control; |
3977 | int i, num_loops; |
4002 | int i, num_loops; |
3978 | int r = 0; |
4003 | int r = 0; |
Line 3979... | Line 4004... | ||
3979 | 4004 | ||
3980 | r = radeon_semaphore_create(rdev, &sem); |
- | |
3981 | if (r) { |
- | |
3982 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
- | |
3983 | return r; |
- | |
Line 3984... | Line 4005... | ||
3984 | } |
4005 | radeon_sync_create(&sync); |
3985 | 4006 | ||
3986 | size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT); |
4007 | size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT); |
3987 | num_loops = DIV_ROUND_UP(size_in_bytes, 0x1fffff); |
4008 | num_loops = DIV_ROUND_UP(size_in_bytes, 0x1fffff); |
3988 | r = radeon_ring_lock(rdev, ring, num_loops * 7 + 18); |
4009 | r = radeon_ring_lock(rdev, ring, num_loops * 7 + 18); |
3989 | if (r) { |
4010 | if (r) { |
3990 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
4011 | DRM_ERROR("radeon: moving bo (%d).\n", r); |
3991 | radeon_semaphore_free(rdev, &sem, NULL); |
4012 | radeon_sync_free(rdev, &sync, NULL); |
Line 3992... | Line 4013... | ||
3992 | return r; |
4013 | return ERR_PTR(r); |
3993 | } |
4014 | } |
Line 3994... | Line 4015... | ||
3994 | 4015 | ||
3995 | radeon_semaphore_sync_to(sem, *fence); |
4016 | radeon_sync_resv(rdev, &sync, resv, false); |
3996 | radeon_semaphore_sync_rings(rdev, sem, ring->idx); |
4017 | radeon_sync_rings(rdev, &sync, ring->idx); |
3997 | 4018 | ||
Line 4012... | Line 4033... | ||
4012 | radeon_ring_write(ring, cur_size_in_bytes); |
4033 | radeon_ring_write(ring, cur_size_in_bytes); |
4013 | src_offset += cur_size_in_bytes; |
4034 | src_offset += cur_size_in_bytes; |
4014 | dst_offset += cur_size_in_bytes; |
4035 | dst_offset += cur_size_in_bytes; |
4015 | } |
4036 | } |
Line 4016... | Line 4037... | ||
4016 | 4037 | ||
4017 | r = radeon_fence_emit(rdev, fence, ring->idx); |
4038 | r = radeon_fence_emit(rdev, &fence, ring->idx); |
4018 | if (r) { |
4039 | if (r) { |
4019 | radeon_ring_unlock_undo(rdev, ring); |
4040 | radeon_ring_unlock_undo(rdev, ring); |
4020 | radeon_semaphore_free(rdev, &sem, NULL); |
4041 | radeon_sync_free(rdev, &sync, NULL); |
4021 | return r; |
4042 | return ERR_PTR(r); |
Line 4022... | Line 4043... | ||
4022 | } |
4043 | } |
4023 | 4044 | ||
Line 4024... | Line 4045... | ||
4024 | radeon_ring_unlock_commit(rdev, ring, false); |
4045 | radeon_ring_unlock_commit(rdev, ring, false); |
4025 | radeon_semaphore_free(rdev, &sem, *fence); |
4046 | radeon_sync_free(rdev, &sync, fence); |
Line 4026... | Line 4047... | ||
4026 | 4047 | ||
4027 | return r; |
4048 | return fence; |
4028 | } |
4049 | } |
Line 4043... | Line 4064... | ||
4043 | * on the gfx ring for execution by the GPU. |
4064 | * on the gfx ring for execution by the GPU. |
4044 | */ |
4065 | */ |
4045 | void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) |
4066 | void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) |
4046 | { |
4067 | { |
4047 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
4068 | struct radeon_ring *ring = &rdev->ring[ib->ring]; |
- | 4069 | unsigned vm_id = ib->vm ? ib->vm->ids[ib->ring].id : 0; |
|
4048 | u32 header, control = INDIRECT_BUFFER_VALID; |
4070 | u32 header, control = INDIRECT_BUFFER_VALID; |
Line 4049... | Line 4071... | ||
4049 | 4071 | ||
4050 | if (ib->is_const_ib) { |
4072 | if (ib->is_const_ib) { |
4051 | /* set switch buffer packet before const IB */ |
4073 | /* set switch buffer packet before const IB */ |
Line 4071... | Line 4093... | ||
4071 | } |
4093 | } |
Line 4072... | Line 4094... | ||
4072 | 4094 | ||
4073 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
4095 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
Line 4074... | Line 4096... | ||
4074 | } |
4096 | } |
4075 | - | ||
Line 4076... | Line 4097... | ||
4076 | control |= ib->length_dw | |
4097 | |
4077 | (ib->vm ? (ib->vm->id << 24) : 0); |
4098 | control |= ib->length_dw | (vm_id << 24); |
4078 | 4099 | ||
4079 | radeon_ring_write(ring, header); |
4100 | radeon_ring_write(ring, header); |
Line 4232... | Line 4253... | ||
4232 | (rdev->pfp_fw->data + le32_to_cpu(pfp_hdr->header.ucode_array_offset_bytes)); |
4253 | (rdev->pfp_fw->data + le32_to_cpu(pfp_hdr->header.ucode_array_offset_bytes)); |
4233 | fw_size = le32_to_cpu(pfp_hdr->header.ucode_size_bytes) / 4; |
4254 | fw_size = le32_to_cpu(pfp_hdr->header.ucode_size_bytes) / 4; |
4234 | WREG32(CP_PFP_UCODE_ADDR, 0); |
4255 | WREG32(CP_PFP_UCODE_ADDR, 0); |
4235 | for (i = 0; i < fw_size; i++) |
4256 | for (i = 0; i < fw_size; i++) |
4236 | WREG32(CP_PFP_UCODE_DATA, le32_to_cpup(fw_data++)); |
4257 | WREG32(CP_PFP_UCODE_DATA, le32_to_cpup(fw_data++)); |
4237 | WREG32(CP_PFP_UCODE_ADDR, 0); |
4258 | WREG32(CP_PFP_UCODE_ADDR, le32_to_cpu(pfp_hdr->header.ucode_version)); |
Line 4238... | Line 4259... | ||
4238 | 4259 | ||
4239 | /* CE */ |
4260 | /* CE */ |
4240 | fw_data = (const __le32 *) |
4261 | fw_data = (const __le32 *) |
4241 | (rdev->ce_fw->data + le32_to_cpu(ce_hdr->header.ucode_array_offset_bytes)); |
4262 | (rdev->ce_fw->data + le32_to_cpu(ce_hdr->header.ucode_array_offset_bytes)); |
4242 | fw_size = le32_to_cpu(ce_hdr->header.ucode_size_bytes) / 4; |
4263 | fw_size = le32_to_cpu(ce_hdr->header.ucode_size_bytes) / 4; |
4243 | WREG32(CP_CE_UCODE_ADDR, 0); |
4264 | WREG32(CP_CE_UCODE_ADDR, 0); |
4244 | for (i = 0; i < fw_size; i++) |
4265 | for (i = 0; i < fw_size; i++) |
4245 | WREG32(CP_CE_UCODE_DATA, le32_to_cpup(fw_data++)); |
4266 | WREG32(CP_CE_UCODE_DATA, le32_to_cpup(fw_data++)); |
Line 4246... | Line 4267... | ||
4246 | WREG32(CP_CE_UCODE_ADDR, 0); |
4267 | WREG32(CP_CE_UCODE_ADDR, le32_to_cpu(ce_hdr->header.ucode_version)); |
4247 | 4268 | ||
4248 | /* ME */ |
4269 | /* ME */ |
4249 | fw_data = (const __be32 *) |
4270 | fw_data = (const __be32 *) |
4250 | (rdev->me_fw->data + le32_to_cpu(me_hdr->header.ucode_array_offset_bytes)); |
4271 | (rdev->me_fw->data + le32_to_cpu(me_hdr->header.ucode_array_offset_bytes)); |
4251 | fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4; |
4272 | fw_size = le32_to_cpu(me_hdr->header.ucode_size_bytes) / 4; |
4252 | WREG32(CP_ME_RAM_WADDR, 0); |
4273 | WREG32(CP_ME_RAM_WADDR, 0); |
4253 | for (i = 0; i < fw_size; i++) |
4274 | for (i = 0; i < fw_size; i++) |
- | 4275 | WREG32(CP_ME_RAM_DATA, le32_to_cpup(fw_data++)); |
|
4254 | WREG32(CP_ME_RAM_DATA, le32_to_cpup(fw_data++)); |
4276 | WREG32(CP_ME_RAM_WADDR, le32_to_cpu(me_hdr->header.ucode_version)); |
4255 | WREG32(CP_ME_RAM_WADDR, 0); |
4277 | WREG32(CP_ME_RAM_RADDR, le32_to_cpu(me_hdr->header.ucode_version)); |
Line 4256... | Line 4278... | ||
4256 | } else { |
4278 | } else { |
4257 | const __be32 *fw_data; |
4279 | const __be32 *fw_data; |
Line 4276... | Line 4298... | ||
4276 | for (i = 0; i < CIK_ME_UCODE_SIZE; i++) |
4298 | for (i = 0; i < CIK_ME_UCODE_SIZE; i++) |
4277 | WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); |
4299 | WREG32(CP_ME_RAM_DATA, be32_to_cpup(fw_data++)); |
4278 | WREG32(CP_ME_RAM_WADDR, 0); |
4300 | WREG32(CP_ME_RAM_WADDR, 0); |
4279 | } |
4301 | } |
Line 4280... | Line -... | ||
4280 | - | ||
4281 | WREG32(CP_PFP_UCODE_ADDR, 0); |
- | |
4282 | WREG32(CP_CE_UCODE_ADDR, 0); |
- | |
4283 | WREG32(CP_ME_RAM_WADDR, 0); |
- | |
4284 | WREG32(CP_ME_RAM_RADDR, 0); |
4302 | |
4285 | return 0; |
4303 | return 0; |
Line 4286... | Line 4304... | ||
4286 | } |
4304 | } |
4287 | 4305 | ||
Line 4313... | Line 4331... | ||
4313 | } |
4331 | } |
Line 4314... | Line 4332... | ||
4314 | 4332 | ||
4315 | /* init the CE partitions. CE only used for gfx on CIK */ |
4333 | /* init the CE partitions. CE only used for gfx on CIK */ |
4316 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); |
4334 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); |
4317 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
4335 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
4318 | radeon_ring_write(ring, 0xc000); |
4336 | radeon_ring_write(ring, 0x8000); |
Line 4319... | Line 4337... | ||
4319 | radeon_ring_write(ring, 0xc000); |
4337 | radeon_ring_write(ring, 0x8000); |
4320 | 4338 | ||
4321 | /* setup clear context state */ |
4339 | /* setup clear context state */ |
Line 4561... | Line 4579... | ||
4561 | (rdev->mec_fw->data + le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes)); |
4579 | (rdev->mec_fw->data + le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes)); |
4562 | fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4; |
4580 | fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4; |
4563 | WREG32(CP_MEC_ME1_UCODE_ADDR, 0); |
4581 | WREG32(CP_MEC_ME1_UCODE_ADDR, 0); |
4564 | for (i = 0; i < fw_size; i++) |
4582 | for (i = 0; i < fw_size; i++) |
4565 | WREG32(CP_MEC_ME1_UCODE_DATA, le32_to_cpup(fw_data++)); |
4583 | WREG32(CP_MEC_ME1_UCODE_DATA, le32_to_cpup(fw_data++)); |
4566 | WREG32(CP_MEC_ME1_UCODE_ADDR, 0); |
4584 | WREG32(CP_MEC_ME1_UCODE_ADDR, le32_to_cpu(mec_hdr->header.ucode_version)); |
Line 4567... | Line 4585... | ||
4567 | 4585 | ||
4568 | /* MEC2 */ |
4586 | /* MEC2 */ |
4569 | if (rdev->family == CHIP_KAVERI) { |
4587 | if (rdev->family == CHIP_KAVERI) { |
4570 | const struct gfx_firmware_header_v1_0 *mec2_hdr = |
4588 | const struct gfx_firmware_header_v1_0 *mec2_hdr = |
Line 4575... | Line 4593... | ||
4575 | le32_to_cpu(mec2_hdr->header.ucode_array_offset_bytes)); |
4593 | le32_to_cpu(mec2_hdr->header.ucode_array_offset_bytes)); |
4576 | fw_size = le32_to_cpu(mec2_hdr->header.ucode_size_bytes) / 4; |
4594 | fw_size = le32_to_cpu(mec2_hdr->header.ucode_size_bytes) / 4; |
4577 | WREG32(CP_MEC_ME2_UCODE_ADDR, 0); |
4595 | WREG32(CP_MEC_ME2_UCODE_ADDR, 0); |
4578 | for (i = 0; i < fw_size; i++) |
4596 | for (i = 0; i < fw_size; i++) |
4579 | WREG32(CP_MEC_ME2_UCODE_DATA, le32_to_cpup(fw_data++)); |
4597 | WREG32(CP_MEC_ME2_UCODE_DATA, le32_to_cpup(fw_data++)); |
4580 | WREG32(CP_MEC_ME2_UCODE_ADDR, 0); |
4598 | WREG32(CP_MEC_ME2_UCODE_ADDR, le32_to_cpu(mec2_hdr->header.ucode_version)); |
4581 | } |
4599 | } |
4582 | } else { |
4600 | } else { |
4583 | const __be32 *fw_data; |
4601 | const __be32 *fw_data; |
Line 4584... | Line 4602... | ||
4584 | 4602 | ||
Line 4675... | Line 4693... | ||
4675 | u32 *hpd; |
4693 | u32 *hpd; |
Line 4676... | Line 4694... | ||
4676 | 4694 | ||
4677 | /* |
4695 | /* |
4678 | * KV: 2 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 64 Queues total |
4696 | * KV: 2 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 64 Queues total |
- | 4697 | * CI/KB: 1 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 32 Queues total |
|
- | 4698 | * Nonetheless, we assign only 1 pipe because all other pipes will |
|
4679 | * CI/KB: 1 MEC, 4 Pipes/MEC, 8 Queues/Pipe - 32 Queues total |
4699 | * be handled by KFD |
4680 | */ |
- | |
4681 | if (rdev->family == CHIP_KAVERI) |
- | |
4682 | rdev->mec.num_mec = 2; |
- | |
4683 | else |
4700 | */ |
4684 | rdev->mec.num_mec = 1; |
4701 | rdev->mec.num_mec = 1; |
4685 | rdev->mec.num_pipe = 4; |
4702 | rdev->mec.num_pipe = 1; |
Line 4686... | Line 4703... | ||
4686 | rdev->mec.num_queue = rdev->mec.num_mec * rdev->mec.num_pipe * 8; |
4703 | rdev->mec.num_queue = rdev->mec.num_mec * rdev->mec.num_pipe * 8; |
4687 | 4704 | ||
4688 | if (rdev->mec.hpd_eop_obj == NULL) { |
4705 | if (rdev->mec.hpd_eop_obj == NULL) { |
4689 | r = radeon_bo_create(rdev, |
4706 | r = radeon_bo_create(rdev, |
4690 | rdev->mec.num_mec *rdev->mec.num_pipe * MEC_HPD_SIZE * 2, |
4707 | rdev->mec.num_mec *rdev->mec.num_pipe * MEC_HPD_SIZE * 2, |
4691 | PAGE_SIZE, true, |
4708 | PAGE_SIZE, true, |
4692 | RADEON_GEM_DOMAIN_GTT, 0, NULL, |
4709 | RADEON_GEM_DOMAIN_GTT, 0, NULL, NULL, |
4693 | &rdev->mec.hpd_eop_obj); |
4710 | &rdev->mec.hpd_eop_obj); |
4694 | if (r) { |
4711 | if (r) { |
4695 | dev_warn(rdev->dev, "(%d) create HDP EOP bo failed\n", r); |
4712 | dev_warn(rdev->dev, "(%d) create HDP EOP bo failed\n", r); |
Line 4822... | Line 4839... | ||
4822 | tmp |= (1 << 23); |
4839 | tmp |= (1 << 23); |
4823 | WREG32(CP_CPF_DEBUG, tmp); |
4840 | WREG32(CP_CPF_DEBUG, tmp); |
Line 4824... | Line 4841... | ||
4824 | 4841 | ||
4825 | /* init the pipes */ |
4842 | /* init the pipes */ |
4826 | mutex_lock(&rdev->srbm_mutex); |
- | |
4827 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { |
- | |
4828 | int me = (i < 4) ? 1 : 2; |
- | |
Line 4829... | Line 4843... | ||
4829 | int pipe = (i < 4) ? i : (i - 4); |
4843 | mutex_lock(&rdev->srbm_mutex); |
Line 4830... | Line 4844... | ||
4830 | 4844 | ||
Line 4831... | Line 4845... | ||
4831 | eop_gpu_addr = rdev->mec.hpd_eop_gpu_addr + (i * MEC_HPD_SIZE * 2); |
4845 | eop_gpu_addr = rdev->mec.hpd_eop_gpu_addr; |
4832 | 4846 | ||
4833 | cik_srbm_select(rdev, me, pipe, 0, 0); |
4847 | cik_srbm_select(rdev, 0, 0, 0, 0); |
Line 4842... | Line 4856... | ||
4842 | /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ |
4856 | /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ |
4843 | tmp = RREG32(CP_HPD_EOP_CONTROL); |
4857 | tmp = RREG32(CP_HPD_EOP_CONTROL); |
4844 | tmp &= ~EOP_SIZE_MASK; |
4858 | tmp &= ~EOP_SIZE_MASK; |
4845 | tmp |= order_base_2(MEC_HPD_SIZE / 8); |
4859 | tmp |= order_base_2(MEC_HPD_SIZE / 8); |
4846 | WREG32(CP_HPD_EOP_CONTROL, tmp); |
4860 | WREG32(CP_HPD_EOP_CONTROL, tmp); |
4847 | } |
4861 | |
4848 | cik_srbm_select(rdev, 0, 0, 0, 0); |
- | |
4849 | mutex_unlock(&rdev->srbm_mutex); |
4862 | mutex_unlock(&rdev->srbm_mutex); |
Line 4850... | Line 4863... | ||
4850 | 4863 | ||
4851 | /* init the queues. Just two for now. */ |
4864 | /* init the queues. Just two for now. */ |
4852 | for (i = 0; i < 2; i++) { |
4865 | for (i = 0; i < 2; i++) { |
Line 4858... | Line 4871... | ||
4858 | if (rdev->ring[idx].mqd_obj == NULL) { |
4871 | if (rdev->ring[idx].mqd_obj == NULL) { |
4859 | r = radeon_bo_create(rdev, |
4872 | r = radeon_bo_create(rdev, |
4860 | sizeof(struct bonaire_mqd), |
4873 | sizeof(struct bonaire_mqd), |
4861 | PAGE_SIZE, true, |
4874 | PAGE_SIZE, true, |
4862 | RADEON_GEM_DOMAIN_GTT, 0, NULL, |
4875 | RADEON_GEM_DOMAIN_GTT, 0, NULL, |
4863 | &rdev->ring[idx].mqd_obj); |
4876 | NULL, &rdev->ring[idx].mqd_obj); |
4864 | if (r) { |
4877 | if (r) { |
4865 | dev_warn(rdev->dev, "(%d) create MQD bo failed\n", r); |
4878 | dev_warn(rdev->dev, "(%d) create MQD bo failed\n", r); |
4866 | return r; |
4879 | return r; |
4867 | } |
4880 | } |
4868 | } |
4881 | } |
Line 5897... | Line 5910... | ||
5897 | * VMIDs 1-15) (CIK). |
5910 | * VMIDs 1-15) (CIK). |
5898 | * Returns 0 for success. |
5911 | * Returns 0 for success. |
5899 | */ |
5912 | */ |
5900 | int cik_vm_init(struct radeon_device *rdev) |
5913 | int cik_vm_init(struct radeon_device *rdev) |
5901 | { |
5914 | { |
- | 5915 | /* |
|
5902 | /* number of VMs */ |
5916 | * number of VMs |
- | 5917 | * VMID 0 is reserved for System |
|
- | 5918 | * radeon graphics/compute will use VMIDs 1-7 |
|
- | 5919 | * amdkfd will use VMIDs 8-15 |
|
- | 5920 | */ |
|
5903 | rdev->vm_manager.nvm = 16; |
5921 | rdev->vm_manager.nvm = RADEON_NUM_OF_VMIDS; |
5904 | /* base offset of vram pages */ |
5922 | /* base offset of vram pages */ |
5905 | if (rdev->flags & RADEON_IS_IGP) { |
5923 | if (rdev->flags & RADEON_IS_IGP) { |
5906 | u64 tmp = RREG32(MC_VM_FB_OFFSET); |
5924 | u64 tmp = RREG32(MC_VM_FB_OFFSET); |
5907 | tmp <<= 22; |
5925 | tmp <<= 22; |
5908 | rdev->vm_manager.vram_base_offset = tmp; |
5926 | rdev->vm_manager.vram_base_offset = tmp; |
Line 5958... | Line 5976... | ||
5958 | * @rdev: radeon_device pointer |
5976 | * @rdev: radeon_device pointer |
5959 | * |
5977 | * |
5960 | * Update the page table base and flush the VM TLB |
5978 | * Update the page table base and flush the VM TLB |
5961 | * using the CP (CIK). |
5979 | * using the CP (CIK). |
5962 | */ |
5980 | */ |
5963 | void cik_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) |
5981 | void cik_vm_flush(struct radeon_device *rdev, struct radeon_ring *ring, |
- | 5982 | unsigned vm_id, uint64_t pd_addr) |
|
5964 | { |
5983 | { |
5965 | struct radeon_ring *ring = &rdev->ring[ridx]; |
- | |
5966 | int usepfp = (ridx == RADEON_RING_TYPE_GFX_INDEX); |
5984 | int usepfp = (ring->idx == RADEON_RING_TYPE_GFX_INDEX); |
5967 | - | ||
5968 | if (vm == NULL) |
- | |
5969 | return; |
- | |
Line 5970... | Line 5985... | ||
5970 | 5985 | ||
5971 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5986 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5972 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5987 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5973 | WRITE_DATA_DST_SEL(0))); |
5988 | WRITE_DATA_DST_SEL(0))); |
5974 | if (vm->id < 8) { |
5989 | if (vm_id < 8) { |
5975 | radeon_ring_write(ring, |
5990 | radeon_ring_write(ring, |
5976 | (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm->id << 2)) >> 2); |
5991 | (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (vm_id << 2)) >> 2); |
5977 | } else { |
5992 | } else { |
5978 | radeon_ring_write(ring, |
5993 | radeon_ring_write(ring, |
5979 | (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((vm->id - 8) << 2)) >> 2); |
5994 | (VM_CONTEXT8_PAGE_TABLE_BASE_ADDR + ((vm_id - 8) << 2)) >> 2); |
5980 | } |
5995 | } |
5981 | radeon_ring_write(ring, 0); |
5996 | radeon_ring_write(ring, 0); |
Line 5982... | Line 5997... | ||
5982 | radeon_ring_write(ring, vm->pd_gpu_addr >> 12); |
5997 | radeon_ring_write(ring, pd_addr >> 12); |
5983 | 5998 | ||
5984 | /* update SH_MEM_* regs */ |
5999 | /* update SH_MEM_* regs */ |
5985 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
6000 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
5986 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
6001 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
5987 | WRITE_DATA_DST_SEL(0))); |
6002 | WRITE_DATA_DST_SEL(0))); |
5988 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
6003 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
Line 5989... | Line 6004... | ||
5989 | radeon_ring_write(ring, 0); |
6004 | radeon_ring_write(ring, 0); |
5990 | radeon_ring_write(ring, VMID(vm->id)); |
6005 | radeon_ring_write(ring, VMID(vm_id)); |
5991 | 6006 | ||
5992 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); |
6007 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 6)); |
Line 6006... | Line 6021... | ||
6006 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
6021 | radeon_ring_write(ring, SRBM_GFX_CNTL >> 2); |
6007 | radeon_ring_write(ring, 0); |
6022 | radeon_ring_write(ring, 0); |
6008 | radeon_ring_write(ring, VMID(0)); |
6023 | radeon_ring_write(ring, VMID(0)); |
Line 6009... | Line 6024... | ||
6009 | 6024 | ||
6010 | /* HDP flush */ |
6025 | /* HDP flush */ |
Line 6011... | Line 6026... | ||
6011 | cik_hdp_flush_cp_ring_emit(rdev, ridx); |
6026 | cik_hdp_flush_cp_ring_emit(rdev, ring->idx); |
6012 | 6027 | ||
6013 | /* bits 0-15 are the VM contexts0-15 */ |
6028 | /* bits 0-15 are the VM contexts0-15 */ |
6014 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
6029 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
6015 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
6030 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
6016 | WRITE_DATA_DST_SEL(0))); |
6031 | WRITE_DATA_DST_SEL(0))); |
6017 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
6032 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
Line 6018... | Line 6033... | ||
6018 | radeon_ring_write(ring, 0); |
6033 | radeon_ring_write(ring, 0); |
6019 | radeon_ring_write(ring, 1 << vm->id); |
6034 | radeon_ring_write(ring, 1 << vm_id); |
6020 | 6035 | ||
6021 | /* compute doesn't have PFP */ |
6036 | /* compute doesn't have PFP */ |
Line 6059... | Line 6074... | ||
6059 | static void cik_wait_for_rlc_serdes(struct radeon_device *rdev) |
6074 | static void cik_wait_for_rlc_serdes(struct radeon_device *rdev) |
6060 | { |
6075 | { |
6061 | u32 i, j, k; |
6076 | u32 i, j, k; |
6062 | u32 mask; |
6077 | u32 mask; |
Line -... | Line 6078... | ||
- | 6078 | ||
6063 | 6079 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6064 | for (i = 0; i < rdev->config.cik.max_shader_engines; i++) { |
6080 | for (i = 0; i < rdev->config.cik.max_shader_engines; i++) { |
6065 | for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) { |
6081 | for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) { |
6066 | cik_select_se_sh(rdev, i, j); |
6082 | cik_select_se_sh(rdev, i, j); |
6067 | for (k = 0; k < rdev->usec_timeout; k++) { |
6083 | for (k = 0; k < rdev->usec_timeout; k++) { |
Line 6070... | Line 6086... | ||
6070 | udelay(1); |
6086 | udelay(1); |
6071 | } |
6087 | } |
6072 | } |
6088 | } |
6073 | } |
6089 | } |
6074 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6090 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
- | 6091 | mutex_unlock(&rdev->grbm_idx_mutex); |
|
Line 6075... | Line 6092... | ||
6075 | 6092 | ||
6076 | mask = SE_MASTER_BUSY_MASK | GC_MASTER_BUSY | TC0_MASTER_BUSY | TC1_MASTER_BUSY; |
6093 | mask = SE_MASTER_BUSY_MASK | GC_MASTER_BUSY | TC0_MASTER_BUSY | TC1_MASTER_BUSY; |
6077 | for (k = 0; k < rdev->usec_timeout; k++) { |
6094 | for (k = 0; k < rdev->usec_timeout; k++) { |
6078 | if ((RREG32(RLC_SERDES_NONCU_MASTER_BUSY) & mask) == 0) |
6095 | if ((RREG32(RLC_SERDES_NONCU_MASTER_BUSY) & mask) == 0) |
Line 6204... | Line 6221... | ||
6204 | cik_init_cg(rdev); |
6221 | cik_init_cg(rdev); |
Line 6205... | Line 6222... | ||
6205 | 6222 | ||
6206 | WREG32(RLC_LB_CNTR_INIT, 0); |
6223 | WREG32(RLC_LB_CNTR_INIT, 0); |
Line -... | Line 6224... | ||
- | 6224 | WREG32(RLC_LB_CNTR_MAX, 0x00008000); |
|
6207 | WREG32(RLC_LB_CNTR_MAX, 0x00008000); |
6225 | |
6208 | 6226 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6209 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6227 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6210 | WREG32(RLC_LB_INIT_CU_MASK, 0xffffffff); |
6228 | WREG32(RLC_LB_INIT_CU_MASK, 0xffffffff); |
- | 6229 | WREG32(RLC_LB_PARAMS, 0x00600408); |
|
Line 6211... | Line 6230... | ||
6211 | WREG32(RLC_LB_PARAMS, 0x00600408); |
6230 | WREG32(RLC_LB_CNTL, 0x80000004); |
6212 | WREG32(RLC_LB_CNTL, 0x80000004); |
6231 | mutex_unlock(&rdev->grbm_idx_mutex); |
Line 6213... | Line 6232... | ||
6213 | 6232 | ||
Line 6224... | Line 6243... | ||
6224 | 6243 | ||
6225 | size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
6244 | size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
6226 | WREG32(RLC_GPM_UCODE_ADDR, 0); |
6245 | WREG32(RLC_GPM_UCODE_ADDR, 0); |
6227 | for (i = 0; i < size; i++) |
6246 | for (i = 0; i < size; i++) |
6228 | WREG32(RLC_GPM_UCODE_DATA, le32_to_cpup(fw_data++)); |
6247 | WREG32(RLC_GPM_UCODE_DATA, le32_to_cpup(fw_data++)); |
6229 | WREG32(RLC_GPM_UCODE_ADDR, 0); |
6248 | WREG32(RLC_GPM_UCODE_ADDR, le32_to_cpu(hdr->header.ucode_version)); |
6230 | } else { |
6249 | } else { |
Line 6231... | Line 6250... | ||
6231 | const __be32 *fw_data; |
6250 | const __be32 *fw_data; |
6232 | 6251 | ||
Line 6274... | Line 6293... | ||
6274 | if (enable && (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_CGCG)) { |
6293 | if (enable && (rdev->cg_flags & RADEON_CG_SUPPORT_GFX_CGCG)) { |
6275 | cik_enable_gui_idle_interrupt(rdev, true); |
6294 | cik_enable_gui_idle_interrupt(rdev, true); |
Line 6276... | Line 6295... | ||
6276 | 6295 | ||
Line -... | Line 6296... | ||
- | 6296 | tmp = cik_halt_rlc(rdev); |
|
6277 | tmp = cik_halt_rlc(rdev); |
6297 | |
6278 | 6298 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6279 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6299 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6280 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
6300 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
6281 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
6301 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
- | 6302 | tmp2 = BPM_ADDR_MASK | CGCG_OVERRIDE_0 | CGLS_ENABLE; |
|
Line 6282... | Line 6303... | ||
6282 | tmp2 = BPM_ADDR_MASK | CGCG_OVERRIDE_0 | CGLS_ENABLE; |
6303 | WREG32(RLC_SERDES_WR_CTRL, tmp2); |
Line 6283... | Line 6304... | ||
6283 | WREG32(RLC_SERDES_WR_CTRL, tmp2); |
6304 | mutex_unlock(&rdev->grbm_idx_mutex); |
6284 | 6305 | ||
Line 6314... | Line 6335... | ||
6314 | WREG32(CP_MEM_SLP_CNTL, data); |
6335 | WREG32(CP_MEM_SLP_CNTL, data); |
6315 | } |
6336 | } |
6316 | } |
6337 | } |
Line 6317... | Line 6338... | ||
6317 | 6338 | ||
- | 6339 | orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); |
|
6318 | orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); |
6340 | data |= 0x00000001; |
6319 | data &= 0xfffffffd; |
6341 | data &= 0xfffffffd; |
6320 | if (orig != data) |
6342 | if (orig != data) |
Line 6321... | Line 6343... | ||
6321 | WREG32(RLC_CGTT_MGCG_OVERRIDE, data); |
6343 | WREG32(RLC_CGTT_MGCG_OVERRIDE, data); |
Line -... | Line 6344... | ||
- | 6344 | ||
6322 | 6345 | tmp = cik_halt_rlc(rdev); |
|
6323 | tmp = cik_halt_rlc(rdev); |
6346 | |
6324 | 6347 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6325 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6348 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6326 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
6349 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
- | 6350 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
|
Line 6327... | Line 6351... | ||
6327 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
6351 | data = BPM_ADDR_MASK | MGCG_OVERRIDE_0; |
Line 6328... | Line 6352... | ||
6328 | data = BPM_ADDR_MASK | MGCG_OVERRIDE_0; |
6352 | WREG32(RLC_SERDES_WR_CTRL, data); |
6329 | WREG32(RLC_SERDES_WR_CTRL, data); |
6353 | mutex_unlock(&rdev->grbm_idx_mutex); |
Line 6345... | Line 6369... | ||
6345 | if (orig != data) |
6369 | if (orig != data) |
6346 | WREG32(CGTS_SM_CTRL_REG, data); |
6370 | WREG32(CGTS_SM_CTRL_REG, data); |
6347 | } |
6371 | } |
6348 | } else { |
6372 | } else { |
6349 | orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); |
6373 | orig = data = RREG32(RLC_CGTT_MGCG_OVERRIDE); |
6350 | data |= 0x00000002; |
6374 | data |= 0x00000003; |
6351 | if (orig != data) |
6375 | if (orig != data) |
6352 | WREG32(RLC_CGTT_MGCG_OVERRIDE, data); |
6376 | WREG32(RLC_CGTT_MGCG_OVERRIDE, data); |
Line 6353... | Line 6377... | ||
6353 | 6377 | ||
6354 | data = RREG32(RLC_MEM_SLP_CNTL); |
6378 | data = RREG32(RLC_MEM_SLP_CNTL); |
Line 6368... | Line 6392... | ||
6368 | if (orig != data) |
6392 | if (orig != data) |
6369 | WREG32(CGTS_SM_CTRL_REG, data); |
6393 | WREG32(CGTS_SM_CTRL_REG, data); |
Line 6370... | Line 6394... | ||
6370 | 6394 | ||
Line -... | Line 6395... | ||
- | 6395 | tmp = cik_halt_rlc(rdev); |
|
6371 | tmp = cik_halt_rlc(rdev); |
6396 | |
6372 | 6397 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6373 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6398 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6374 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
6399 | WREG32(RLC_SERDES_WR_CU_MASTER_MASK, 0xffffffff); |
6375 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
6400 | WREG32(RLC_SERDES_WR_NONCU_MASTER_MASK, 0xffffffff); |
- | 6401 | data = BPM_ADDR_MASK | MGCG_OVERRIDE_1; |
|
Line 6376... | Line 6402... | ||
6376 | data = BPM_ADDR_MASK | MGCG_OVERRIDE_1; |
6402 | WREG32(RLC_SERDES_WR_CTRL, data); |
6377 | WREG32(RLC_SERDES_WR_CTRL, data); |
6403 | mutex_unlock(&rdev->grbm_idx_mutex); |
6378 | 6404 | ||
Line 6801... | Line 6827... | ||
6801 | static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 sh) |
6827 | static u32 cik_get_cu_active_bitmap(struct radeon_device *rdev, u32 se, u32 sh) |
6802 | { |
6828 | { |
6803 | u32 mask = 0, tmp, tmp1; |
6829 | u32 mask = 0, tmp, tmp1; |
6804 | int i; |
6830 | int i; |
Line -... | Line 6831... | ||
- | 6831 | ||
6805 | 6832 | mutex_lock(&rdev->grbm_idx_mutex); |
|
6806 | cik_select_se_sh(rdev, se, sh); |
6833 | cik_select_se_sh(rdev, se, sh); |
6807 | tmp = RREG32(CC_GC_SHADER_ARRAY_CONFIG); |
6834 | tmp = RREG32(CC_GC_SHADER_ARRAY_CONFIG); |
6808 | tmp1 = RREG32(GC_USER_SHADER_ARRAY_CONFIG); |
6835 | tmp1 = RREG32(GC_USER_SHADER_ARRAY_CONFIG); |
- | 6836 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
|
Line 6809... | Line 6837... | ||
6809 | cik_select_se_sh(rdev, 0xffffffff, 0xffffffff); |
6837 | mutex_unlock(&rdev->grbm_idx_mutex); |
Line 6810... | Line 6838... | ||
6810 | 6838 | ||
6811 | tmp &= 0xffff0000; |
6839 | tmp &= 0xffff0000; |
Line 7288... | Line 7316... | ||
7288 | * Returns 0 for success, errors for failure. |
7316 | * Returns 0 for success, errors for failure. |
7289 | */ |
7317 | */ |
7290 | int cik_irq_set(struct radeon_device *rdev) |
7318 | int cik_irq_set(struct radeon_device *rdev) |
7291 | { |
7319 | { |
7292 | u32 cp_int_cntl; |
7320 | u32 cp_int_cntl; |
7293 | u32 cp_m1p0, cp_m1p1, cp_m1p2, cp_m1p3; |
7321 | u32 cp_m1p0; |
7294 | u32 cp_m2p0, cp_m2p1, cp_m2p2, cp_m2p3; |
- | |
7295 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
7322 | u32 crtc1 = 0, crtc2 = 0, crtc3 = 0, crtc4 = 0, crtc5 = 0, crtc6 = 0; |
7296 | u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; |
7323 | u32 hpd1, hpd2, hpd3, hpd4, hpd5, hpd6; |
7297 | u32 grbm_int_cntl = 0; |
7324 | u32 grbm_int_cntl = 0; |
7298 | u32 dma_cntl, dma_cntl1; |
7325 | u32 dma_cntl, dma_cntl1; |
7299 | u32 thermal_int; |
7326 | u32 thermal_int; |
Line 7323... | Line 7350... | ||
7323 | 7350 | ||
7324 | dma_cntl = RREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; |
7351 | dma_cntl = RREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET) & ~TRAP_ENABLE; |
Line 7325... | Line 7352... | ||
7325 | dma_cntl1 = RREG32(SDMA0_CNTL + SDMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; |
7352 | dma_cntl1 = RREG32(SDMA0_CNTL + SDMA1_REGISTER_OFFSET) & ~TRAP_ENABLE; |
7326 | - | ||
7327 | cp_m1p0 = RREG32(CP_ME1_PIPE0_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
7328 | cp_m1p1 = RREG32(CP_ME1_PIPE1_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
7329 | cp_m1p2 = RREG32(CP_ME1_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
7330 | cp_m1p3 = RREG32(CP_ME1_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
7331 | cp_m2p0 = RREG32(CP_ME2_PIPE0_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
7332 | cp_m2p1 = RREG32(CP_ME2_PIPE1_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
- | |
Line 7333... | Line 7353... | ||
7333 | cp_m2p2 = RREG32(CP_ME2_PIPE2_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
7353 | |
7334 | cp_m2p3 = RREG32(CP_ME2_PIPE3_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
7354 | cp_m1p0 = RREG32(CP_ME1_PIPE0_INT_CNTL) & ~TIME_STAMP_INT_ENABLE; |
7335 | 7355 | ||
7336 | if (rdev->flags & RADEON_IS_IGP) |
7356 | if (rdev->flags & RADEON_IS_IGP) |
Line 7351... | Line 7371... | ||
7351 | if (ring->me == 1) { |
7371 | if (ring->me == 1) { |
7352 | switch (ring->pipe) { |
7372 | switch (ring->pipe) { |
7353 | case 0: |
7373 | case 0: |
7354 | cp_m1p0 |= TIME_STAMP_INT_ENABLE; |
7374 | cp_m1p0 |= TIME_STAMP_INT_ENABLE; |
7355 | break; |
7375 | break; |
7356 | case 1: |
- | |
7357 | cp_m1p1 |= TIME_STAMP_INT_ENABLE; |
- | |
7358 | break; |
- | |
7359 | case 2: |
- | |
7360 | cp_m1p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7361 | break; |
- | |
7362 | case 3: |
- | |
7363 | cp_m1p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7364 | break; |
- | |
7365 | default: |
- | |
7366 | DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe); |
- | |
7367 | break; |
- | |
7368 | } |
- | |
7369 | } else if (ring->me == 2) { |
- | |
7370 | switch (ring->pipe) { |
- | |
7371 | case 0: |
- | |
7372 | cp_m2p0 |= TIME_STAMP_INT_ENABLE; |
- | |
7373 | break; |
- | |
7374 | case 1: |
- | |
7375 | cp_m2p1 |= TIME_STAMP_INT_ENABLE; |
- | |
7376 | break; |
- | |
7377 | case 2: |
- | |
7378 | cp_m2p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7379 | break; |
- | |
7380 | case 3: |
- | |
7381 | cp_m2p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7382 | break; |
- | |
7383 | default: |
7376 | default: |
7384 | DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe); |
7377 | DRM_DEBUG("si_irq_set: sw int cp1 invalid pipe %d\n", ring->pipe); |
7385 | break; |
7378 | break; |
7386 | } |
7379 | } |
7387 | } else { |
7380 | } else { |
Line 7394... | Line 7387... | ||
7394 | if (ring->me == 1) { |
7387 | if (ring->me == 1) { |
7395 | switch (ring->pipe) { |
7388 | switch (ring->pipe) { |
7396 | case 0: |
7389 | case 0: |
7397 | cp_m1p0 |= TIME_STAMP_INT_ENABLE; |
7390 | cp_m1p0 |= TIME_STAMP_INT_ENABLE; |
7398 | break; |
7391 | break; |
7399 | case 1: |
- | |
7400 | cp_m1p1 |= TIME_STAMP_INT_ENABLE; |
- | |
7401 | break; |
- | |
7402 | case 2: |
- | |
7403 | cp_m1p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7404 | break; |
- | |
7405 | case 3: |
- | |
7406 | cp_m1p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7407 | break; |
- | |
7408 | default: |
- | |
7409 | DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe); |
- | |
7410 | break; |
- | |
7411 | } |
- | |
7412 | } else if (ring->me == 2) { |
- | |
7413 | switch (ring->pipe) { |
- | |
7414 | case 0: |
- | |
7415 | cp_m2p0 |= TIME_STAMP_INT_ENABLE; |
- | |
7416 | break; |
- | |
7417 | case 1: |
- | |
7418 | cp_m2p1 |= TIME_STAMP_INT_ENABLE; |
- | |
7419 | break; |
- | |
7420 | case 2: |
- | |
7421 | cp_m2p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7422 | break; |
- | |
7423 | case 3: |
- | |
7424 | cp_m2p2 |= TIME_STAMP_INT_ENABLE; |
- | |
7425 | break; |
- | |
7426 | default: |
7392 | default: |
7427 | DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe); |
7393 | DRM_DEBUG("si_irq_set: sw int cp2 invalid pipe %d\n", ring->pipe); |
7428 | break; |
7394 | break; |
7429 | } |
7395 | } |
7430 | } else { |
7396 | } else { |
Line 7509... | Line 7475... | ||
7509 | 7475 | ||
7510 | WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl); |
7476 | WREG32(SDMA0_CNTL + SDMA0_REGISTER_OFFSET, dma_cntl); |
Line 7511... | Line 7477... | ||
7511 | WREG32(SDMA0_CNTL + SDMA1_REGISTER_OFFSET, dma_cntl1); |
7477 | WREG32(SDMA0_CNTL + SDMA1_REGISTER_OFFSET, dma_cntl1); |
7512 | - | ||
7513 | WREG32(CP_ME1_PIPE0_INT_CNTL, cp_m1p0); |
- | |
7514 | WREG32(CP_ME1_PIPE1_INT_CNTL, cp_m1p1); |
- | |
7515 | WREG32(CP_ME1_PIPE2_INT_CNTL, cp_m1p2); |
- | |
7516 | WREG32(CP_ME1_PIPE3_INT_CNTL, cp_m1p3); |
- | |
7517 | WREG32(CP_ME2_PIPE0_INT_CNTL, cp_m2p0); |
- | |
7518 | WREG32(CP_ME2_PIPE1_INT_CNTL, cp_m2p1); |
- | |
Line 7519... | Line 7478... | ||
7519 | WREG32(CP_ME2_PIPE2_INT_CNTL, cp_m2p2); |
7478 | |
Line 7520... | Line 7479... | ||
7520 | WREG32(CP_ME2_PIPE3_INT_CNTL, cp_m2p3); |
7479 | WREG32(CP_ME1_PIPE0_INT_CNTL, cp_m1p0); |
7521 | 7480 | ||
Line 7832... | Line 7791... | ||
7832 | cik_irq_ack(rdev); |
7791 | cik_irq_ack(rdev); |
Line 7833... | Line 7792... | ||
7833 | 7792 | ||
7834 | while (rptr != wptr) { |
7793 | while (rptr != wptr) { |
7835 | /* wptr/rptr are in bytes! */ |
7794 | /* wptr/rptr are in bytes! */ |
- | 7795 | ring_index = rptr / 4; |
|
- | 7796 | ||
- | 7797 | // radeon_kfd_interrupt(rdev, |
|
- | 7798 | // (const void *) &rdev->ih.ring[ring_index]); |
|
7836 | ring_index = rptr / 4; |
7799 | |
7837 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
7800 | src_id = le32_to_cpu(rdev->ih.ring[ring_index]) & 0xff; |
7838 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
7801 | src_data = le32_to_cpu(rdev->ih.ring[ring_index + 1]) & 0xfffffff; |
Line 7839... | Line 7802... | ||
7839 | ring_id = le32_to_cpu(rdev->ih.ring[ring_index + 2]) & 0xff; |
7802 | ring_id = le32_to_cpu(rdev->ih.ring[ring_index + 2]) & 0xff; |
Line 8455... | Line 8418... | ||
8455 | if (r) { |
8418 | if (r) { |
8456 | dev_err(rdev->dev, "vm manager initialization failed (%d).\n", r); |
8419 | dev_err(rdev->dev, "vm manager initialization failed (%d).\n", r); |
8457 | return r; |
8420 | return r; |
8458 | } |
8421 | } |
Line -... | Line 8422... | ||
- | 8422 | ||
- | 8423 | // r = radeon_kfd_resume(rdev); |
|
- | 8424 | // if (r) |
|
- | 8425 | // return r; |
|
8459 | 8426 | ||
8460 | return 0; |
8427 | return 0; |
Line 8461... | Line 8428... | ||
8461 | } |
8428 | } |
Line 9278... | Line 9245... | ||
9278 | { |
9245 | { |
9279 | struct drm_display_mode *mode = NULL; |
9246 | struct drm_display_mode *mode = NULL; |
9280 | u32 num_heads = 0, lb_size; |
9247 | u32 num_heads = 0, lb_size; |
9281 | int i; |
9248 | int i; |
Line -... | Line 9249... | ||
- | 9249 | ||
- | 9250 | if (!rdev->mode_info.mode_config_initialized) |
|
- | 9251 | return; |
|
9282 | 9252 | ||
Line 9283... | Line 9253... | ||
9283 | radeon_update_display_priority(rdev); |
9253 | radeon_update_display_priority(rdev); |
9284 | 9254 | ||
9285 | for (i = 0; i < rdev->num_crtc; i++) { |
9255 | for (i = 0; i < rdev->num_crtc; i++) { |