amd-drm-next-5.17-2021-12-30: amdgpu: - Suspend/resume fixes - Fence fix - Misc code cleanups - IP discovery fixes - SRIOV fixes - RAS fixes - GMC 8 VRAM detection fix - FRU fixes for Aldebaran - Display fixes amdkfd: - SVM fixes - IP discovery fixes
Unified · Split
| @@ -812,6 +812,7 @@ struct amd_powerplay { · 811 unmodified lines | ||
| 812 | 812 | |
| 813 | 813 | #define AMDGPU_RESET_MAGIC_NUM 64 |
| 814 | 814 | #define AMDGPU_MAX_DF_PERFMONS 4 |
| 815 | +#define AMDGPU_PRODUCT_NAME_LEN 64 | |
| 815 | 816 | struct amdgpu_device { |
| 816 | 817 | struct device *dev; |
| 817 | 818 | struct pci_dev *pdev; |
| @@ -1082,7 +1083,7 @@ struct amdgpu_device { · 264 unmodified lines | ||
| 1082 | 1083 | |
| 1083 | 1084 | /* Chip product information */ |
| 1084 | 1085 | char product_number[16]; |
| 1085 | − char product_name[32]; | |
| 1086 | + char product_name[AMDGPU_PRODUCT_NAME_LEN]; | |
| 1086 | 1087 | char serial[20]; |
| 1087 | 1088 | |
| 1088 | 1089 | atomic_t throttling_logging_enabled; |
| @@ -721,13 +721,13 @@ bool amdgpu_amdkfd_have_atomics_support(struct amdgpu_device *adev) · 720 unmodified lines | ||
| 721 | 721 | return adev->have_atomics_support; |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | −void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev) | |
| 724 | +void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bool reset) | |
| 725 | 725 | { |
| 726 | 726 | struct ras_err_data err_data = {0, 0, 0, NULL}; |
| 727 | 727 | |
| 728 | 728 | /* CPU MCA will handle page retirement if connected_to_cpu is 1 */ |
| 729 | 729 | if (!adev->gmc.xgmi.connected_to_cpu) |
| 730 | − amdgpu_umc_process_ras_data_cb(adev, &err_data, NULL); | |
| 731 | − else | |
| 730 | + amdgpu_umc_poison_handler(adev, &err_data, reset); | |
| 731 | + else if (reset) | |
| 732 | 732 | amdgpu_amdkfd_gpu_reset(adev); |
| 733 | 733 | } |
| @@ -296,7 +296,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct amdgpu_device *adev, · 295 unmodified lines | ||
| 296 | 296 | uint64_t *mmap_offset); |
| 297 | 297 | int amdgpu_amdkfd_get_tile_config(struct amdgpu_device *adev, |
| 298 | 298 | struct tile_config *config); |
| 299 | −void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev); | |
| 299 | +void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, | |
| 300 | + bool reset); | |
| 300 | 301 | #if IS_ENABLED(CONFIG_HSA_AMD) |
| 301 | 302 | void amdgpu_amdkfd_gpuvm_init_mem_limits(void); |
| 302 | 303 | void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_device *adev, |
| @@ -166,7 +166,7 @@ int kgd_gfx_v9_init_interrupts(struct amdgpu_device *adev, uint32_t pipe_id) · 165 unmodified lines | ||
| 166 | 166 | |
| 167 | 167 | lock_srbm(adev, mec, pipe, 0, 0); |
| 168 | 168 | |
| 169 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmCPC_INT_CNTL), | |
| 169 | + WREG32_SOC15(GC, 0, mmCPC_INT_CNTL, | |
| 170 | 170 | CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK | |
| 171 | 171 | CP_INT_CNTL_RING0__OPCODE_ERROR_INT_ENABLE_MASK); |
| 172 | 172 | |
| @@ -279,7 +279,7 @@ int kgd_gfx_v9_hqd_load(struct amdgpu_device *adev, void *mqd, · 106 unmodified lines | ||
| 279 | 279 | lower_32_bits((uintptr_t)wptr)); |
| 280 | 280 | WREG32_RLC(SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_WPTR_POLL_ADDR_HI), |
| 281 | 281 | upper_32_bits((uintptr_t)wptr)); |
| 282 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmCP_PQ_WPTR_POLL_CNTL1), | |
| 282 | + WREG32_SOC15(GC, 0, mmCP_PQ_WPTR_POLL_CNTL1, | |
| 283 | 283 | (uint32_t)get_queue_mask(adev, pipe_id, queue_id)); |
| 284 | 284 | } |
| 285 | 285 | |
| @@ -488,13 +488,13 @@ bool kgd_gfx_v9_hqd_is_occupied(struct amdgpu_device *adev, · 202 unmodified lines | ||
| 488 | 488 | uint32_t low, high; |
| 489 | 489 | |
| 490 | 490 | acquire_queue(adev, pipe_id, queue_id); |
| 491 | − act = RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_HQD_ACTIVE)); | |
| 491 | + act = RREG32_SOC15(GC, 0, mmCP_HQD_ACTIVE); | |
| 492 | 492 | if (act) { |
| 493 | 493 | low = lower_32_bits(queue_address >> 8); |
| 494 | 494 | high = upper_32_bits(queue_address >> 8); |
| 495 | 495 | |
| 496 | − if (low == RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_BASE)) && | |
| 497 | − high == RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_HQD_PQ_BASE_HI))) | |
| 496 | + if (low == RREG32_SOC15(GC, 0, mmCP_HQD_PQ_BASE) && | |
| 497 | + high == RREG32_SOC15(GC, 0, mmCP_HQD_PQ_BASE_HI)) | |
| 498 | 498 | retval = true; |
| 499 | 499 | } |
| 500 | 500 | release_queue(adev); |
| @@ -556,7 +556,7 @@ int kgd_gfx_v9_hqd_destroy(struct amdgpu_device *adev, void *mqd, · 55 unmodified lines | ||
| 556 | 556 | |
| 557 | 557 | end_jiffies = (utimeout * HZ / 1000) + jiffies; |
| 558 | 558 | while (true) { |
| 559 | − temp = RREG32(SOC15_REG_OFFSET(GC, 0, mmCP_HQD_ACTIVE)); | |
| 559 | + temp = RREG32_SOC15(GC, 0, mmCP_HQD_ACTIVE); | |
| 560 | 560 | if (!(temp & CP_HQD_ACTIVE__ACTIVE_MASK)) |
| 561 | 561 | break; |
| 562 | 562 | if (time_after(jiffies, end_jiffies)) { |
| @@ -645,7 +645,7 @@ int kgd_gfx_v9_wave_control_execute(struct amdgpu_device *adev, · 82 unmodified lines | ||
| 645 | 645 | mutex_lock(&adev->grbm_idx_mutex); |
| 646 | 646 | |
| 647 | 647 | WREG32_SOC15_RLC_SHADOW(GC, 0, mmGRBM_GFX_INDEX, gfx_index_val); |
| 648 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_CMD), sq_cmd); | |
| 648 | + WREG32_SOC15(GC, 0, mmSQ_CMD, sq_cmd); | |
| 649 | 649 | |
| 650 | 650 | data = REG_SET_FIELD(data, GRBM_GFX_INDEX, |
| 651 | 651 | INSTANCE_BROADCAST_WRITES, 1); |
| @@ -722,7 +722,7 @@ static void get_wave_count(struct amdgpu_device *adev, int queue_idx, · 70 unmodified lines | ||
| 722 | 722 | pipe_idx = queue_idx / adev->gfx.mec.num_queue_per_pipe; |
| 723 | 723 | queue_slot = queue_idx % adev->gfx.mec.num_queue_per_pipe; |
| 724 | 724 | soc15_grbm_select(adev, 1, pipe_idx, queue_slot, 0); |
| 725 | − reg_val = RREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_CSQ_WF_ACTIVE_COUNT_0) + | |
| 725 | + reg_val = RREG32_SOC15_IP(GC, SOC15_REG_OFFSET(GC, 0, mmSPI_CSQ_WF_ACTIVE_COUNT_0) + | |
| 726 | 726 | queue_slot); |
| 727 | 727 | *wave_cnt = reg_val & SPI_CSQ_WF_ACTIVE_COUNT_0__COUNT_MASK; |
| 728 | 728 | if (*wave_cnt != 0) |
| @@ -809,8 +809,7 @@ void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid, · 80 unmodified lines | ||
| 809 | 809 | for (sh_idx = 0; sh_idx < sh_cnt; sh_idx++) { |
| 810 | 810 | |
| 811 | 811 | gfx_v9_0_select_se_sh(adev, se_idx, sh_idx, 0xffffffff); |
| 812 | − queue_map = RREG32(SOC15_REG_OFFSET(GC, 0, | |
| 813 | − mmSPI_CSQ_WF_ACTIVE_STATUS)); | |
| 812 | + queue_map = RREG32_SOC15(GC, 0, mmSPI_CSQ_WF_ACTIVE_STATUS); | |
| 814 | 813 | |
| 815 | 814 | /* |
| 816 | 815 | * Assumption: queue map encodes following schema: four |
| @@ -860,17 +859,17 @@ void kgd_gfx_v9_program_trap_handler_settings(struct amdgpu_device *adev, · 43 unmodified lines | ||
| 860 | 859 | /* |
| 861 | 860 | * Program TBA registers |
| 862 | 861 | */ |
| 863 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_LO), | |
| 862 | + WREG32_SOC15(GC, 0, mmSQ_SHADER_TBA_LO, | |
| 864 | 863 | lower_32_bits(tba_addr >> 8)); |
| 865 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TBA_HI), | |
| 864 | + WREG32_SOC15(GC, 0, mmSQ_SHADER_TBA_HI, | |
| 866 | 865 | upper_32_bits(tba_addr >> 8)); |
| 867 | 866 | |
| 868 | 867 | /* |
| 869 | 868 | * Program TMA registers |
| 870 | 869 | */ |
| 871 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_LO), | |
| 870 | + WREG32_SOC15(GC, 0, mmSQ_SHADER_TMA_LO, | |
| 872 | 871 | lower_32_bits(tma_addr >> 8)); |
| 873 | − WREG32(SOC15_REG_OFFSET(GC, 0, mmSQ_SHADER_TMA_HI), | |
| 872 | + WREG32_SOC15(GC, 0, mmSQ_SHADER_TMA_HI, | |
| 874 | 873 | upper_32_bits(tma_addr >> 8)); |
| 875 | 874 | |
| 876 | 875 | unlock_srbm(adev); |
| @@ -2317,6 +2317,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 2316 unmodified lines | ||
| 2317 | 2317 | |
| 2318 | 2318 | /* need to do gmc hw init early so we can allocate gpu mem */ |
| 2319 | 2319 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { |
| 2320 | + /* Try to reserve bad pages early */ | |
| 2321 | + if (amdgpu_sriov_vf(adev)) | |
| 2322 | + amdgpu_virt_exchange_data(adev); | |
| 2323 | + | |
| 2320 | 2324 | r = amdgpu_device_vram_scratch_init(adev); |
| 2321 | 2325 | if (r) { |
| 2322 | 2326 | DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r); |
| @@ -2348,7 +2352,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 25 unmodified lines | ||
| 2348 | 2352 | } |
| 2349 | 2353 | |
| 2350 | 2354 | if (amdgpu_sriov_vf(adev)) |
| 2351 | − amdgpu_virt_init_data_exchange(adev); | |
| 2355 | + amdgpu_virt_exchange_data(adev); | |
| 2352 | 2356 | |
| 2353 | 2357 | r = amdgpu_ib_pool_init(adev); |
| 2354 | 2358 | if (r) { |
| @@ -2615,11 +2619,10 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev) · 260 unmodified lines | ||
| 2615 | 2619 | if (r) |
| 2616 | 2620 | DRM_ERROR("enable mgpu fan boost failed (%d).\n", r); |
| 2617 | 2621 | |
| 2618 | − /* For XGMI + passthrough configuration on arcturus, enable light SBR */ | |
| 2619 | − if (adev->asic_type == CHIP_ARCTURUS && | |
| 2620 | − amdgpu_passthrough(adev) && | |
| 2621 | − adev->gmc.xgmi.num_physical_nodes > 1) | |
| 2622 | − smu_set_light_sbr(&adev->smu, true); | |
| 2622 | + /* For passthrough configuration on arcturus and aldebaran, enable special handling SBR */ | |
| 2623 | + if (amdgpu_passthrough(adev) && ((adev->asic_type == CHIP_ARCTURUS && adev->gmc.xgmi.num_physical_nodes > 1)|| | |
| 2624 | + adev->asic_type == CHIP_ALDEBARAN )) | |
| 2625 | + smu_handle_passthrough_sbr(&adev->smu, true); | |
| 2623 | 2626 | |
| 2624 | 2627 | if (adev->gmc.xgmi.num_physical_nodes > 1) { |
| 2625 | 2628 | mutex_lock(&mgpu_info.mutex); |
| @@ -3182,6 +3185,12 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev) · 556 unmodified lines | ||
| 3182 | 3185 | bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type) |
| 3183 | 3186 | { |
| 3184 | 3187 | switch (asic_type) { |
| 3188 | +#ifdef CONFIG_DRM_AMDGPU_SI | |
| 3189 | + case CHIP_HAINAN: | |
| 3190 | +#endif | |
| 3191 | + case CHIP_TOPAZ: | |
| 3192 | + /* chips with no display hardware */ | |
| 3193 | + return false; | |
| 3185 | 3194 | #if defined(CONFIG_DRM_AMD_DC) |
| 3186 | 3195 | case CHIP_TAHITI: |
| 3187 | 3196 | case CHIP_PITCAIRN: |
| @@ -3573,6 +3582,13 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 385 unmodified lines | ||
| 3573 | 3582 | if (r) |
| 3574 | 3583 | return r; |
| 3575 | 3584 | |
| 3585 | + /* Need to get xgmi info early to decide the reset behavior*/ | |
| 3586 | + if (adev->gmc.xgmi.supported) { | |
| 3587 | + r = adev->gfxhub.funcs->get_xgmi_info(adev); | |
| 3588 | + if (r) | |
| 3589 | + return r; | |
| 3590 | + } | |
| 3591 | + | |
| 3576 | 3592 | /* enable PCIE atomic ops */ |
| 3577 | 3593 | if (amdgpu_sriov_vf(adev)) |
| 3578 | 3594 | adev->have_atomics_support = ((struct amd_sriov_msg_pf2vf_info *) |
| @@ -3885,11 +3901,14 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) · 306 unmodified lines | ||
| 3885 | 3901 | |
| 3886 | 3902 | amdgpu_irq_fini_hw(adev); |
| 3887 | 3903 | |
| 3888 | − ttm_device_clear_dma_mappings(&adev->mman.bdev); | |
| 3904 | + if (adev->mman.initialized) | |
| 3905 | + ttm_device_clear_dma_mappings(&adev->mman.bdev); | |
| 3889 | 3906 | |
| 3890 | 3907 | amdgpu_gart_dummy_page_fini(adev); |
| 3891 | 3908 | |
| 3892 | − amdgpu_device_unmap_mmio(adev); | |
| 3909 | + if (drm_dev_is_unplugged(adev_to_drm(adev))) | |
| 3910 | + amdgpu_device_unmap_mmio(adev); | |
| 3911 | + | |
| 3893 | 3912 | } |
| 3894 | 3913 | |
| 3895 | 3914 | void amdgpu_device_fini_sw(struct amdgpu_device *adev) |
| @@ -4507,7 +4526,7 @@ int amdgpu_device_mode1_reset(struct amdgpu_device *adev) · 611 unmodified lines | ||
| 4507 | 4526 | int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, |
| 4508 | 4527 | struct amdgpu_reset_context *reset_context) |
| 4509 | 4528 | { |
| 4510 | − int i, j, r = 0; | |
| 4529 | + int i, r = 0; | |
| 4511 | 4530 | struct amdgpu_job *job = NULL; |
| 4512 | 4531 | bool need_full_reset = |
| 4513 | 4532 | test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags); |
| @@ -4529,15 +4548,8 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, · 15 unmodified lines | ||
| 4529 | 4548 | |
| 4530 | 4549 | /*clear job fence from fence drv to avoid force_completion |
| 4531 | 4550 | *leave NULL and vm flush fence in fence drv */ |
| 4532 | − for (j = 0; j <= ring->fence_drv.num_fences_mask; j++) { | |
| 4533 | − struct dma_fence *old, **ptr; | |
| 4551 | + amdgpu_fence_driver_clear_job_fences(ring); | |
| 4534 | 4552 | |
| 4535 | − ptr = &ring->fence_drv.fences[j]; | |
| 4536 | − old = rcu_dereference_protected(*ptr, 1); | |
| 4537 | − if (old && test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &old->flags)) { | |
| 4538 | − RCU_INIT_POINTER(*ptr, NULL); | |
| 4539 | − } | |
| 4540 | − } | |
| 4541 | 4553 | /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ |
| 4542 | 4554 | amdgpu_fence_driver_force_completion(ring); |
| 4543 | 4555 | } |
| @@ -565,10 +565,15 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev) · 564 unmodified lines | ||
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | |
| 568 | +union gc_info { | |
| 569 | + struct gc_info_v1_0 v1; | |
| 570 | + struct gc_info_v2_0 v2; | |
| 571 | +}; | |
| 572 | + | |
| 568 | 573 | int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) |
| 569 | 574 | { |
| 570 | 575 | struct binary_header *bhdr; |
| 571 | − struct gc_info_v1_0 *gc_info; | |
| 576 | + union gc_info *gc_info; | |
| 572 | 577 | |
| 573 | 578 | if (!adev->mman.discovery_bin) { |
| 574 | 579 | DRM_ERROR("ip discovery uninitialized\n"); |
| @@ -576,28 +581,55 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) · 1 unmodified line | ||
| 576 | 581 | } |
| 577 | 582 | |
| 578 | 583 | bhdr = (struct binary_header *)adev->mman.discovery_bin; |
| 579 | − gc_info = (struct gc_info_v1_0 *)(adev->mman.discovery_bin + | |
| 584 | + gc_info = (union gc_info *)(adev->mman.discovery_bin + | |
| 580 | 585 | le16_to_cpu(bhdr->table_list[GC].offset)); |
| 581 | − | |
| 582 | − adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->gc_num_se); | |
| 583 | − adev->gfx.config.max_cu_per_sh = 2 * (le32_to_cpu(gc_info->gc_num_wgp0_per_sa) + | |
| 584 | − le32_to_cpu(gc_info->gc_num_wgp1_per_sa)); | |
| 585 | − adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->gc_num_sa_per_se); | |
| 586 | − adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->gc_num_rb_per_se); | |
| 587 | − adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->gc_num_gl2c); | |
| 588 | − adev->gfx.config.max_gprs = le32_to_cpu(gc_info->gc_num_gprs); | |
| 589 | − adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->gc_num_max_gs_thds); | |
| 590 | − adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->gc_gs_table_depth); | |
| 591 | − adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->gc_gsprim_buff_depth); | |
| 592 | − adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->gc_double_offchip_lds_buffer); | |
| 593 | − adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->gc_wave_size); | |
| 594 | − adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->gc_max_waves_per_simd); | |
| 595 | − adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->gc_max_scratch_slots_per_cu); | |
| 596 | − adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->gc_lds_size); | |
| 597 | − adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->gc_num_sc_per_se) / | |
| 598 | − le32_to_cpu(gc_info->gc_num_sa_per_se); | |
| 599 | − adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->gc_num_packer_per_sc); | |
| 600 | − | |
| 586 | + switch (gc_info->v1.header.version_major) { | |
| 587 | + case 1: | |
| 588 | + adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->v1.gc_num_se); | |
| 589 | + adev->gfx.config.max_cu_per_sh = 2 * (le32_to_cpu(gc_info->v1.gc_num_wgp0_per_sa) + | |
| 590 | + le32_to_cpu(gc_info->v1.gc_num_wgp1_per_sa)); | |
| 591 | + adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->v1.gc_num_sa_per_se); | |
| 592 | + adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->v1.gc_num_rb_per_se); | |
| 593 | + adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->v1.gc_num_gl2c); | |
| 594 | + adev->gfx.config.max_gprs = le32_to_cpu(gc_info->v1.gc_num_gprs); | |
| 595 | + adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->v1.gc_num_max_gs_thds); | |
| 596 | + adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->v1.gc_gs_table_depth); | |
| 597 | + adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->v1.gc_gsprim_buff_depth); | |
| 598 | + adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->v1.gc_double_offchip_lds_buffer); | |
| 599 | + adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->v1.gc_wave_size); | |
| 600 | + adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->v1.gc_max_waves_per_simd); | |
| 601 | + adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->v1.gc_max_scratch_slots_per_cu); | |
| 602 | + adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->v1.gc_lds_size); | |
| 603 | + adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->v1.gc_num_sc_per_se) / | |
| 604 | + le32_to_cpu(gc_info->v1.gc_num_sa_per_se); | |
| 605 | + adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->v1.gc_num_packer_per_sc); | |
| 606 | + break; | |
| 607 | + case 2: | |
| 608 | + adev->gfx.config.max_shader_engines = le32_to_cpu(gc_info->v2.gc_num_se); | |
| 609 | + adev->gfx.config.max_cu_per_sh = le32_to_cpu(gc_info->v2.gc_num_cu_per_sh); | |
| 610 | + adev->gfx.config.max_sh_per_se = le32_to_cpu(gc_info->v2.gc_num_sh_per_se); | |
| 611 | + adev->gfx.config.max_backends_per_se = le32_to_cpu(gc_info->v2.gc_num_rb_per_se); | |
| 612 | + adev->gfx.config.max_texture_channel_caches = le32_to_cpu(gc_info->v2.gc_num_tccs); | |
| 613 | + adev->gfx.config.max_gprs = le32_to_cpu(gc_info->v2.gc_num_gprs); | |
| 614 | + adev->gfx.config.max_gs_threads = le32_to_cpu(gc_info->v2.gc_num_max_gs_thds); | |
| 615 | + adev->gfx.config.gs_vgt_table_depth = le32_to_cpu(gc_info->v2.gc_gs_table_depth); | |
| 616 | + adev->gfx.config.gs_prim_buffer_depth = le32_to_cpu(gc_info->v2.gc_gsprim_buff_depth); | |
| 617 | + adev->gfx.config.double_offchip_lds_buf = le32_to_cpu(gc_info->v2.gc_double_offchip_lds_buffer); | |
| 618 | + adev->gfx.cu_info.wave_front_size = le32_to_cpu(gc_info->v2.gc_wave_size); | |
| 619 | + adev->gfx.cu_info.max_waves_per_simd = le32_to_cpu(gc_info->v2.gc_max_waves_per_simd); | |
| 620 | + adev->gfx.cu_info.max_scratch_slots_per_cu = le32_to_cpu(gc_info->v2.gc_max_scratch_slots_per_cu); | |
| 621 | + adev->gfx.cu_info.lds_size = le32_to_cpu(gc_info->v2.gc_lds_size); | |
| 622 | + adev->gfx.config.num_sc_per_sh = le32_to_cpu(gc_info->v2.gc_num_sc_per_se) / | |
| 623 | + le32_to_cpu(gc_info->v2.gc_num_sh_per_se); | |
| 624 | + adev->gfx.config.num_packer_per_sc = le32_to_cpu(gc_info->v2.gc_num_packer_per_sc); | |
| 625 | + break; | |
| 626 | + default: | |
| 627 | + dev_err(adev->dev, | |
| 628 | + "Unhandled GC info table %d.%d\n", | |
| 629 | + gc_info->v1.header.version_major, | |
| 630 | + gc_info->v1.header.version_minor); | |
| 631 | + return -EINVAL; | |
| 632 | + } | |
| 601 | 633 | return 0; |
| 602 | 634 | } |
| 603 | 635 | |
| @@ -992,7 +1024,7 @@ static int amdgpu_discovery_set_mes_ip_blocks(struct amdgpu_device *adev) · 388 unmodified lines | ||
| 992 | 1024 | amdgpu_device_ip_block_add(adev, &mes_v10_1_ip_block); |
| 993 | 1025 | break; |
| 994 | 1026 | default: |
| 995 | − break;; | |
| 1027 | + break; | |
| 996 | 1028 | } |
| 997 | 1029 | return 0; |
| 998 | 1030 | } |
| @@ -330,10 +330,11 @@ module_param_named(aspm, amdgpu_aspm, int, 0444); · 329 unmodified lines | ||
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | 332 | * DOC: runpm (int) |
| 333 | − * Override for runtime power management control for dGPUs in PX/HG laptops. The amdgpu driver can dynamically power down | |
| 334 | − * the dGPU on PX/HG laptops when it is idle. The default is -1 (auto enable). Setting the value to 0 disables this functionality. | |
| 333 | + * Override for runtime power management control for dGPUs. The amdgpu driver can dynamically power down | |
| 334 | + * the dGPUs when they are idle if supported. The default is -1 (auto enable). | |
| 335 | + * Setting the value to 0 disables this functionality. | |
| 335 | 336 | */ |
| 336 | −MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = PX only default)"); | |
| 337 | +MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto)"); | |
| 337 | 338 | module_param_named(runpm, amdgpu_runtime_pm, int, 0444); |
| 338 | 339 | |
| 339 | 340 | /** |
| @@ -2168,7 +2169,10 @@ static int amdgpu_pmops_suspend(struct device *dev) · 1828 unmodified lines | ||
| 2168 | 2169 | adev->in_s3 = true; |
| 2169 | 2170 | r = amdgpu_device_suspend(drm_dev, true); |
| 2170 | 2171 | adev->in_s3 = false; |
| 2171 | − | |
| 2172 | + if (r) | |
| 2173 | + return r; | |
| 2174 | + if (!adev->in_s0ix) | |
| 2175 | + r = amdgpu_asic_reset(adev); | |
| 2172 | 2176 | return r; |
| 2173 | 2177 | } |
| 2174 | 2178 | |
| @@ -2249,12 +2253,27 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) · 74 unmodified lines | ||
| 2249 | 2253 | if (amdgpu_device_supports_px(drm_dev)) |
| 2250 | 2254 | drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; |
| 2251 | 2255 | |
| 2256 | + /* | |
| 2257 | + * By setting mp1_state as PP_MP1_STATE_UNLOAD, MP1 will do some | |
| 2258 | + * proper cleanups and put itself into a state ready for PNP. That | |
| 2259 | + * can address some random resuming failure observed on BOCO capable | |
| 2260 | + * platforms. | |
| 2261 | + * TODO: this may be also needed for PX capable platform. | |
| 2262 | + */ | |
| 2263 | + if (amdgpu_device_supports_boco(drm_dev)) | |
| 2264 | + adev->mp1_state = PP_MP1_STATE_UNLOAD; | |
| 2265 | + | |
| 2252 | 2266 | ret = amdgpu_device_suspend(drm_dev, false); |
| 2253 | 2267 | if (ret) { |
| 2254 | 2268 | adev->in_runpm = false; |
| 2269 | + if (amdgpu_device_supports_boco(drm_dev)) | |
| 2270 | + adev->mp1_state = PP_MP1_STATE_NONE; | |
| 2255 | 2271 | return ret; |
| 2256 | 2272 | } |
| 2257 | 2273 | |
| 2274 | + if (amdgpu_device_supports_boco(drm_dev)) | |
| 2275 | + adev->mp1_state = PP_MP1_STATE_NONE; | |
| 2276 | + | |
| 2258 | 2277 | if (amdgpu_device_supports_px(drm_dev)) { |
| 2259 | 2278 | /* Only need to handle PCI state in the driver for ATPX |
| 2260 | 2279 | * PCI core handles it for _PR3. |
| @@ -77,11 +77,13 @@ void amdgpu_fence_slab_fini(void) · 76 unmodified lines | ||
| 77 | 77 | * Cast helper |
| 78 | 78 | */ |
| 79 | 79 | static const struct dma_fence_ops amdgpu_fence_ops; |
| 80 | +static const struct dma_fence_ops amdgpu_job_fence_ops; | |
| 80 | 81 | static inline struct amdgpu_fence *to_amdgpu_fence(struct dma_fence *f) |
| 81 | 82 | { |
| 82 | 83 | struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); |
| 83 | 84 | |
| 84 | − if (__f->base.ops == &amdgpu_fence_ops) | |
| 85 | + if (__f->base.ops == &amdgpu_fence_ops || | |
| 86 | + __f->base.ops == &amdgpu_job_fence_ops) | |
| 85 | 87 | return __f; |
| 86 | 88 | |
| 87 | 89 | return NULL; |
| @@ -158,19 +160,18 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, struct amd · 70 unmodified lines | ||
| 158 | 160 | } |
| 159 | 161 | |
| 160 | 162 | seq = ++ring->fence_drv.sync_seq; |
| 161 | − if (job != NULL && job->job_run_counter) { | |
| 163 | + if (job && job->job_run_counter) { | |
| 162 | 164 | /* reinit seq for resubmitted jobs */ |
| 163 | 165 | fence->seqno = seq; |
| 164 | 166 | } else { |
| 165 | − dma_fence_init(fence, &amdgpu_fence_ops, | |
| 166 | − &ring->fence_drv.lock, | |
| 167 | − adev->fence_context + ring->idx, | |
| 168 | − seq); | |
| 169 | − } | |
| 170 | − | |
| 171 | − if (job != NULL) { | |
| 172 | − /* mark this fence has a parent job */ | |
| 173 | − set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags); | |
| 167 | + if (job) | |
| 168 | + dma_fence_init(fence, &amdgpu_job_fence_ops, | |
| 169 | + &ring->fence_drv.lock, | |
| 170 | + adev->fence_context + ring->idx, seq); | |
| 171 | + else | |
| 172 | + dma_fence_init(fence, &amdgpu_fence_ops, | |
| 173 | + &ring->fence_drv.lock, | |
| 174 | + adev->fence_context + ring->idx, seq); | |
| 174 | 175 | } |
| 175 | 176 | |
| 176 | 177 | amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, |
| @@ -620,6 +621,25 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev) · 443 unmodified lines | ||
| 620 | 621 | } |
| 621 | 622 | } |
| 622 | 623 | |
| 624 | +/** | |
| 625 | + * amdgpu_fence_driver_clear_job_fences - clear job embedded fences of ring | |
| 626 | + * | |
| 627 | + * @ring: fence of the ring to be cleared | |
| 628 | + * | |
| 629 | + */ | |
| 630 | +void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring) | |
| 631 | +{ | |
| 632 | + int i; | |
| 633 | + struct dma_fence *old, **ptr; | |
| 634 | + | |
| 635 | + for (i = 0; i <= ring->fence_drv.num_fences_mask; i++) { | |
| 636 | + ptr = &ring->fence_drv.fences[i]; | |
| 637 | + old = rcu_dereference_protected(*ptr, 1); | |
| 638 | + if (old && old->ops == &amdgpu_job_fence_ops) | |
| 639 | + RCU_INIT_POINTER(*ptr, NULL); | |
| 640 | + } | |
| 641 | +} | |
| 642 | + | |
| 623 | 643 | /** |
| 624 | 644 | * amdgpu_fence_driver_force_completion - force signal latest fence of ring |
| 625 | 645 | * |
| @@ -643,16 +663,14 @@ static const char *amdgpu_fence_get_driver_name(struct dma_fence *fence) · 17 unmodified lines | ||
| 643 | 663 | |
| 644 | 664 | static const char *amdgpu_fence_get_timeline_name(struct dma_fence *f) |
| 645 | 665 | { |
| 646 | − struct amdgpu_ring *ring; | |
| 666 | + return (const char *)to_amdgpu_fence(f)->ring->name; | |
| 667 | +} | |
| 647 | 668 | |
| 648 | − if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { | |
| 649 | − struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); | |
| 669 | +static const char *amdgpu_job_fence_get_timeline_name(struct dma_fence *f) | |
| 670 | +{ | |
| 671 | + struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); | |
| 650 | 672 | |
| 651 | − ring = to_amdgpu_ring(job->base.sched); | |
| 652 | − } else { | |
| 653 | − ring = to_amdgpu_fence(f)->ring; | |
| 654 | − } | |
| 655 | − return (const char *)ring->name; | |
| 673 | + return (const char *)to_amdgpu_ring(job->base.sched)->name; | |
| 656 | 674 | } |
| 657 | 675 | |
| 658 | 676 | /** |
| @@ -665,18 +683,25 @@ static const char *amdgpu_fence_get_timeline_name(struct dma_fence *f) · 6 unmodified lines | ||
| 665 | 683 | */ |
| 666 | 684 | static bool amdgpu_fence_enable_signaling(struct dma_fence *f) |
| 667 | 685 | { |
| 668 | − struct amdgpu_ring *ring; | |
| 686 | + if (!timer_pending(&to_amdgpu_fence(f)->ring->fence_drv.fallback_timer)) | |
| 687 | + amdgpu_fence_schedule_fallback(to_amdgpu_fence(f)->ring); | |
| 669 | 688 | |
| 670 | − if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { | |
| 671 | − struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); | |
| 689 | + return true; | |
| 690 | +} | |
| 672 | 691 | |
| 673 | − ring = to_amdgpu_ring(job->base.sched); | |
| 674 | − } else { | |
| 675 | − ring = to_amdgpu_fence(f)->ring; | |
| 676 | − } | |
| 692 | +/** | |
| 693 | + * amdgpu_job_fence_enable_signaling - enable signalling on job fence | |
| 694 | + * @f: fence | |
| 695 | + * | |
| 696 | + * This is the simliar function with amdgpu_fence_enable_signaling above, it | |
| 697 | + * only handles the job embedded fence. | |
| 698 | + */ | |
| 699 | +static bool amdgpu_job_fence_enable_signaling(struct dma_fence *f) | |
| 700 | +{ | |
| 701 | + struct amdgpu_job *job = container_of(f, struct amdgpu_job, hw_fence); | |
| 677 | 702 | |
| 678 | − if (!timer_pending(&ring->fence_drv.fallback_timer)) | |
| 679 | − amdgpu_fence_schedule_fallback(ring); | |
| 703 | + if (!timer_pending(&to_amdgpu_ring(job->base.sched)->fence_drv.fallback_timer)) | |
| 704 | + amdgpu_fence_schedule_fallback(to_amdgpu_ring(job->base.sched)); | |
| 680 | 705 | |
| 681 | 706 | return true; |
| 682 | 707 | } |
| @@ -692,19 +717,23 @@ static void amdgpu_fence_free(struct rcu_head *rcu) · 9 unmodified lines | ||
| 692 | 717 | { |
| 693 | 718 | struct dma_fence *f = container_of(rcu, struct dma_fence, rcu); |
| 694 | 719 | |
| 695 | − if (test_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &f->flags)) { | |
| 696 | − /* free job if fence has a parent job */ | |
| 697 | − struct amdgpu_job *job; | |
| 698 | − | |
| 699 | − job = container_of(f, struct amdgpu_job, hw_fence); | |
| 700 | − kfree(job); | |
| 701 | − } else { | |
| 702 | 720 | /* free fence_slab if it's separated fence*/ |
| 703 | − struct amdgpu_fence *fence; | |
| 721 | + kmem_cache_free(amdgpu_fence_slab, to_amdgpu_fence(f)); | |
| 722 | +} | |
| 704 | 723 | |
| 705 | − fence = to_amdgpu_fence(f); | |
| 706 | − kmem_cache_free(amdgpu_fence_slab, fence); | |
| 707 | − } | |
| 724 | +/** | |
| 725 | + * amdgpu_job_fence_free - free up the job with embedded fence | |
| 726 | + * | |
| 727 | + * @rcu: RCU callback head | |
| 728 | + * | |
| 729 | + * Free up the job with embedded fence after the RCU grace period. | |
| 730 | + */ | |
| 731 | +static void amdgpu_job_fence_free(struct rcu_head *rcu) | |
| 732 | +{ | |
| 733 | + struct dma_fence *f = container_of(rcu, struct dma_fence, rcu); | |
| 734 | + | |
| 735 | + /* free job if fence has a parent job */ | |
| 736 | + kfree(container_of(f, struct amdgpu_job, hw_fence)); | |
| 708 | 737 | } |
| 709 | 738 | |
| 710 | 739 | /** |
| @@ -720,6 +749,19 @@ static void amdgpu_fence_release(struct dma_fence *f) · 9 unmodified lines | ||
| 720 | 749 | call_rcu(&f->rcu, amdgpu_fence_free); |
| 721 | 750 | } |
| 722 | 751 | |
| 752 | +/** | |
| 753 | + * amdgpu_job_fence_release - callback that job embedded fence can be freed | |
| 754 | + * | |
| 755 | + * @f: fence | |
| 756 | + * | |
| 757 | + * This is the simliar function with amdgpu_fence_release above, it | |
| 758 | + * only handles the job embedded fence. | |
| 759 | + */ | |
| 760 | +static void amdgpu_job_fence_release(struct dma_fence *f) | |
| 761 | +{ | |
| 762 | + call_rcu(&f->rcu, amdgpu_job_fence_free); | |
| 763 | +} | |
| 764 | + | |
| 723 | 765 | static const struct dma_fence_ops amdgpu_fence_ops = { |
| 724 | 766 | .get_driver_name = amdgpu_fence_get_driver_name, |
| 725 | 767 | .get_timeline_name = amdgpu_fence_get_timeline_name, |
| @@ -727,6 +769,12 @@ static const struct dma_fence_ops amdgpu_fence_ops = { · 1 unmodified line | ||
| 727 | 769 | .release = amdgpu_fence_release, |
| 728 | 770 | }; |
| 729 | 771 | |
| 772 | +static const struct dma_fence_ops amdgpu_job_fence_ops = { | |
| 773 | + .get_driver_name = amdgpu_fence_get_driver_name, | |
| 774 | + .get_timeline_name = amdgpu_job_fence_get_timeline_name, | |
| 775 | + .enable_signaling = amdgpu_job_fence_enable_signaling, | |
| 776 | + .release = amdgpu_job_fence_release, | |
| 777 | +}; | |
| 730 | 778 | |
| 731 | 779 | /* |
| 732 | 780 | * Fence debugfs |
| @@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev) · 55 unmodified lines | ||
| 56 | 56 | return true; |
| 57 | 57 | else |
| 58 | 58 | return false; |
| 59 | + case CHIP_ALDEBARAN: | |
| 60 | + /* All Aldebaran SKUs have the FRU */ | |
| 61 | + return true; | |
| 59 | 62 | default: |
| 60 | 63 | return false; |
| 61 | 64 | } |
| @@ -88,13 +91,17 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 26 unmodified lines | ||
| 88 | 91 | |
| 89 | 92 | int amdgpu_fru_get_product_info(struct amdgpu_device *adev) |
| 90 | 93 | { |
| 91 | − unsigned char buff[34]; | |
| 94 | + unsigned char buff[AMDGPU_PRODUCT_NAME_LEN+2]; | |
| 92 | 95 | u32 addrptr; |
| 93 | 96 | int size, len; |
| 97 | + int offset = 2; | |
| 94 | 98 | |
| 95 | 99 | if (!is_fru_eeprom_supported(adev)) |
| 96 | 100 | return 0; |
| 97 | 101 | |
| 102 | + if (adev->asic_type == CHIP_ALDEBARAN) | |
| 103 | + offset = 0; | |
| 104 | + | |
| 98 | 105 | /* If algo exists, it means that the i2c_adapter's initialized */ |
| 99 | 106 | if (!adev->pm.smu_i2c.algo) { |
| 100 | 107 | DRM_WARN("Cannot access FRU, EEPROM accessor not initialized"); |
| @@ -131,15 +138,13 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 30 unmodified lines | ||
| 131 | 138 | } |
| 132 | 139 | |
| 133 | 140 | len = size; |
| 134 | − /* Product name should only be 32 characters. Any more, | |
| 135 | − * and something could be wrong. Cap it at 32 to be safe | |
| 136 | − */ | |
| 137 | − if (len >= sizeof(adev->product_name)) { | |
| 138 | − DRM_WARN("FRU Product Number is larger than 32 characters. This is likely a mistake"); | |
| 139 | − len = sizeof(adev->product_name) - 1; | |
| 141 | + if (len >= AMDGPU_PRODUCT_NAME_LEN) { | |
| 142 | + DRM_WARN("FRU Product Name is larger than %d characters. This is likely a mistake", | |
| 143 | + AMDGPU_PRODUCT_NAME_LEN); | |
| 144 | + len = AMDGPU_PRODUCT_NAME_LEN - 1; | |
| 140 | 145 | } |
| 141 | 146 | /* Start at 2 due to buff using fields 0 and 1 for the address */ |
| 142 | − memcpy(adev->product_name, &buff[2], len); | |
| 147 | + memcpy(adev->product_name, &buff[offset], len); | |
| 143 | 148 | adev->product_name[len] = '\0'; |
| 144 | 149 | |
| 145 | 150 | addrptr += size + 1; |
| @@ -157,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 11 unmodified lines | ||
| 157 | 162 | DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake"); |
| 158 | 163 | len = sizeof(adev->product_number) - 1; |
| 159 | 164 | } |
| 160 | − memcpy(adev->product_number, &buff[2], len); | |
| 165 | + memcpy(adev->product_number, &buff[offset], len); | |
| 161 | 166 | adev->product_number[len] = '\0'; |
| 162 | 167 | |
| 163 | 168 | addrptr += size + 1; |
| @@ -184,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 20 unmodified lines | ||
| 184 | 189 | DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake"); |
| 185 | 190 | len = sizeof(adev->serial) - 1; |
| 186 | 191 | } |
| 187 | − memcpy(adev->serial, &buff[2], len); | |
| 192 | + memcpy(adev->serial, &buff[offset], len); | |
| 188 | 193 | adev->serial[len] = '\0'; |
| 189 | 194 | |
| 190 | 195 | return 0; |
| @@ -264,6 +264,9 @@ static int amdgpu_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_str · 263 unmodified lines | ||
| 264 | 264 | !(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) |
| 265 | 265 | vma->vm_flags &= ~VM_MAYWRITE; |
| 266 | 266 | |
| 267 | + if (bo->kfd_bo) | |
| 268 | + vma->vm_flags |= VM_DONTCOPY; | |
| 269 | + | |
| 267 | 270 | return drm_gem_ttm_mmap(obj, vma); |
| 268 | 271 | } |
| 269 | 272 | |
| @@ -53,9 +53,6 @@ enum amdgpu_ring_priority_level { · 52 unmodified lines | ||
| 53 | 53 | #define AMDGPU_FENCE_FLAG_INT (1 << 1) |
| 54 | 54 | #define AMDGPU_FENCE_FLAG_TC_WB_ONLY (1 << 2) |
| 55 | 55 | |
| 56 | −/* fence flag bit to indicate the face is embedded in job*/ | |
| 57 | −#define AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT (DMA_FENCE_FLAG_USER_BITS + 1) | |
| 58 | − | |
| 59 | 56 | #define to_amdgpu_ring(s) container_of((s), struct amdgpu_ring, sched) |
| 60 | 57 | |
| 61 | 58 | #define AMDGPU_IB_POOL_SIZE (1024 * 1024) |
| @@ -114,6 +111,7 @@ struct amdgpu_fence_driver { · 52 unmodified lines | ||
| 114 | 111 | struct dma_fence **fences; |
| 115 | 112 | }; |
| 116 | 113 | |
| 114 | +void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring); | |
| 117 | 115 | void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring); |
| 118 | 116 | |
| 119 | 117 | int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, |
| @@ -23,74 +23,10 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include "amdgpu_ras.h" |
| 25 | 25 | |
| 26 | −int amdgpu_umc_ras_late_init(struct amdgpu_device *adev) | |
| 27 | −{ | |
| 28 | − int r; | |
| 29 | − struct ras_fs_if fs_info = { | |
| 30 | − .sysfs_name = "umc_err_count", | |
| 31 | − }; | |
| 32 | − struct ras_ih_if ih_info = { | |
| 33 | − .cb = amdgpu_umc_process_ras_data_cb, | |
| 34 | − }; | |
| 35 | − | |
| 36 | − if (!adev->umc.ras_if) { | |
| 37 | − adev->umc.ras_if = | |
| 38 | − kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); | |
| 39 | − if (!adev->umc.ras_if) | |
| 40 | − return -ENOMEM; | |
| 41 | − adev->umc.ras_if->block = AMDGPU_RAS_BLOCK__UMC; | |
| 42 | − adev->umc.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; | |
| 43 | − adev->umc.ras_if->sub_block_index = 0; | |
| 44 | − } | |
| 45 | − ih_info.head = fs_info.head = *adev->umc.ras_if; | |
| 46 | − | |
| 47 | − r = amdgpu_ras_late_init(adev, adev->umc.ras_if, | |
| 48 | − &fs_info, &ih_info); | |
| 49 | − if (r) | |
| 50 | − goto free; | |
| 51 | − | |
| 52 | − if (amdgpu_ras_is_supported(adev, adev->umc.ras_if->block)) { | |
| 53 | − r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); | |
| 54 | − if (r) | |
| 55 | − goto late_fini; | |
| 56 | − } else { | |
| 57 | − r = 0; | |
| 58 | − goto free; | |
| 59 | − } | |
| 60 | − | |
| 61 | − /* ras init of specific umc version */ | |
| 62 | − if (adev->umc.ras_funcs && | |
| 63 | − adev->umc.ras_funcs->err_cnt_init) | |
| 64 | − adev->umc.ras_funcs->err_cnt_init(adev); | |
| 65 | − | |
| 66 | − return 0; | |
| 67 | − | |
| 68 | −late_fini: | |
| 69 | − amdgpu_ras_late_fini(adev, adev->umc.ras_if, &ih_info); | |
| 70 | −free: | |
| 71 | − kfree(adev->umc.ras_if); | |
| 72 | − adev->umc.ras_if = NULL; | |
| 73 | − return r; | |
| 74 | −} | |
| 75 | − | |
| 76 | −void amdgpu_umc_ras_fini(struct amdgpu_device *adev) | |
| 77 | −{ | |
| 78 | − if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) && | |
| 79 | − adev->umc.ras_if) { | |
| 80 | − struct ras_common_if *ras_if = adev->umc.ras_if; | |
| 81 | − struct ras_ih_if ih_info = { | |
| 82 | − .head = *ras_if, | |
| 83 | − .cb = amdgpu_umc_process_ras_data_cb, | |
| 84 | − }; | |
| 85 | − | |
| 86 | − amdgpu_ras_late_fini(adev, ras_if, &ih_info); | |
| 87 | − kfree(ras_if); | |
| 88 | − } | |
| 89 | −} | |
| 90 | − | |
| 91 | −int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, | |
| 26 | +static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev, | |
| 92 | 27 | void *ras_error_status, |
| 93 | − struct amdgpu_iv_entry *entry) | |
| 28 | + struct amdgpu_iv_entry *entry, | |
| 29 | + bool reset) | |
| 94 | 30 | { |
| 95 | 31 | struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; |
| 96 | 32 | struct amdgpu_ras *con = amdgpu_ras_get_context(adev); |
| @@ -164,13 +100,108 @@ int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, · 67 unmodified lines | ||
| 164 | 100 | adev->smu.ppt_funcs->send_hbm_bad_pages_num(&adev->smu, con->eeprom_control.ras_num_recs); |
| 165 | 101 | } |
| 166 | 102 | |
| 167 | − amdgpu_ras_reset_gpu(adev); | |
| 103 | + if (reset) | |
| 104 | + amdgpu_ras_reset_gpu(adev); | |
| 168 | 105 | } |
| 169 | 106 | |
| 170 | 107 | kfree(err_data->err_addr); |
| 171 | 108 | return AMDGPU_RAS_SUCCESS; |
| 172 | 109 | } |
| 173 | 110 | |
| 111 | +int amdgpu_umc_poison_handler(struct amdgpu_device *adev, | |
| 112 | + void *ras_error_status, | |
| 113 | + bool reset) | |
| 114 | +{ | |
| 115 | + int ret; | |
| 116 | + struct ras_err_data *err_data = (struct ras_err_data *)ras_error_status; | |
| 117 | + struct ras_common_if head = { | |
| 118 | + .block = AMDGPU_RAS_BLOCK__UMC, | |
| 119 | + }; | |
| 120 | + struct ras_manager *obj = amdgpu_ras_find_obj(adev, &head); | |
| 121 | + | |
| 122 | + ret = | |
| 123 | + amdgpu_umc_do_page_retirement(adev, ras_error_status, NULL, reset); | |
| 124 | + | |
| 125 | + if (ret == AMDGPU_RAS_SUCCESS && obj) { | |
| 126 | + obj->err_data.ue_count += err_data->ue_count; | |
| 127 | + obj->err_data.ce_count += err_data->ce_count; | |
| 128 | + } | |
| 129 | + | |
| 130 | + return ret; | |
| 131 | +} | |
| 132 | + | |
| 133 | +static int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, | |
| 134 | + void *ras_error_status, | |
| 135 | + struct amdgpu_iv_entry *entry) | |
| 136 | +{ | |
| 137 | + return amdgpu_umc_do_page_retirement(adev, ras_error_status, entry, true); | |
| 138 | +} | |
| 139 | + | |
| 140 | +int amdgpu_umc_ras_late_init(struct amdgpu_device *adev) | |
| 141 | +{ | |
| 142 | + int r; | |
| 143 | + struct ras_fs_if fs_info = { | |
| 144 | + .sysfs_name = "umc_err_count", | |
| 145 | + }; | |
| 146 | + struct ras_ih_if ih_info = { | |
| 147 | + .cb = amdgpu_umc_process_ras_data_cb, | |
| 148 | + }; | |
| 149 | + | |
| 150 | + if (!adev->umc.ras_if) { | |
| 151 | + adev->umc.ras_if = | |
| 152 | + kmalloc(sizeof(struct ras_common_if), GFP_KERNEL); | |
| 153 | + if (!adev->umc.ras_if) | |
| 154 | + return -ENOMEM; | |
| 155 | + adev->umc.ras_if->block = AMDGPU_RAS_BLOCK__UMC; | |
| 156 | + adev->umc.ras_if->type = AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE; | |
| 157 | + adev->umc.ras_if->sub_block_index = 0; | |
| 158 | + } | |
| 159 | + ih_info.head = fs_info.head = *adev->umc.ras_if; | |
| 160 | + | |
| 161 | + r = amdgpu_ras_late_init(adev, adev->umc.ras_if, | |
| 162 | + &fs_info, &ih_info); | |
| 163 | + if (r) | |
| 164 | + goto free; | |
| 165 | + | |
| 166 | + if (amdgpu_ras_is_supported(adev, adev->umc.ras_if->block)) { | |
| 167 | + r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0); | |
| 168 | + if (r) | |
| 169 | + goto late_fini; | |
| 170 | + } else { | |
| 171 | + r = 0; | |
| 172 | + goto free; | |
| 173 | + } | |
| 174 | + | |
| 175 | + /* ras init of specific umc version */ | |
| 176 | + if (adev->umc.ras_funcs && | |
| 177 | + adev->umc.ras_funcs->err_cnt_init) | |
| 178 | + adev->umc.ras_funcs->err_cnt_init(adev); | |
| 179 | + | |
| 180 | + return 0; | |
| 181 | + | |
| 182 | +late_fini: | |
| 183 | + amdgpu_ras_late_fini(adev, adev->umc.ras_if, &ih_info); | |
| 184 | +free: | |
| 185 | + kfree(adev->umc.ras_if); | |
| 186 | + adev->umc.ras_if = NULL; | |
| 187 | + return r; | |
| 188 | +} | |
| 189 | + | |
| 190 | +void amdgpu_umc_ras_fini(struct amdgpu_device *adev) | |
| 191 | +{ | |
| 192 | + if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) && | |
| 193 | + adev->umc.ras_if) { | |
| 194 | + struct ras_common_if *ras_if = adev->umc.ras_if; | |
| 195 | + struct ras_ih_if ih_info = { | |
| 196 | + .head = *ras_if, | |
| 197 | + .cb = amdgpu_umc_process_ras_data_cb, | |
| 198 | + }; | |
| 199 | + | |
| 200 | + amdgpu_ras_late_fini(adev, ras_if, &ih_info); | |
| 201 | + kfree(ras_if); | |
| 202 | + } | |
| 203 | +} | |
| 204 | + | |
| 174 | 205 | int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev, |
| 175 | 206 | struct amdgpu_irq_src *source, |
| 176 | 207 | struct amdgpu_iv_entry *entry) |
| @@ -78,9 +78,9 @@ struct amdgpu_umc { · 77 unmodified lines | ||
| 78 | 78 | |
| 79 | 79 | int amdgpu_umc_ras_late_init(struct amdgpu_device *adev); |
| 80 | 80 | void amdgpu_umc_ras_fini(struct amdgpu_device *adev); |
| 81 | −int amdgpu_umc_process_ras_data_cb(struct amdgpu_device *adev, | |
| 81 | +int amdgpu_umc_poison_handler(struct amdgpu_device *adev, | |
| 82 | 82 | void *ras_error_status, |
| 83 | − struct amdgpu_iv_entry *entry); | |
| 83 | + bool reset); | |
| 84 | 84 | int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev, |
| 85 | 85 | struct amdgpu_irq_src *source, |
| 86 | 86 | struct amdgpu_iv_entry *entry); |
| @@ -622,17 +622,35 @@ void amdgpu_virt_fini_data_exchange(struct amdgpu_device *adev) · 621 unmodified lines | ||
| 622 | 622 | |
| 623 | 623 | void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) |
| 624 | 624 | { |
| 625 | − uint64_t bp_block_offset = 0; | |
| 626 | − uint32_t bp_block_size = 0; | |
| 627 | − struct amd_sriov_msg_pf2vf_info *pf2vf_v2 = NULL; | |
| 628 | − | |
| 629 | 625 | adev->virt.fw_reserve.p_pf2vf = NULL; |
| 630 | 626 | adev->virt.fw_reserve.p_vf2pf = NULL; |
| 631 | 627 | adev->virt.vf2pf_update_interval_ms = 0; |
| 632 | 628 | |
| 633 | − if (adev->mman.fw_vram_usage_va != NULL) { | |
| 629 | + if (adev->bios != NULL) { | |
| 634 | 630 | adev->virt.vf2pf_update_interval_ms = 2000; |
| 635 | 631 | |
| 632 | + adev->virt.fw_reserve.p_pf2vf = | |
| 633 | + (struct amd_sriov_msg_pf2vf_info_header *) | |
| 634 | + (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10)); | |
| 635 | + | |
| 636 | + amdgpu_virt_read_pf2vf_data(adev); | |
| 637 | + } | |
| 638 | + | |
| 639 | + if (adev->virt.vf2pf_update_interval_ms != 0) { | |
| 640 | + INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); | |
| 641 | + schedule_delayed_work(&(adev->virt.vf2pf_work), msecs_to_jiffies(adev->virt.vf2pf_update_interval_ms)); | |
| 642 | + } | |
| 643 | +} | |
| 644 | + | |
| 645 | + | |
| 646 | +void amdgpu_virt_exchange_data(struct amdgpu_device *adev) | |
| 647 | +{ | |
| 648 | + uint64_t bp_block_offset = 0; | |
| 649 | + uint32_t bp_block_size = 0; | |
| 650 | + struct amd_sriov_msg_pf2vf_info *pf2vf_v2 = NULL; | |
| 651 | + | |
| 652 | + if (adev->mman.fw_vram_usage_va != NULL) { | |
| 653 | + | |
| 636 | 654 | adev->virt.fw_reserve.p_pf2vf = |
| 637 | 655 | (struct amd_sriov_msg_pf2vf_info_header *) |
| 638 | 656 | (adev->mman.fw_vram_usage_va + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10)); |
| @@ -663,16 +681,10 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) · 24 unmodified lines | ||
| 663 | 681 | (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10)); |
| 664 | 682 | |
| 665 | 683 | amdgpu_virt_read_pf2vf_data(adev); |
| 666 | − | |
| 667 | − return; | |
| 668 | − } | |
| 669 | − | |
| 670 | − if (adev->virt.vf2pf_update_interval_ms != 0) { | |
| 671 | − INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_item); | |
| 672 | − schedule_delayed_work(&(adev->virt.vf2pf_work), adev->virt.vf2pf_update_interval_ms); | |
| 673 | 684 | } |
| 674 | 685 | } |
| 675 | 686 | |
| 687 | + | |
| 676 | 688 | void amdgpu_detect_virtualization(struct amdgpu_device *adev) |
| 677 | 689 | { |
| 678 | 690 | uint32_t reg; |
| @@ -308,6 +308,7 @@ int amdgpu_virt_alloc_mm_table(struct amdgpu_device *adev); · 307 unmodified lines | ||
| 308 | 308 | void amdgpu_virt_free_mm_table(struct amdgpu_device *adev); |
| 309 | 309 | void amdgpu_virt_release_ras_err_handler_data(struct amdgpu_device *adev); |
| 310 | 310 | void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev); |
| 311 | +void amdgpu_virt_exchange_data(struct amdgpu_device *adev); | |
| 311 | 312 | void amdgpu_virt_fini_data_exchange(struct amdgpu_device *adev); |
| 312 | 313 | void amdgpu_detect_virtualization(struct amdgpu_device *adev); |
| 313 | 314 | |
| @@ -63,6 +63,13 @@ · 62 unmodified lines | ||
| 63 | 63 | #define mmGCEA_PROBE_MAP 0x070c |
| 64 | 64 | #define mmGCEA_PROBE_MAP_BASE_IDX 0 |
| 65 | 65 | |
| 66 | +#define GFX9_RLCG_GC_WRITE_OLD (0x8 << 28) | |
| 67 | +#define GFX9_RLCG_GC_WRITE (0x0 << 28) | |
| 68 | +#define GFX9_RLCG_GC_READ (0x1 << 28) | |
| 69 | +#define GFX9_RLCG_VFGATE_DISABLED 0x4000000 | |
| 70 | +#define GFX9_RLCG_WRONG_OPERATION_TYPE 0x2000000 | |
| 71 | +#define GFX9_RLCG_NOT_IN_RANGE 0x1000000 | |
| 72 | + | |
| 66 | 73 | MODULE_FIRMWARE("amdgpu/vega10_ce.bin"); |
| 67 | 74 | MODULE_FIRMWARE("amdgpu/vega10_pfp.bin"); |
| 68 | 75 | MODULE_FIRMWARE("amdgpu/vega10_me.bin"); |
| @@ -739,7 +746,7 @@ static const u32 GFX_RLC_SRM_INDEX_CNTL_DATA_OFFSETS[] = · 670 unmodified lines | ||
| 739 | 746 | mmRLC_SRM_INDEX_CNTL_DATA_7 - mmRLC_SRM_INDEX_CNTL_DATA_0, |
| 740 | 747 | }; |
| 741 | 748 | |
| 742 | −static void gfx_v9_0_rlcg_w(struct amdgpu_device *adev, u32 offset, u32 v, u32 flag) | |
| 749 | +static u32 gfx_v9_0_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32_t flag) | |
| 743 | 750 | { |
| 744 | 751 | static void *scratch_reg0; |
| 745 | 752 | static void *scratch_reg1; |
| @@ -748,21 +755,20 @@ static void gfx_v9_0_rlcg_w(struct amdgpu_device *adev, u32 offset, u32 v, u32 f · 2 unmodified lines | ||
| 748 | 755 | static void *spare_int; |
| 749 | 756 | static uint32_t grbm_cntl; |
| 750 | 757 | static uint32_t grbm_idx; |
| 758 | + uint32_t i = 0; | |
| 759 | + uint32_t retries = 50000; | |
| 760 | + u32 ret = 0; | |
| 761 | + u32 tmp; | |
| 751 | 762 | |
| 752 | 763 | scratch_reg0 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0)*4; |
| 753 | 764 | scratch_reg1 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG1)*4; |
| 754 | − scratch_reg2 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG2)*4; | |
| 755 | − scratch_reg3 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3)*4; | |
| 765 | + scratch_reg2 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG2_BASE_IDX] + mmSCRATCH_REG2)*4; | |
| 766 | + scratch_reg3 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG3_BASE_IDX] + mmSCRATCH_REG3)*4; | |
| 756 | 767 | spare_int = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT)*4; |
| 757 | 768 | |
| 758 | 769 | grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + mmGRBM_GFX_CNTL; |
| 759 | 770 | grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + mmGRBM_GFX_INDEX; |
| 760 | 771 | |
| 761 | − if (amdgpu_sriov_runtime(adev)) { | |
| 762 | − pr_err("shouldn't call rlcg write register during runtime\n"); | |
| 763 | − return; | |
| 764 | − } | |
| 765 | − | |
| 766 | 772 | if (offset == grbm_cntl || offset == grbm_idx) { |
| 767 | 773 | if (offset == grbm_cntl) |
| 768 | 774 | writel(v, scratch_reg2); |
| @@ -771,41 +777,95 @@ static void gfx_v9_0_rlcg_w(struct amdgpu_device *adev, u32 offset, u32 v, u32 f · 2 unmodified lines | ||
| 771 | 777 | |
| 772 | 778 | writel(v, ((void __iomem *)adev->rmmio) + (offset * 4)); |
| 773 | 779 | } else { |
| 774 | − uint32_t i = 0; | |
| 775 | − uint32_t retries = 50000; | |
| 776 | − | |
| 780 | + /* | |
| 781 | + * SCRATCH_REG0 = read/write value | |
| 782 | + * SCRATCH_REG1[30:28] = command | |
| 783 | + * SCRATCH_REG1[19:0] = address in dword | |
| 784 | + * SCRATCH_REG1[26:24] = Error reporting | |
| 785 | + */ | |
| 777 | 786 | writel(v, scratch_reg0); |
| 778 | − writel(offset | 0x80000000, scratch_reg1); | |
| 787 | + writel(offset | flag, scratch_reg1); | |
| 779 | 788 | writel(1, spare_int); |
| 780 | − for (i = 0; i < retries; i++) { | |
| 781 | − u32 tmp; | |
| 782 | 789 | |
| 790 | + for (i = 0; i < retries; i++) { | |
| 783 | 791 | tmp = readl(scratch_reg1); |
| 784 | − if (!(tmp & 0x80000000)) | |
| 792 | + if (!(tmp & flag)) | |
| 785 | 793 | break; |
| 786 | 794 | |
| 787 | 795 | udelay(10); |
| 788 | 796 | } |
| 789 | − if (i >= retries) | |
| 790 | − pr_err("timeout: rlcg program reg:0x%05x failed !\n", offset); | |
| 797 | + | |
| 798 | + if (i >= retries) { | |
| 799 | + if (amdgpu_sriov_reg_indirect_gc(adev)) { | |
| 800 | + if (tmp & GFX9_RLCG_VFGATE_DISABLED) | |
| 801 | + pr_err("The vfgate is disabled, program reg:0x%05x failed!\n", offset); | |
| 802 | + else if (tmp & GFX9_RLCG_WRONG_OPERATION_TYPE) | |
| 803 | + pr_err("Wrong operation type, program reg:0x%05x failed!\n", offset); | |
| 804 | + else if (tmp & GFX9_RLCG_NOT_IN_RANGE) | |
| 805 | + pr_err("The register is not in range, program reg:0x%05x failed!\n", offset); | |
| 806 | + else | |
| 807 | + pr_err("Unknown error type, program reg:0x%05x failed!\n", offset); | |
| 808 | + } else | |
| 809 | + pr_err("timeout: rlcg program reg:0x%05x failed!\n", offset); | |
| 810 | + } | |
| 791 | 811 | } |
| 792 | 812 | |
| 813 | + ret = readl(scratch_reg0); | |
| 814 | + | |
| 815 | + return ret; | |
| 816 | +} | |
| 817 | + | |
| 818 | +static bool gfx_v9_0_get_rlcg_flag(struct amdgpu_device *adev, u32 acc_flags, u32 hwip, | |
| 819 | + int write, u32 *rlcg_flag) | |
| 820 | +{ | |
| 821 | + | |
| 822 | + switch (hwip) { | |
| 823 | + case GC_HWIP: | |
| 824 | + if (amdgpu_sriov_reg_indirect_gc(adev)) { | |
| 825 | + *rlcg_flag = write ? GFX9_RLCG_GC_WRITE : GFX9_RLCG_GC_READ; | |
| 826 | + | |
| 827 | + return true; | |
| 828 | + /* only in new version, AMDGPU_REGS_NO_KIQ and AMDGPU_REGS_RLC enabled simultaneously */ | |
| 829 | + } else if ((acc_flags & AMDGPU_REGS_RLC) && !(acc_flags & AMDGPU_REGS_NO_KIQ) && write) { | |
| 830 | + *rlcg_flag = GFX9_RLCG_GC_WRITE_OLD; | |
| 831 | + return true; | |
| 832 | + } | |
| 833 | + | |
| 834 | + break; | |
| 835 | + default: | |
| 836 | + return false; | |
| 837 | + } | |
| 838 | + | |
| 839 | + return false; | |
| 840 | +} | |
| 841 | + | |
| 842 | +static u32 gfx_v9_0_sriov_rreg(struct amdgpu_device *adev, u32 offset, u32 acc_flags, u32 hwip) | |
| 843 | +{ | |
| 844 | + u32 rlcg_flag; | |
| 845 | + | |
| 846 | + if (!amdgpu_sriov_runtime(adev) && gfx_v9_0_get_rlcg_flag(adev, acc_flags, hwip, 0, &rlcg_flag)) | |
| 847 | + return gfx_v9_0_rlcg_rw(adev, offset, 0, rlcg_flag); | |
| 848 | + | |
| 849 | + if (acc_flags & AMDGPU_REGS_NO_KIQ) | |
| 850 | + return RREG32_NO_KIQ(offset); | |
| 851 | + else | |
| 852 | + return RREG32(offset); | |
| 793 | 853 | } |
| 794 | 854 | |
| 795 | 855 | static void gfx_v9_0_sriov_wreg(struct amdgpu_device *adev, u32 offset, |
| 796 | − u32 v, u32 acc_flags, u32 hwip) | |
| 856 | + u32 value, u32 acc_flags, u32 hwip) | |
| 797 | 857 | { |
| 798 | − if ((acc_flags & AMDGPU_REGS_RLC) && | |
| 799 | − amdgpu_sriov_fullaccess(adev)) { | |
| 800 | − gfx_v9_0_rlcg_w(adev, offset, v, acc_flags); | |
| 858 | + u32 rlcg_flag; | |
| 801 | 859 | |
| 860 | + if (!amdgpu_sriov_runtime(adev) && gfx_v9_0_get_rlcg_flag(adev, acc_flags, hwip, 1, &rlcg_flag)) { | |
| 861 | + gfx_v9_0_rlcg_rw(adev, offset, value, rlcg_flag); | |
| 802 | 862 | return; |
| 803 | 863 | } |
| 804 | 864 | |
| 805 | 865 | if (acc_flags & AMDGPU_REGS_NO_KIQ) |
| 806 | − WREG32_NO_KIQ(offset, v); | |
| 866 | + WREG32_NO_KIQ(offset, value); | |
| 807 | 867 | else |
| 808 | − WREG32(offset, v); | |
| 868 | + WREG32(offset, value); | |
| 809 | 869 | } |
| 810 | 870 | |
| 811 | 871 | #define VEGA10_GB_ADDR_CONFIG_GOLDEN 0x2a114042 |
| @@ -5135,7 +5195,7 @@ static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid) · 4323 unmodified lines | ||
| 5135 | 5195 | if (amdgpu_sriov_is_pp_one_vf(adev)) |
| 5136 | 5196 | data = RREG32_NO_KIQ(reg); |
| 5137 | 5197 | else |
| 5138 | − data = RREG32(reg); | |
| 5198 | + data = RREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL); | |
| 5139 | 5199 | |
| 5140 | 5200 | data &= ~RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK; |
| 5141 | 5201 | data |= (vmid & RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK) << RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT; |
| @@ -5191,6 +5251,7 @@ static const struct amdgpu_rlc_funcs gfx_v9_0_rlc_funcs = { · 49 unmodified lines | ||
| 5191 | 5251 | .start = gfx_v9_0_rlc_start, |
| 5192 | 5252 | .update_spm_vmid = gfx_v9_0_update_spm_vmid, |
| 5193 | 5253 | .sriov_wreg = gfx_v9_0_sriov_wreg, |
| 5254 | + .sriov_rreg = gfx_v9_0_sriov_rreg, | |
| 5194 | 5255 | .is_rlcg_access_range = gfx_v9_0_is_rlcg_access_range, |
| 5195 | 5256 | }; |
| 5196 | 5257 | |
| @@ -5796,16 +5857,16 @@ static void gfx_v9_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, · 599 unmodified lines | ||
| 5796 | 5857 | |
| 5797 | 5858 | switch (state) { |
| 5798 | 5859 | case AMDGPU_IRQ_STATE_DISABLE: |
| 5799 | − mec_int_cntl = RREG32(mec_int_cntl_reg); | |
| 5860 | + mec_int_cntl = RREG32_SOC15_IP(GC,mec_int_cntl_reg); | |
| 5800 | 5861 | mec_int_cntl = REG_SET_FIELD(mec_int_cntl, CP_ME1_PIPE0_INT_CNTL, |
| 5801 | 5862 | TIME_STAMP_INT_ENABLE, 0); |
| 5802 | − WREG32(mec_int_cntl_reg, mec_int_cntl); | |
| 5863 | + WREG32_SOC15_IP(GC, mec_int_cntl_reg, mec_int_cntl); | |
| 5803 | 5864 | break; |
| 5804 | 5865 | case AMDGPU_IRQ_STATE_ENABLE: |
| 5805 | − mec_int_cntl = RREG32(mec_int_cntl_reg); | |
| 5866 | + mec_int_cntl = RREG32_SOC15_IP(GC, mec_int_cntl_reg); | |
| 5806 | 5867 | mec_int_cntl = REG_SET_FIELD(mec_int_cntl, CP_ME1_PIPE0_INT_CNTL, |
| 5807 | 5868 | TIME_STAMP_INT_ENABLE, 1); |
| 5808 | − WREG32(mec_int_cntl_reg, mec_int_cntl); | |
| 5869 | + WREG32_SOC15_IP(GC, mec_int_cntl_reg, mec_int_cntl); | |
| 5809 | 5870 | break; |
| 5810 | 5871 | default: |
| 5811 | 5872 | break; |
| @@ -914,12 +914,6 @@ static int gmc_v10_0_sw_init(void *handle) · 913 unmodified lines | ||
| 914 | 914 | return r; |
| 915 | 915 | } |
| 916 | 916 | |
| 917 | − if (adev->gmc.xgmi.supported) { | |
| 918 | − r = adev->gfxhub.funcs->get_xgmi_info(adev); | |
| 919 | − if (r) | |
| 920 | − return r; | |
| 921 | − } | |
| 922 | − | |
| 923 | 917 | r = gmc_v10_0_mc_init(adev); |
| 924 | 918 | if (r) |
| 925 | 919 | return r; |
| @@ -515,10 +515,10 @@ static void gmc_v8_0_mc_program(struct amdgpu_device *adev) · 514 unmodified lines | ||
| 515 | 515 | static int gmc_v8_0_mc_init(struct amdgpu_device *adev) |
| 516 | 516 | { |
| 517 | 517 | int r; |
| 518 | + u32 tmp; | |
| 518 | 519 | |
| 519 | 520 | adev->gmc.vram_width = amdgpu_atombios_get_vram_width(adev); |
| 520 | 521 | if (!adev->gmc.vram_width) { |
| 521 | − u32 tmp; | |
| 522 | 522 | int chansize, numchan; |
| 523 | 523 | |
| 524 | 524 | /* Get VRAM informations */ |
| @@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) · 37 unmodified lines | ||
| 562 | 562 | adev->gmc.vram_width = numchan * chansize; |
| 563 | 563 | } |
| 564 | 564 | /* size in MB on si */ |
| 565 | − adev->gmc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; | |
| 566 | − adev->gmc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL; | |
| 565 | + tmp = RREG32(mmCONFIG_MEMSIZE); | |
| 566 | + /* some boards may have garbage in the upper 16 bits */ | |
| 567 | + if (tmp & 0xffff0000) { | |
| 568 | + DRM_INFO("Probable bad vram size: 0x%08x\n", tmp); | |
| 569 | + if (tmp & 0xffff) | |
| 570 | + tmp &= 0xffff; | |
| 571 | + } | |
| 572 | + adev->gmc.mc_vram_size = tmp * 1024ULL * 1024ULL; | |
| 573 | + adev->gmc.real_vram_size = adev->gmc.mc_vram_size; | |
| 567 | 574 | |
| 568 | 575 | if (!(adev->flags & AMD_IS_APU)) { |
| 569 | 576 | r = amdgpu_device_resize_fb_bar(adev); |
| @@ -478,9 +478,18 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev, · 477 unmodified lines | ||
| 478 | 478 | hub = &adev->vmhub[j]; |
| 479 | 479 | for (i = 0; i < 16; i++) { |
| 480 | 480 | reg = hub->vm_context0_cntl + i; |
| 481 | − tmp = RREG32(reg); | |
| 481 | + | |
| 482 | + if (j == AMDGPU_GFXHUB_0) | |
| 483 | + tmp = RREG32_SOC15_IP(GC, reg); | |
| 484 | + else | |
| 485 | + tmp = RREG32_SOC15_IP(MMHUB, reg); | |
| 486 | + | |
| 482 | 487 | tmp &= ~bits; |
| 483 | − WREG32(reg, tmp); | |
| 488 | + | |
| 489 | + if (j == AMDGPU_GFXHUB_0) | |
| 490 | + WREG32_SOC15_IP(GC, reg, tmp); | |
| 491 | + else | |
| 492 | + WREG32_SOC15_IP(MMHUB, reg, tmp); | |
| 484 | 493 | } |
| 485 | 494 | } |
| 486 | 495 | break; |
| @@ -489,9 +498,18 @@ static int gmc_v9_0_vm_fault_interrupt_state(struct amdgpu_device *adev, · 2 unmodified lines | ||
| 489 | 498 | hub = &adev->vmhub[j]; |
| 490 | 499 | for (i = 0; i < 16; i++) { |
| 491 | 500 | reg = hub->vm_context0_cntl + i; |
| 492 | − tmp = RREG32(reg); | |
| 501 | + | |
| 502 | + if (j == AMDGPU_GFXHUB_0) | |
| 503 | + tmp = RREG32_SOC15_IP(GC, reg); | |
| 504 | + else | |
| 505 | + tmp = RREG32_SOC15_IP(MMHUB, reg); | |
| 506 | + | |
| 493 | 507 | tmp |= bits; |
| 494 | − WREG32(reg, tmp); | |
| 508 | + | |
| 509 | + if (j == AMDGPU_GFXHUB_0) | |
| 510 | + WREG32_SOC15_IP(GC, reg, tmp); | |
| 511 | + else | |
| 512 | + WREG32_SOC15_IP(MMHUB, reg, tmp); | |
| 495 | 513 | } |
| 496 | 514 | } |
| 497 | 515 | break; |
| @@ -788,9 +806,12 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 290 unmodified lines | ||
| 788 | 806 | /* TODO: It needs to continue working on debugging with semaphore for GFXHUB as well. */ |
| 789 | 807 | if (use_semaphore) { |
| 790 | 808 | for (j = 0; j < adev->usec_timeout; j++) { |
| 791 | − /* a read return value of 1 means semaphore acuqire */ | |
| 792 | − tmp = RREG32_NO_KIQ(hub->vm_inv_eng0_sem + | |
| 793 | − hub->eng_distance * eng); | |
| 809 | + /* a read return value of 1 means semaphore acquire */ | |
| 810 | + if (vmhub == AMDGPU_GFXHUB_0) | |
| 811 | + tmp = RREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_sem + hub->eng_distance * eng); | |
| 812 | + else | |
| 813 | + tmp = RREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_sem + hub->eng_distance * eng); | |
| 814 | + | |
| 794 | 815 | if (tmp & 0x1) |
| 795 | 816 | break; |
| 796 | 817 | udelay(1); |
| @@ -801,8 +822,10 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 4 unmodified lines | ||
| 801 | 822 | } |
| 802 | 823 | |
| 803 | 824 | do { |
| 804 | − WREG32_NO_KIQ(hub->vm_inv_eng0_req + | |
| 805 | − hub->eng_distance * eng, inv_req); | |
| 825 | + if (vmhub == AMDGPU_GFXHUB_0) | |
| 826 | + WREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req); | |
| 827 | + else | |
| 828 | + WREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req); | |
| 806 | 829 | |
| 807 | 830 | /* |
| 808 | 831 | * Issue a dummy read to wait for the ACK register to |
| @@ -815,8 +838,11 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 6 unmodified lines | ||
| 815 | 838 | hub->eng_distance * eng); |
| 816 | 839 | |
| 817 | 840 | for (j = 0; j < adev->usec_timeout; j++) { |
| 818 | − tmp = RREG32_NO_KIQ(hub->vm_inv_eng0_ack + | |
| 819 | − hub->eng_distance * eng); | |
| 841 | + if (vmhub == AMDGPU_GFXHUB_0) | |
| 842 | + tmp = RREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_ack + hub->eng_distance * eng); | |
| 843 | + else | |
| 844 | + tmp = RREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_ack + hub->eng_distance * eng); | |
| 845 | + | |
| 820 | 846 | if (tmp & (1 << vmid)) |
| 821 | 847 | break; |
| 822 | 848 | udelay(1); |
| @@ -827,13 +853,16 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, · 4 unmodified lines | ||
| 827 | 853 | } while (inv_req); |
| 828 | 854 | |
| 829 | 855 | /* TODO: It needs to continue working on debugging with semaphore for GFXHUB as well. */ |
| 830 | − if (use_semaphore) | |
| 856 | + if (use_semaphore) { | |
| 831 | 857 | /* |
| 832 | 858 | * add semaphore release after invalidation, |
| 833 | 859 | * write with 0 means semaphore release |
| 834 | 860 | */ |
| 835 | − WREG32_NO_KIQ(hub->vm_inv_eng0_sem + | |
| 836 | − hub->eng_distance * eng, 0); | |
| 861 | + if (vmhub == AMDGPU_GFXHUB_0) | |
| 862 | + WREG32_SOC15_IP_NO_KIQ(GC, hub->vm_inv_eng0_sem + hub->eng_distance * eng, 0); | |
| 863 | + else | |
| 864 | + WREG32_SOC15_IP_NO_KIQ(MMHUB, hub->vm_inv_eng0_sem + hub->eng_distance * eng, 0); | |
| 865 | + } | |
| 837 | 866 | |
| 838 | 867 | spin_unlock(&adev->gmc.invalidate_lock); |
| 839 | 868 | |
| @@ -1599,12 +1628,6 @@ static int gmc_v9_0_sw_init(void *handle) · 759 unmodified lines | ||
| 1599 | 1628 | } |
| 1600 | 1629 | adev->need_swiotlb = drm_need_swiotlb(44); |
| 1601 | 1630 | |
| 1602 | − if (adev->gmc.xgmi.supported) { | |
| 1603 | − r = adev->gfxhub.funcs->get_xgmi_info(adev); | |
| 1604 | − if (r) | |
| 1605 | − return r; | |
| 1606 | − } | |
| 1607 | − | |
| 1608 | 1631 | r = gmc_v9_0_mc_init(adev); |
| 1609 | 1632 | if (r) |
| 1610 | 1633 | return r; |
| @@ -277,13 +277,15 @@ static bool psp_v11_0_is_sos_alive(struct psp_context *psp) · 276 unmodified lines | ||
| 277 | 277 | return sol_reg != 0x0; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | −static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) | |
| 280 | +static int psp_v11_0_bootloader_load_component(struct psp_context *psp, | |
| 281 | + struct psp_bin_desc *bin_desc, | |
| 282 | + enum psp_bootloader_cmd bl_cmd) | |
| 281 | 283 | { |
| 282 | 284 | int ret; |
| 283 | 285 | uint32_t psp_gfxdrv_command_reg = 0; |
| 284 | 286 | struct amdgpu_device *adev = psp->adev; |
| 285 | 287 | |
| 286 | − /* Check tOS sign of life register to confirm sys driver and sOS | |
| 288 | + /* Check sOS sign of life register to confirm sys driver and sOS | |
| 287 | 289 | * are already been loaded. |
| 288 | 290 | */ |
| 289 | 291 | if (psp_v11_0_is_sos_alive(psp)) |
| @@ -293,13 +295,13 @@ static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) · 3 unmodified lines | ||
| 293 | 295 | if (ret) |
| 294 | 296 | return ret; |
| 295 | 297 | |
| 296 | − /* Copy PSP KDB binary to memory */ | |
| 297 | − psp_copy_fw(psp, psp->kdb.start_addr, psp->kdb.size_bytes); | |
| 298 | + /* Copy PSP System Driver binary to memory */ | |
| 299 | + psp_copy_fw(psp, bin_desc->start_addr, bin_desc->size_bytes); | |
| 298 | 300 | |
| 299 | − /* Provide the PSP KDB to bootloader */ | |
| 301 | + /* Provide the sys driver to bootloader */ | |
| 300 | 302 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, |
| 301 | 303 | (uint32_t)(psp->fw_pri_mc_addr >> 20)); |
| 302 | − psp_gfxdrv_command_reg = PSP_BL__LOAD_KEY_DATABASE; | |
| 304 | + psp_gfxdrv_command_reg = bl_cmd; | |
| 303 | 305 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, |
| 304 | 306 | psp_gfxdrv_command_reg); |
| 305 | 307 | |
| @@ -308,69 +310,19 @@ static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) · 2 unmodified lines | ||
| 308 | 310 | return ret; |
| 309 | 311 | } |
| 310 | 312 | |
| 311 | −static int psp_v11_0_bootloader_load_spl(struct psp_context *psp) | |
| 313 | +static int psp_v11_0_bootloader_load_kdb(struct psp_context *psp) | |
| 312 | 314 | { |
| 313 | − int ret; | |
| 314 | − uint32_t psp_gfxdrv_command_reg = 0; | |
| 315 | − struct amdgpu_device *adev = psp->adev; | |
| 316 | − | |
| 317 | − /* Check tOS sign of life register to confirm sys driver and sOS | |
| 318 | − * are already been loaded. | |
| 319 | − */ | |
| 320 | − if (psp_v11_0_is_sos_alive(psp)) | |
| 321 | − return 0; | |
| 322 | − | |
| 323 | − ret = psp_v11_0_wait_for_bootloader(psp); | |
| 324 | − if (ret) | |
| 325 | − return ret; | |
| 326 | − | |
| 327 | − /* Copy PSP SPL binary to memory */ | |
| 328 | − psp_copy_fw(psp, psp->spl.start_addr, psp->spl.size_bytes); | |
| 329 | − | |
| 330 | − /* Provide the PSP SPL to bootloader */ | |
| 331 | − WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, | |
| 332 | − (uint32_t)(psp->fw_pri_mc_addr >> 20)); | |
| 333 | − psp_gfxdrv_command_reg = PSP_BL__LOAD_TOS_SPL_TABLE; | |
| 334 | − WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, | |
| 335 | − psp_gfxdrv_command_reg); | |
| 336 | − | |
| 337 | − ret = psp_v11_0_wait_for_bootloader(psp); | |
| 315 | + return psp_v11_0_bootloader_load_component(psp, &psp->kdb, PSP_BL__LOAD_KEY_DATABASE); | |
| 316 | +} | |
| 338 | 317 | |
| 339 | − return ret; | |
| 318 | +static int psp_v11_0_bootloader_load_spl(struct psp_context *psp) | |
| 319 | +{ | |
| 320 | + return psp_v11_0_bootloader_load_component(psp, &psp->spl, PSP_BL__LOAD_TOS_SPL_TABLE); | |
| 340 | 321 | } |
| 341 | 322 | |
| 342 | 323 | static int psp_v11_0_bootloader_load_sysdrv(struct psp_context *psp) |
| 343 | 324 | { |
| 344 | − int ret; | |
| 345 | − uint32_t psp_gfxdrv_command_reg = 0; | |
| 346 | − struct amdgpu_device *adev = psp->adev; | |
| 347 | − | |
| 348 | − /* Check sOS sign of life register to confirm sys driver and sOS | |
| 349 | − * are already been loaded. | |
| 350 | − */ | |
| 351 | − if (psp_v11_0_is_sos_alive(psp)) | |
| 352 | − return 0; | |
| 353 | − | |
| 354 | − ret = psp_v11_0_wait_for_bootloader(psp); | |
| 355 | − if (ret) | |
| 356 | − return ret; | |
| 357 | − | |
| 358 | − /* Copy PSP System Driver binary to memory */ | |
| 359 | − psp_copy_fw(psp, psp->sys.start_addr, psp->sys.size_bytes); | |
| 360 | − | |
| 361 | − /* Provide the sys driver to bootloader */ | |
| 362 | − WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, | |
| 363 | − (uint32_t)(psp->fw_pri_mc_addr >> 20)); | |
| 364 | − psp_gfxdrv_command_reg = PSP_BL__LOAD_SYSDRV; | |
| 365 | − WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, | |
| 366 | − psp_gfxdrv_command_reg); | |
| 367 | − | |
| 368 | − /* there might be handshake issue with hardware which needs delay */ | |
| 369 | − mdelay(20); | |
| 370 | − | |
| 371 | − ret = psp_v11_0_wait_for_bootloader(psp); | |
| 372 | − | |
| 373 | − return ret; | |
| 325 | + return psp_v11_0_bootloader_load_component(psp, &psp->sys, PSP_BL__LOAD_SYSDRV); | |
| 374 | 326 | } |
| 375 | 327 | |
| 376 | 328 | static int psp_v11_0_bootloader_load_sos(struct psp_context *psp) |
| @@ -542,9 +542,6 @@ static void sdma_v5_2_ctx_switch_enable(struct amdgpu_device *adev, bool enable) · 541 unmodified lines | ||
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | for (i = 0; i < adev->sdma.num_instances; i++) { |
| 545 | − f32_cntl = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL)); | |
| 546 | − f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, | |
| 547 | − AUTO_CTXSW_ENABLE, enable ? 1 : 0); | |
| 548 | 545 | if (enable && amdgpu_sdma_phase_quantum) { |
| 549 | 546 | WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_PHASE0_QUANTUM), |
| 550 | 547 | phase_quantum); |
| @@ -553,7 +550,13 @@ static void sdma_v5_2_ctx_switch_enable(struct amdgpu_device *adev, bool enable) · 2 unmodified lines | ||
| 553 | 550 | WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_PHASE2_QUANTUM), |
| 554 | 551 | phase_quantum); |
| 555 | 552 | } |
| 556 | − WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL), f32_cntl); | |
| 553 | + | |
| 554 | + if (!amdgpu_sriov_vf(adev)) { | |
| 555 | + f32_cntl = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL)); | |
| 556 | + f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL, | |
| 557 | + AUTO_CTXSW_ENABLE, enable ? 1 : 0); | |
| 558 | + WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL), f32_cntl); | |
| 559 | + } | |
| 557 | 560 | } |
| 558 | 561 | |
| 559 | 562 | } |
| @@ -576,10 +579,12 @@ static void sdma_v5_2_enable(struct amdgpu_device *adev, bool enable) · 16 unmodified lines | ||
| 576 | 579 | sdma_v5_2_rlc_stop(adev); |
| 577 | 580 | } |
| 578 | 581 | |
| 579 | − for (i = 0; i < adev->sdma.num_instances; i++) { | |
| 580 | − f32_cntl = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_F32_CNTL)); | |
| 581 | − f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_F32_CNTL, HALT, enable ? 0 : 1); | |
| 582 | − WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_F32_CNTL), f32_cntl); | |
| 582 | + if (!amdgpu_sriov_vf(adev)) { | |
| 583 | + for (i = 0; i < adev->sdma.num_instances; i++) { | |
| 584 | + f32_cntl = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_F32_CNTL)); | |
| 585 | + f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_F32_CNTL, HALT, enable ? 0 : 1); | |
| 586 | + WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_F32_CNTL), f32_cntl); | |
| 587 | + } | |
| 583 | 588 | } |
| 584 | 589 | } |
| 585 | 590 | |
| @@ -608,7 +613,8 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev) · 22 unmodified lines | ||
| 608 | 613 | ring = &adev->sdma.instance[i].ring; |
| 609 | 614 | wb_offset = (ring->rptr_offs * 4); |
| 610 | 615 | |
| 611 | − WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_SEM_WAIT_FAIL_TIMER_CNTL), 0); | |
| 616 | + if (!amdgpu_sriov_vf(adev)) | |
| 617 | + WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_SEM_WAIT_FAIL_TIMER_CNTL), 0); | |
| 612 | 618 | |
| 613 | 619 | /* Set ring buffer size in dwords */ |
| 614 | 620 | rb_bufsz = order_base_2(ring->ring_size / 4); |
| @@ -683,32 +689,34 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev) · 68 unmodified lines | ||
| 683 | 689 | sdma_v5_2_ring_set_wptr(ring); |
| 684 | 690 | |
| 685 | 691 | /* set minor_ptr_update to 0 after wptr programed */ |
| 686 | − WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_MINOR_PTR_UPDATE), 0); | |
| 687 | 692 | |
| 688 | − /* set utc l1 enable flag always to 1 */ | |
| 689 | − temp = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL)); | |
| 690 | − temp = REG_SET_FIELD(temp, SDMA0_CNTL, UTC_L1_ENABLE, 1); | |
| 691 | − | |
| 692 | − /* enable MCBP */ | |
| 693 | − temp = REG_SET_FIELD(temp, SDMA0_CNTL, MIDCMD_PREEMPT_ENABLE, 1); | |
| 694 | − WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL), temp); | |
| 695 | − | |
| 696 | − /* Set up RESP_MODE to non-copy addresses */ | |
| 697 | − temp = RREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_CNTL)); | |
| 698 | − temp = REG_SET_FIELD(temp, SDMA0_UTCL1_CNTL, RESP_MODE, 3); | |
| 699 | − temp = REG_SET_FIELD(temp, SDMA0_UTCL1_CNTL, REDO_DELAY, 9); | |
| 700 | − WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_CNTL), temp); | |
| 701 | − | |
| 702 | − /* program default cache read and write policy */ | |
| 703 | − temp = RREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_PAGE)); | |
| 704 | − /* clean read policy and write policy bits */ | |
| 705 | − temp &= 0xFF0FFF; | |
| 706 | − temp |= ((CACHE_READ_POLICY_L2__DEFAULT << 12) | | |
| 707 | − (CACHE_WRITE_POLICY_L2__DEFAULT << 14) | | |
| 708 | − SDMA0_UTCL1_PAGE__LLC_NOALLOC_MASK); | |
| 709 | − WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_PAGE), temp); | |
| 693 | + WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_GFX_MINOR_PTR_UPDATE), 0); | |
| 710 | 694 | |
| 695 | + /* SRIOV VF has no control of any of registers below */ | |
| 711 | 696 | if (!amdgpu_sriov_vf(adev)) { |
| 697 | + /* set utc l1 enable flag always to 1 */ | |
| 698 | + temp = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL)); | |
| 699 | + temp = REG_SET_FIELD(temp, SDMA0_CNTL, UTC_L1_ENABLE, 1); | |
| 700 | + | |
| 701 | + /* enable MCBP */ | |
| 702 | + temp = REG_SET_FIELD(temp, SDMA0_CNTL, MIDCMD_PREEMPT_ENABLE, 1); | |
| 703 | + WREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_CNTL), temp); | |
| 704 | + | |
| 705 | + /* Set up RESP_MODE to non-copy addresses */ | |
| 706 | + temp = RREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_CNTL)); | |
| 707 | + temp = REG_SET_FIELD(temp, SDMA0_UTCL1_CNTL, RESP_MODE, 3); | |
| 708 | + temp = REG_SET_FIELD(temp, SDMA0_UTCL1_CNTL, REDO_DELAY, 9); | |
| 709 | + WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_CNTL), temp); | |
| 710 | + | |
| 711 | + /* program default cache read and write policy */ | |
| 712 | + temp = RREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_PAGE)); | |
| 713 | + /* clean read policy and write policy bits */ | |
| 714 | + temp &= 0xFF0FFF; | |
| 715 | + temp |= ((CACHE_READ_POLICY_L2__DEFAULT << 12) | | |
| 716 | + (CACHE_WRITE_POLICY_L2__DEFAULT << 14) | | |
| 717 | + SDMA0_UTCL1_PAGE__LLC_NOALLOC_MASK); | |
| 718 | + WREG32_SOC15_IP(GC, sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_UTCL1_PAGE), temp); | |
| 719 | + | |
| 712 | 720 | /* unhalt engine */ |
| 713 | 721 | temp = RREG32(sdma_v5_2_get_reg_offset(adev, i, mmSDMA0_F32_CNTL)); |
| 714 | 722 | temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); |
| @@ -1436,13 +1444,14 @@ static int sdma_v5_2_set_trap_irq_state(struct amdgpu_device *adev, · 721 unmodified lines | ||
| 1436 | 1444 | enum amdgpu_interrupt_state state) |
| 1437 | 1445 | { |
| 1438 | 1446 | u32 sdma_cntl; |
| 1439 | − | |
| 1440 | 1447 | u32 reg_offset = sdma_v5_2_get_reg_offset(adev, type, mmSDMA0_CNTL); |
| 1441 | 1448 | |
| 1442 | − sdma_cntl = RREG32(reg_offset); | |
| 1443 | − sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA0_CNTL, TRAP_ENABLE, | |
| 1444 | − state == AMDGPU_IRQ_STATE_ENABLE ? 1 : 0); | |
| 1445 | − WREG32(reg_offset, sdma_cntl); | |
| 1449 | + if (!amdgpu_sriov_vf(adev)) { | |
| 1450 | + sdma_cntl = RREG32(reg_offset); | |
| 1451 | + sdma_cntl = REG_SET_FIELD(sdma_cntl, SDMA0_CNTL, TRAP_ENABLE, | |
| 1452 | + state == AMDGPU_IRQ_STATE_ENABLE ? 1 : 0); | |
| 1453 | + WREG32(reg_offset, sdma_cntl); | |
| 1454 | + } | |
| 1446 | 1455 | |
| 1447 | 1456 | return 0; |
| 1448 | 1457 | } |
| @@ -51,6 +51,8 @@ · 50 unmodified lines | ||
| 51 | 51 | |
| 52 | 52 | #define RREG32_SOC15_IP(ip, reg) __RREG32_SOC15_RLC__(reg, 0, ip##_HWIP) |
| 53 | 53 | |
| 54 | +#define RREG32_SOC15_IP_NO_KIQ(ip, reg) __RREG32_SOC15_RLC__(reg, AMDGPU_REGS_NO_KIQ, ip##_HWIP) | |
| 55 | + | |
| 54 | 56 | #define RREG32_SOC15_NO_KIQ(ip, inst, reg) \ |
| 55 | 57 | __RREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \ |
| 56 | 58 | AMDGPU_REGS_NO_KIQ, ip##_HWIP) |
| @@ -65,6 +67,9 @@ · 8 unmodified lines | ||
| 65 | 67 | #define WREG32_SOC15_IP(ip, reg, value) \ |
| 66 | 68 | __WREG32_SOC15_RLC__(reg, value, 0, ip##_HWIP) |
| 67 | 69 | |
| 70 | +#define WREG32_SOC15_IP_NO_KIQ(ip, reg, value) \ | |
| 71 | + __WREG32_SOC15_RLC__(reg, value, AMDGPU_REGS_NO_KIQ, ip##_HWIP) | |
| 72 | + | |
| 68 | 73 | #define WREG32_SOC15_NO_KIQ(ip, inst, reg, value) \ |
| 69 | 74 | __WREG32_SOC15_RLC__(adev->reg_offset[ip##_HWIP][inst][reg##_BASE_IDX] + reg, \ |
| 70 | 75 | value, AMDGPU_REGS_NO_KIQ, ip##_HWIP) |
| @@ -246,6 +246,13 @@ static int vcn_v1_0_suspend(void *handle) · 245 unmodified lines | ||
| 246 | 246 | { |
| 247 | 247 | int r; |
| 248 | 248 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
| 249 | + bool idle_work_unexecuted; | |
| 250 | + | |
| 251 | + idle_work_unexecuted = cancel_delayed_work_sync(&adev->vcn.idle_work); | |
| 252 | + if (idle_work_unexecuted) { | |
| 253 | + if (adev->pm.dpm_enabled) | |
| 254 | + amdgpu_dpm_enable_uvd(adev, false); | |
| 255 | + } | |
| 249 | 256 | |
| 250 | 257 | r = vcn_v1_0_hw_fini(adev); |
| 251 | 258 | if (r) |
| @@ -59,11 +59,78 @@ static void kfd_gtt_sa_fini(struct kfd_dev *kfd); · 58 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | static int kfd_resume(struct kfd_dev *kfd); |
| 61 | 61 | |
| 62 | +static void kfd_device_info_set_sdma_queue_num(struct kfd_dev *kfd) | |
| 63 | +{ | |
| 64 | + uint32_t sdma_version = kfd->adev->ip_versions[SDMA0_HWIP][0]; | |
| 65 | + | |
| 66 | + switch (sdma_version) { | |
| 67 | + case IP_VERSION(4, 0, 0):/* VEGA10 */ | |
| 68 | + case IP_VERSION(4, 0, 1):/* VEGA12 */ | |
| 69 | + case IP_VERSION(4, 1, 0):/* RAVEN */ | |
| 70 | + case IP_VERSION(4, 1, 1):/* RAVEN */ | |
| 71 | + case IP_VERSION(4, 1, 2):/* RENIOR */ | |
| 72 | + case IP_VERSION(5, 2, 1):/* VANGOGH */ | |
| 73 | + case IP_VERSION(5, 2, 3):/* YELLOW_CARP */ | |
| 74 | + kfd->device_info.num_sdma_queues_per_engine = 2; | |
| 75 | + break; | |
| 76 | + case IP_VERSION(4, 2, 0):/* VEGA20 */ | |
| 77 | + case IP_VERSION(4, 2, 2):/* ARCTUTUS */ | |
| 78 | + case IP_VERSION(4, 4, 0):/* ALDEBARAN */ | |
| 79 | + case IP_VERSION(5, 0, 0):/* NAVI10 */ | |
| 80 | + case IP_VERSION(5, 0, 1):/* CYAN_SKILLFISH */ | |
| 81 | + case IP_VERSION(5, 0, 2):/* NAVI14 */ | |
| 82 | + case IP_VERSION(5, 0, 5):/* NAVI12 */ | |
| 83 | + case IP_VERSION(5, 2, 0):/* SIENNA_CICHLID */ | |
| 84 | + case IP_VERSION(5, 2, 2):/* NAVY_FLOUDER */ | |
| 85 | + case IP_VERSION(5, 2, 4):/* DIMGREY_CAVEFISH */ | |
| 86 | + case IP_VERSION(5, 2, 5):/* BEIGE_GOBY */ | |
| 87 | + kfd->device_info.num_sdma_queues_per_engine = 8; | |
| 88 | + break; | |
| 89 | + default: | |
| 90 | + dev_warn(kfd_device, | |
| 91 | + "Default sdma queue per engine(8) is set due to " | |
| 92 | + "mismatch of sdma ip block(SDMA_HWIP:0x%x).\n", | |
| 93 | + sdma_version); | |
| 94 | + kfd->device_info.num_sdma_queues_per_engine = 8; | |
| 95 | + } | |
| 96 | +} | |
| 97 | + | |
| 98 | +static void kfd_device_info_set_event_interrupt_class(struct kfd_dev *kfd) | |
| 99 | +{ | |
| 100 | + uint32_t gc_version = KFD_GC_VERSION(kfd); | |
| 101 | + | |
| 102 | + switch (gc_version) { | |
| 103 | + case IP_VERSION(9, 0, 1): /* VEGA10 */ | |
| 104 | + case IP_VERSION(9, 1, 0): /* RAVEN */ | |
| 105 | + case IP_VERSION(9, 2, 1): /* VEGA12 */ | |
| 106 | + case IP_VERSION(9, 2, 2): /* RAVEN */ | |
| 107 | + case IP_VERSION(9, 3, 0): /* RENOIR */ | |
| 108 | + case IP_VERSION(9, 4, 0): /* VEGA20 */ | |
| 109 | + case IP_VERSION(9, 4, 1): /* ARCTURUS */ | |
| 110 | + case IP_VERSION(9, 4, 2): /* ALDEBARAN */ | |
| 111 | + case IP_VERSION(10, 3, 1): /* VANGOGH */ | |
| 112 | + case IP_VERSION(10, 3, 3): /* YELLOW_CARP */ | |
| 113 | + case IP_VERSION(10, 1, 3): /* CYAN_SKILLFISH */ | |
| 114 | + case IP_VERSION(10, 1, 10): /* NAVI10 */ | |
| 115 | + case IP_VERSION(10, 1, 2): /* NAVI12 */ | |
| 116 | + case IP_VERSION(10, 1, 1): /* NAVI14 */ | |
| 117 | + case IP_VERSION(10, 3, 0): /* SIENNA_CICHLID */ | |
| 118 | + case IP_VERSION(10, 3, 2): /* NAVY_FLOUNDER */ | |
| 119 | + case IP_VERSION(10, 3, 4): /* DIMGREY_CAVEFISH */ | |
| 120 | + case IP_VERSION(10, 3, 5): /* BEIGE_GOBY */ | |
| 121 | + kfd->device_info.event_interrupt_class = &event_interrupt_class_v9; | |
| 122 | + break; | |
| 123 | + default: | |
| 124 | + dev_warn(kfd_device, "v9 event interrupt handler is set due to " | |
| 125 | + "mismatch of gc ip block(GC_HWIP:0x%x).\n", gc_version); | |
| 126 | + kfd->device_info.event_interrupt_class = &event_interrupt_class_v9; | |
| 127 | + } | |
| 128 | +} | |
| 129 | + | |
| 62 | 130 | static void kfd_device_info_init(struct kfd_dev *kfd, |
| 63 | 131 | bool vf, uint32_t gfx_target_version) |
| 64 | 132 | { |
| 65 | 133 | uint32_t gc_version = KFD_GC_VERSION(kfd); |
| 66 | − uint32_t sdma_version = kfd->adev->ip_versions[SDMA0_HWIP][0]; | |
| 67 | 134 | uint32_t asic_type = kfd->adev->asic_type; |
| 68 | 135 | |
| 69 | 136 | kfd->device_info.max_pasid_bits = 16; |
| @@ -75,16 +142,11 @@ static void kfd_device_info_init(struct kfd_dev *kfd, · 5 unmodified lines | ||
| 75 | 142 | if (KFD_IS_SOC15(kfd)) { |
| 76 | 143 | kfd->device_info.doorbell_size = 8; |
| 77 | 144 | kfd->device_info.ih_ring_entry_size = 8 * sizeof(uint32_t); |
| 78 | − kfd->device_info.event_interrupt_class = &event_interrupt_class_v9; | |
| 79 | 145 | kfd->device_info.supports_cwsr = true; |
| 80 | 146 | |
| 81 | − if ((sdma_version >= IP_VERSION(4, 0, 0) && | |
| 82 | − sdma_version <= IP_VERSION(4, 2, 0)) || | |
| 83 | − sdma_version == IP_VERSION(5, 2, 1) || | |
| 84 | − sdma_version == IP_VERSION(5, 2, 3)) | |
| 85 | − kfd->device_info.num_sdma_queues_per_engine = 2; | |
| 86 | − else | |
| 87 | − kfd->device_info.num_sdma_queues_per_engine = 8; | |
| 147 | + kfd_device_info_set_sdma_queue_num(kfd); | |
| 148 | + | |
| 149 | + kfd_device_info_set_event_interrupt_class(kfd); | |
| 88 | 150 | |
| 89 | 151 | /* Raven */ |
| 90 | 152 | if (gc_version == IP_VERSION(9, 1, 0) || |
| @@ -47,7 +47,7 @@ static int execute_queues_cpsch(struct device_queue_manager *dqm, · 46 unmodified lines | ||
| 47 | 47 | uint32_t filter_param); |
| 48 | 48 | static int unmap_queues_cpsch(struct device_queue_manager *dqm, |
| 49 | 49 | enum kfd_unmap_queues_filter filter, |
| 50 | − uint32_t filter_param); | |
| 50 | + uint32_t filter_param, bool reset); | |
| 51 | 51 | |
| 52 | 52 | static int map_queues_cpsch(struct device_queue_manager *dqm); |
| 53 | 53 | |
| @@ -570,7 +570,7 @@ static int update_queue(struct device_queue_manager *dqm, struct queue *q, · 516 unmodified lines | ||
| 570 | 570 | /* Make sure the queue is unmapped before updating the MQD */ |
| 571 | 571 | if (dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) { |
| 572 | 572 | retval = unmap_queues_cpsch(dqm, |
| 573 | − KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0); | |
| 573 | + KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, false); | |
| 574 | 574 | if (retval) { |
| 575 | 575 | pr_err("unmap queue failed\n"); |
| 576 | 576 | goto out_unlock; |
| @@ -1223,7 +1223,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) · 646 unmodified lines | ||
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | 1225 | if (!dqm->is_hws_hang) |
| 1226 | − unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0); | |
| 1226 | + unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_ALL_QUEUES, 0, false); | |
| 1227 | 1227 | hanging = dqm->is_hws_hang || dqm->is_resetting; |
| 1228 | 1228 | dqm->sched_running = false; |
| 1229 | 1229 | |
| @@ -1419,7 +1419,7 @@ static int map_queues_cpsch(struct device_queue_manager *dqm) · 189 unmodified lines | ||
| 1419 | 1419 | /* dqm->lock mutex has to be locked before calling this function */ |
| 1420 | 1420 | static int unmap_queues_cpsch(struct device_queue_manager *dqm, |
| 1421 | 1421 | enum kfd_unmap_queues_filter filter, |
| 1422 | − uint32_t filter_param) | |
| 1422 | + uint32_t filter_param, bool reset) | |
| 1423 | 1423 | { |
| 1424 | 1424 | int retval = 0; |
| 1425 | 1425 | struct mqd_manager *mqd_mgr; |
| @@ -1432,7 +1432,7 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 6 unmodified lines | ||
| 1432 | 1432 | return retval; |
| 1433 | 1433 | |
| 1434 | 1434 | retval = pm_send_unmap_queue(&dqm->packet_mgr, KFD_QUEUE_TYPE_COMPUTE, |
| 1435 | − filter, filter_param, false, 0); | |
| 1435 | + filter, filter_param, reset, 0); | |
| 1436 | 1436 | if (retval) |
| 1437 | 1437 | return retval; |
| 1438 | 1438 | |
| @@ -1476,6 +1476,21 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, · 37 unmodified lines | ||
| 1476 | 1476 | return retval; |
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | +/* only for compute queue */ | |
| 1480 | +static int reset_queues_cpsch(struct device_queue_manager *dqm, | |
| 1481 | + uint16_t pasid) | |
| 1482 | +{ | |
| 1483 | + int retval; | |
| 1484 | + | |
| 1485 | + dqm_lock(dqm); | |
| 1486 | + | |
| 1487 | + retval = unmap_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_BY_PASID, | |
| 1488 | + pasid, true); | |
| 1489 | + | |
| 1490 | + dqm_unlock(dqm); | |
| 1491 | + return retval; | |
| 1492 | +} | |
| 1493 | + | |
| 1479 | 1494 | /* dqm->lock mutex has to be locked before calling this function */ |
| 1480 | 1495 | static int execute_queues_cpsch(struct device_queue_manager *dqm, |
| 1481 | 1496 | enum kfd_unmap_queues_filter filter, |
| @@ -1485,7 +1500,7 @@ static int execute_queues_cpsch(struct device_queue_manager *dqm, · 3 unmodified lines | ||
| 1485 | 1500 | |
| 1486 | 1501 | if (dqm->is_hws_hang) |
| 1487 | 1502 | return -EIO; |
| 1488 | − retval = unmap_queues_cpsch(dqm, filter, filter_param); | |
| 1503 | + retval = unmap_queues_cpsch(dqm, filter, filter_param, false); | |
| 1489 | 1504 | if (retval) |
| 1490 | 1505 | return retval; |
| 1491 | 1506 | |
| @@ -1896,6 +1911,7 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev) · 404 unmodified lines | ||
| 1896 | 1911 | dqm->ops.evict_process_queues = evict_process_queues_cpsch; |
| 1897 | 1912 | dqm->ops.restore_process_queues = restore_process_queues_cpsch; |
| 1898 | 1913 | dqm->ops.get_wave_state = get_wave_state; |
| 1914 | + dqm->ops.reset_queues = reset_queues_cpsch; | |
| 1899 | 1915 | break; |
| 1900 | 1916 | case KFD_SCHED_POLICY_NO_HWS: |
| 1901 | 1917 | /* initialize dqm for no cp scheduling */ |
| @@ -81,6 +81,8 @@ struct device_process_node { · 80 unmodified lines | ||
| 81 | 81 | * |
| 82 | 82 | * @get_wave_state: Retrieves context save state and optionally copies the |
| 83 | 83 | * control stack, if kept in the MQD, to the given userspace address. |
| 84 | + * | |
| 85 | + * @reset_queues: reset queues which consume RAS poison | |
| 84 | 86 | */ |
| 85 | 87 | |
| 86 | 88 | struct device_queue_manager_ops { |
| @@ -134,6 +136,9 @@ struct device_queue_manager_ops { · 47 unmodified lines | ||
| 134 | 136 | void __user *ctl_stack, |
| 135 | 137 | u32 *ctl_stack_used_size, |
| 136 | 138 | u32 *save_area_used_size); |
| 139 | + | |
| 140 | + int (*reset_queues)(struct device_queue_manager *dqm, | |
| 141 | + uint16_t pasid); | |
| 137 | 142 | }; |
| 138 | 143 | |
| 139 | 144 | struct device_queue_manager_asic_ops { |
| @@ -89,6 +89,44 @@ enum SQ_INTERRUPT_ERROR_TYPE { · 88 unmodified lines | ||
| 89 | 89 | #define KFD_SQ_INT_DATA__ERR_TYPE_MASK 0xF00000 |
| 90 | 90 | #define KFD_SQ_INT_DATA__ERR_TYPE__SHIFT 20 |
| 91 | 91 | |
| 92 | +static void event_interrupt_poison_consumption(struct kfd_dev *dev, | |
| 93 | + uint16_t pasid, uint16_t source_id) | |
| 94 | +{ | |
| 95 | + int ret = -EINVAL; | |
| 96 | + struct kfd_process *p = kfd_lookup_process_by_pasid(pasid); | |
| 97 | + | |
| 98 | + if (!p) | |
| 99 | + return; | |
| 100 | + | |
| 101 | + /* all queues of a process will be unmapped in one time */ | |
| 102 | + if (atomic_read(&p->poison)) { | |
| 103 | + kfd_unref_process(p); | |
| 104 | + return; | |
| 105 | + } | |
| 106 | + | |
| 107 | + atomic_set(&p->poison, 1); | |
| 108 | + kfd_unref_process(p); | |
| 109 | + | |
| 110 | + switch (source_id) { | |
| 111 | + case SOC15_INTSRC_SQ_INTERRUPT_MSG: | |
| 112 | + if (dev->dqm->ops.reset_queues) | |
| 113 | + ret = dev->dqm->ops.reset_queues(dev->dqm, pasid); | |
| 114 | + break; | |
| 115 | + case SOC15_INTSRC_SDMA_ECC: | |
| 116 | + default: | |
| 117 | + break; | |
| 118 | + } | |
| 119 | + | |
| 120 | + kfd_signal_poison_consumed_event(dev, pasid); | |
| 121 | + | |
| 122 | + /* resetting queue passes, do page retirement without gpu reset | |
| 123 | + resetting queue fails, fallback to gpu reset solution */ | |
| 124 | + if (!ret) | |
| 125 | + amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev, false); | |
| 126 | + else | |
| 127 | + amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev, true); | |
| 128 | +} | |
| 129 | + | |
| 92 | 130 | static bool event_interrupt_isr_v9(struct kfd_dev *dev, |
| 93 | 131 | const uint32_t *ih_ring_entry, |
| 94 | 132 | uint32_t *patched_ihre, |
| @@ -230,8 +268,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev, · 135 unmodified lines | ||
| 230 | 268 | sq_intr_err); |
| 231 | 269 | if (sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_ILLEGAL_INST && |
| 232 | 270 | sq_intr_err != SQ_INTERRUPT_ERROR_TYPE_MEMVIOL) { |
| 233 | − kfd_signal_poison_consumed_event(dev, pasid); | |
| 234 | − amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev); | |
| 271 | + event_interrupt_poison_consumption(dev, pasid, source_id); | |
| 235 | 272 | return; |
| 236 | 273 | } |
| 237 | 274 | break; |
| @@ -252,8 +289,7 @@ static void event_interrupt_wq_v9(struct kfd_dev *dev, · 14 unmodified lines | ||
| 252 | 289 | if (source_id == SOC15_INTSRC_SDMA_TRAP) { |
| 253 | 290 | kfd_signal_event_interrupt(pasid, context_id0 & 0xfffffff, 28); |
| 254 | 291 | } else if (source_id == SOC15_INTSRC_SDMA_ECC) { |
| 255 | − kfd_signal_poison_consumed_event(dev, pasid); | |
| 256 | − amdgpu_amdkfd_ras_poison_consumption_handler(dev->adev); | |
| 292 | + event_interrupt_poison_consumption(dev, pasid, source_id); | |
| 257 | 293 | return; |
| 258 | 294 | } |
| 259 | 295 | } else if (client_id == SOC15_IH_CLIENTID_VMC || |
| @@ -549,7 +549,7 @@ static void svm_migrate_page_free(struct page *page) · 548 unmodified lines | ||
| 549 | 549 | |
| 550 | 550 | if (svm_bo) { |
| 551 | 551 | pr_debug_ratelimited("ref: %d\n", kref_read(&svm_bo->kref)); |
| 552 | − svm_range_bo_unref(svm_bo); | |
| 552 | + svm_range_bo_unref_async(svm_bo); | |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | |
| @@ -856,6 +856,8 @@ struct kfd_process { · 855 unmodified lines | ||
| 856 | 856 | struct svm_range_list svms; |
| 857 | 857 | |
| 858 | 858 | bool xnack_enabled; |
| 859 | + | |
| 860 | + atomic_t poison; | |
| 859 | 861 | }; |
| 860 | 862 | |
| 861 | 863 | #define KFD_PROCESS_TABLE_SIZE 5 /* bits: 32 entries */ |
| @@ -332,6 +332,8 @@ static void svm_range_bo_release(struct kref *kref) · 331 unmodified lines | ||
| 332 | 332 | struct svm_range_bo *svm_bo; |
| 333 | 333 | |
| 334 | 334 | svm_bo = container_of(kref, struct svm_range_bo, kref); |
| 335 | + pr_debug("svm_bo 0x%p\n", svm_bo); | |
| 336 | + | |
| 335 | 337 | spin_lock(&svm_bo->list_lock); |
| 336 | 338 | while (!list_empty(&svm_bo->range_list)) { |
| 337 | 339 | struct svm_range *prange = |
| @@ -365,12 +367,33 @@ static void svm_range_bo_release(struct kref *kref) · 27 unmodified lines | ||
| 365 | 367 | kfree(svm_bo); |
| 366 | 368 | } |
| 367 | 369 | |
| 368 | −void svm_range_bo_unref(struct svm_range_bo *svm_bo) | |
| 370 | +static void svm_range_bo_wq_release(struct work_struct *work) | |
| 369 | 371 | { |
| 370 | − if (!svm_bo) | |
| 371 | − return; | |
| 372 | + struct svm_range_bo *svm_bo; | |
| 373 | + | |
| 374 | + svm_bo = container_of(work, struct svm_range_bo, release_work); | |
| 375 | + svm_range_bo_release(&svm_bo->kref); | |
| 376 | +} | |
| 377 | + | |
| 378 | +static void svm_range_bo_release_async(struct kref *kref) | |
| 379 | +{ | |
| 380 | + struct svm_range_bo *svm_bo; | |
| 381 | + | |
| 382 | + svm_bo = container_of(kref, struct svm_range_bo, kref); | |
| 383 | + pr_debug("svm_bo 0x%p\n", svm_bo); | |
| 384 | + INIT_WORK(&svm_bo->release_work, svm_range_bo_wq_release); | |
| 385 | + schedule_work(&svm_bo->release_work); | |
| 386 | +} | |
| 372 | 387 | |
| 373 | − kref_put(&svm_bo->kref, svm_range_bo_release); | |
| 388 | +void svm_range_bo_unref_async(struct svm_range_bo *svm_bo) | |
| 389 | +{ | |
| 390 | + kref_put(&svm_bo->kref, svm_range_bo_release_async); | |
| 391 | +} | |
| 392 | + | |
| 393 | +static void svm_range_bo_unref(struct svm_range_bo *svm_bo) | |
| 394 | +{ | |
| 395 | + if (svm_bo) | |
| 396 | + kref_put(&svm_bo->kref, svm_range_bo_release); | |
| 374 | 397 | } |
| 375 | 398 | |
| 376 | 399 | static bool |
| @@ -2254,8 +2277,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interval_notifier *mni, · 1877 unmodified lines | ||
| 2254 | 2277 | |
| 2255 | 2278 | start = mni->interval_tree.start; |
| 2256 | 2279 | last = mni->interval_tree.last; |
| 2257 | − start = (start > range->start ? start : range->start) >> PAGE_SHIFT; | |
| 2258 | − last = (last < (range->end - 1) ? last : range->end - 1) >> PAGE_SHIFT; | |
| 2280 | + start = max(start, range->start) >> PAGE_SHIFT; | |
| 2281 | + last = min(last, range->end - 1) >> PAGE_SHIFT; | |
| 2259 | 2282 | pr_debug("[0x%lx 0x%lx] range[0x%lx 0x%lx] notifier[0x%lx 0x%lx] %d\n", |
| 2260 | 2283 | start, last, range->start >> PAGE_SHIFT, |
| 2261 | 2284 | (range->end - 1) >> PAGE_SHIFT, |
| @@ -48,6 +48,7 @@ struct svm_range_bo { · 47 unmodified lines | ||
| 48 | 48 | struct work_struct eviction_work; |
| 49 | 49 | struct svm_range_list *svms; |
| 50 | 50 | uint32_t evicting; |
| 51 | + struct work_struct release_work; | |
| 51 | 52 | }; |
| 52 | 53 | |
| 53 | 54 | enum svm_work_list_ops { |
| @@ -195,7 +196,7 @@ void svm_range_list_lock_and_flush_work(struct svm_range_list *svms, struct mm_s · 141 unmodified lines | ||
| 195 | 196 | */ |
| 196 | 197 | #define KFD_IS_SVM_API_SUPPORTED(dev) ((dev)->pgmap.type != 0) |
| 197 | 198 | |
| 198 | −void svm_range_bo_unref(struct svm_range_bo *svm_bo); | |
| 199 | +void svm_range_bo_unref_async(struct svm_range_bo *svm_bo); | |
| 199 | 200 | #else |
| 200 | 201 | |
| 201 | 202 | struct kfd_process; |
| @@ -741,7 +741,7 @@ void vg_clk_mgr_construct( · 740 unmodified lines | ||
| 741 | 741 | sizeof(struct watermarks), |
| 742 | 742 | &clk_mgr->smu_wm_set.mc_address.quad_part); |
| 743 | 743 | |
| 744 | − if (clk_mgr->smu_wm_set.wm_set == 0) { | |
| 744 | + if (!clk_mgr->smu_wm_set.wm_set) { | |
| 745 | 745 | clk_mgr->smu_wm_set.wm_set = &dummy_wms; |
| 746 | 746 | clk_mgr->smu_wm_set.mc_address.quad_part = 0; |
| 747 | 747 | } |
| @@ -158,6 +158,7 @@ void dcn31_update_clocks(struct clk_mgr *clk_mgr_base, · 157 unmodified lines | ||
| 158 | 158 | union display_idle_optimization_u idle_info = { 0 }; |
| 159 | 159 | idle_info.idle_info.df_request_disabled = 1; |
| 160 | 160 | idle_info.idle_info.phy_ref_clk_off = 1; |
| 161 | + idle_info.idle_info.s0i2_rdy = 1; | |
| 161 | 162 | dcn31_smu_set_display_idle_optimization(clk_mgr, idle_info.data); |
| 162 | 163 | /* update power state */ |
| 163 | 164 | clk_mgr_base->clks.pwr_state = DCN_PWR_STATE_LOW_POWER; |
| @@ -274,24 +274,6 @@ static bool create_links( · 273 unmodified lines | ||
| 274 | 274 | goto failed_alloc; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | −#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 278 | − if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment) && | |
| 279 | − dc->caps.dp_hpo && | |
| 280 | − link->dc->res_pool->res_cap->num_hpo_dp_link_encoder > 0) { | |
| 281 | − /* FPGA case - Allocate HPO DP link encoder */ | |
| 282 | − if (i < link->dc->res_pool->res_cap->num_hpo_dp_link_encoder) { | |
| 283 | − link->hpo_dp_link_enc = link->dc->res_pool->hpo_dp_link_enc[i]; | |
| 284 | − | |
| 285 | − if (link->hpo_dp_link_enc == NULL) { | |
| 286 | − BREAK_TO_DEBUGGER(); | |
| 287 | − goto failed_alloc; | |
| 288 | − } | |
| 289 | − link->hpo_dp_link_enc->hpd_source = link->link_enc->hpd_source; | |
| 290 | − link->hpo_dp_link_enc->transmitter = link->link_enc->transmitter; | |
| 291 | − } | |
| 292 | − } | |
| 293 | −#endif | |
| 294 | − | |
| 295 | 277 | link->link_status.dpcd_caps = &link->dpcd_caps; |
| 296 | 278 | |
| 297 | 279 | enc_init.ctx = dc->ctx; |
| @@ -422,6 +422,8 @@ char *dc_status_to_str(enum dc_status status) · 421 unmodified lines | ||
| 422 | 422 | return "The operation is not supported."; |
| 423 | 423 | case DC_UNSUPPORTED_VALUE: |
| 424 | 424 | return "The value specified is not supported."; |
| 425 | + case DC_NO_LINK_ENC_RESOURCE: | |
| 426 | + return "No link encoder resource"; | |
| 425 | 427 | case DC_ERROR_UNEXPECTED: |
| 426 | 428 | return "Unexpected error"; |
| 427 | 429 | } |
| @@ -66,31 +66,6 @@ · 65 unmodified lines | ||
| 66 | 66 | /******************************************************************************* |
| 67 | 67 | * Private functions |
| 68 | 68 | ******************************************************************************/ |
| 69 | −#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 70 | −static bool add_dp_hpo_link_encoder_to_link(struct dc_link *link) | |
| 71 | −{ | |
| 72 | − struct hpo_dp_link_encoder *enc = resource_get_unused_hpo_dp_link_encoder( | |
| 73 | − link->dc->res_pool); | |
| 74 | − | |
| 75 | − if (!link->hpo_dp_link_enc && enc) { | |
| 76 | − link->hpo_dp_link_enc = enc; | |
| 77 | − link->hpo_dp_link_enc->transmitter = link->link_enc->transmitter; | |
| 78 | − link->hpo_dp_link_enc->hpd_source = link->link_enc->hpd_source; | |
| 79 | − } | |
| 80 | − | |
| 81 | − return (link->hpo_dp_link_enc != NULL); | |
| 82 | −} | |
| 83 | − | |
| 84 | −static void remove_dp_hpo_link_encoder_from_link(struct dc_link *link) | |
| 85 | −{ | |
| 86 | − if (link->hpo_dp_link_enc) { | |
| 87 | − link->hpo_dp_link_enc->hpd_source = HPD_SOURCEID_UNKNOWN; | |
| 88 | − link->hpo_dp_link_enc->transmitter = TRANSMITTER_UNKNOWN; | |
| 89 | − link->hpo_dp_link_enc = NULL; | |
| 90 | − } | |
| 91 | −} | |
| 92 | −#endif | |
| 93 | − | |
| 94 | 69 | static void dc_link_destruct(struct dc_link *link) |
| 95 | 70 | { |
| 96 | 71 | int i; |
| @@ -118,12 +93,6 @@ static void dc_link_destruct(struct dc_link *link) · 21 unmodified lines | ||
| 118 | 93 | link->link_enc->funcs->destroy(&link->link_enc); |
| 119 | 94 | } |
| 120 | 95 | |
| 121 | −#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 122 | − if (link->hpo_dp_link_enc) { | |
| 123 | − remove_dp_hpo_link_encoder_from_link(link); | |
| 124 | − } | |
| 125 | −#endif | |
| 126 | − | |
| 127 | 96 | if (link->local_sink) |
| 128 | 97 | dc_sink_release(link->local_sink); |
| 129 | 98 | |
| @@ -881,6 +850,7 @@ static bool dc_link_detect_helper(struct dc_link *link, · 751 unmodified lines | ||
| 881 | 850 | enum dc_connection_type pre_connection_type = dc_connection_none; |
| 882 | 851 | bool perform_dp_seamless_boot = false; |
| 883 | 852 | const uint32_t post_oui_delay = 30; // 30ms |
| 853 | + struct link_resource link_res = { 0 }; | |
| 884 | 854 | |
| 885 | 855 | DC_LOGGER_INIT(link->ctx->logger); |
| 886 | 856 | |
| @@ -975,7 +945,10 @@ static bool dc_link_detect_helper(struct dc_link *link, · 88 unmodified lines | ||
| 975 | 945 | |
| 976 | 946 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 977 | 947 | if (dp_get_link_encoding_format(&link->reported_link_cap) == DP_128b_132b_ENCODING) |
| 978 | − add_dp_hpo_link_encoder_to_link(link); | |
| 948 | + link_res.hpo_dp_link_enc = resource_get_hpo_dp_link_enc_for_det_lt( | |
| 949 | + &link->dc->current_state->res_ctx, | |
| 950 | + link->dc->res_pool, | |
| 951 | + link); | |
| 979 | 952 | #endif |
| 980 | 953 | |
| 981 | 954 | if (link->type == dc_connection_mst_branch) { |
| @@ -986,7 +959,7 @@ static bool dc_link_detect_helper(struct dc_link *link, · 4 unmodified lines | ||
| 986 | 959 | * empty which leads to allocate_mst_payload() has "0" |
| 987 | 960 | * pbn_per_slot value leading to exception on dc_fixpt_div() |
| 988 | 961 | */ |
| 989 | − dp_verify_mst_link_cap(link); | |
| 962 | + dp_verify_mst_link_cap(link, &link_res); | |
| 990 | 963 | |
| 991 | 964 | /* |
| 992 | 965 | * This call will initiate MST topology discovery. Which |
| @@ -1150,6 +1123,7 @@ static bool dc_link_detect_helper(struct dc_link *link, · 157 unmodified lines | ||
| 1150 | 1123 | // verify link cap for SST non-seamless boot |
| 1151 | 1124 | if (!perform_dp_seamless_boot) |
| 1152 | 1125 | dp_verify_link_cap_with_retries(link, |
| 1126 | + &link_res, | |
| 1153 | 1127 | &link->reported_link_cap, |
| 1154 | 1128 | LINK_TRAINING_MAX_VERIFY_RETRY); |
| 1155 | 1129 | } else { |
| @@ -1844,6 +1818,8 @@ static void enable_stream_features(struct pipe_ctx *pipe_ctx) · 688 unmodified lines | ||
| 1844 | 1818 | union down_spread_ctrl old_downspread; |
| 1845 | 1819 | union down_spread_ctrl new_downspread; |
| 1846 | 1820 | |
| 1821 | + memset(&old_downspread, 0, sizeof(old_downspread)); | |
| 1822 | + | |
| 1847 | 1823 | core_link_read_dpcd(link, DP_DOWNSPREAD_CTRL, |
| 1848 | 1824 | &old_downspread.raw, sizeof(old_downspread)); |
| 1849 | 1825 | |
| @@ -2503,7 +2479,8 @@ static void write_i2c_redriver_setting( · 653 unmodified lines | ||
| 2503 | 2479 | DC_LOG_DEBUG("Set redriver failed"); |
| 2504 | 2480 | } |
| 2505 | 2481 | |
| 2506 | −static void disable_link(struct dc_link *link, enum signal_type signal) | |
| 2482 | +static void disable_link(struct dc_link *link, const struct link_resource *link_res, | |
| 2483 | + enum signal_type signal) | |
| 2507 | 2484 | { |
| 2508 | 2485 | /* |
| 2509 | 2486 | * TODO: implement call for dp_set_hw_test_pattern |
| @@ -2522,20 +2499,20 @@ static void disable_link(struct dc_link *link, enum signal_type signal) · 12 unmodified lines | ||
| 2522 | 2499 | struct dc_link_settings link_settings = link->cur_link_settings; |
| 2523 | 2500 | #endif |
| 2524 | 2501 | if (dc_is_dp_sst_signal(signal)) |
| 2525 | − dp_disable_link_phy(link, signal); | |
| 2502 | + dp_disable_link_phy(link, link_res, signal); | |
| 2526 | 2503 | else |
| 2527 | − dp_disable_link_phy_mst(link, signal); | |
| 2504 | + dp_disable_link_phy_mst(link, link_res, signal); | |
| 2528 | 2505 | |
| 2529 | 2506 | if (dc_is_dp_sst_signal(signal) || |
| 2530 | 2507 | link->mst_stream_alloc_table.stream_count == 0) { |
| 2531 | 2508 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2532 | 2509 | if (dp_get_link_encoding_format(&link_settings) == DP_8b_10b_ENCODING) { |
| 2533 | 2510 | dp_set_fec_enable(link, false); |
| 2534 | − dp_set_fec_ready(link, false); | |
| 2511 | + dp_set_fec_ready(link, link_res, false); | |
| 2535 | 2512 | } |
| 2536 | 2513 | #else |
| 2537 | 2514 | dp_set_fec_enable(link, false); |
| 2538 | − dp_set_fec_ready(link, false); | |
| 2515 | + dp_set_fec_ready(link, link_res, false); | |
| 2539 | 2516 | #endif |
| 2540 | 2517 | } |
| 2541 | 2518 | } else { |
| @@ -2646,7 +2623,7 @@ static enum dc_status enable_link( · 104 unmodified lines | ||
| 2646 | 2623 | * new link settings. |
| 2647 | 2624 | */ |
| 2648 | 2625 | if (link->link_status.link_active) { |
| 2649 | − disable_link(link, pipe_ctx->stream->signal); | |
| 2626 | + disable_link(link, &pipe_ctx->link_res, pipe_ctx->stream->signal); | |
| 2650 | 2627 | } |
| 2651 | 2628 | |
| 2652 | 2629 | switch (pipe_ctx->stream->signal) { |
| @@ -3421,7 +3398,7 @@ static enum dc_status dc_link_update_sst_payload(struct pipe_ctx *pipe_ctx, · 768 unmodified lines | ||
| 3421 | 3398 | { |
| 3422 | 3399 | struct dc_stream_state *stream = pipe_ctx->stream; |
| 3423 | 3400 | struct dc_link *link = stream->link; |
| 3424 | − struct hpo_dp_link_encoder *hpo_dp_link_encoder = link->hpo_dp_link_enc; | |
| 3401 | + struct hpo_dp_link_encoder *hpo_dp_link_encoder = pipe_ctx->link_res.hpo_dp_link_enc; | |
| 3425 | 3402 | struct hpo_dp_stream_encoder *hpo_dp_stream_encoder = pipe_ctx->stream_res.hpo_dp_stream_enc; |
| 3426 | 3403 | struct link_mst_stream_allocation_table proposed_table = {0}; |
| 3427 | 3404 | struct fixed31_32 avg_time_slots_per_mtp; |
| @@ -3503,7 +3480,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx) · 75 unmodified lines | ||
| 3503 | 3480 | struct link_encoder *link_encoder = NULL; |
| 3504 | 3481 | struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; |
| 3505 | 3482 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 3506 | − struct hpo_dp_link_encoder *hpo_dp_link_encoder = link->hpo_dp_link_enc; | |
| 3483 | + struct hpo_dp_link_encoder *hpo_dp_link_encoder = pipe_ctx->link_res.hpo_dp_link_enc; | |
| 3507 | 3484 | struct hpo_dp_stream_encoder *hpo_dp_stream_encoder = pipe_ctx->stream_res.hpo_dp_stream_enc; |
| 3508 | 3485 | #endif |
| 3509 | 3486 | struct dp_mst_stream_allocation_table proposed_table = {0}; |
| @@ -3833,7 +3810,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) · 323 unmodified lines | ||
| 3833 | 3810 | struct link_encoder *link_encoder = NULL; |
| 3834 | 3811 | struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; |
| 3835 | 3812 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 3836 | − struct hpo_dp_link_encoder *hpo_dp_link_encoder = link->hpo_dp_link_enc; | |
| 3813 | + struct hpo_dp_link_encoder *hpo_dp_link_encoder = pipe_ctx->link_res.hpo_dp_link_enc; | |
| 3837 | 3814 | struct hpo_dp_stream_encoder *hpo_dp_stream_encoder = pipe_ctx->stream_res.hpo_dp_stream_enc; |
| 3838 | 3815 | #endif |
| 3839 | 3816 | struct dp_mst_stream_allocation_table proposed_table = {0}; |
| @@ -4009,12 +3986,9 @@ static void update_psp_stream_config(struct pipe_ctx *pipe_ctx, bool dpms_off) · 169 unmodified lines | ||
| 4009 | 3986 | config.dig_be = pipe_ctx->stream->link->link_enc_hw_inst; |
| 4010 | 3987 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 4011 | 3988 | config.stream_enc_idx = pipe_ctx->stream_res.stream_enc->id - ENGINE_ID_DIGA; |
| 4012 | − | |
| 3989 | + | |
| 4013 | 3990 | if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY || |
| 4014 | 3991 | pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) { |
| 4015 | − link_enc = pipe_ctx->stream->link->link_enc; | |
| 4016 | − config.dio_output_type = pipe_ctx->stream->link->ep_type; | |
| 4017 | − config.dio_output_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A; | |
| 4018 | 3992 | if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_PHY) |
| 4019 | 3993 | link_enc = pipe_ctx->stream->link->link_enc; |
| 4020 | 3994 | else if (pipe_ctx->stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) |
| @@ -4081,7 +4055,8 @@ static void update_psp_stream_config(struct pipe_ctx *pipe_ctx, bool dpms_off) · 60 unmodified lines | ||
| 4081 | 4055 | config.link_enc_idx = link_enc->transmitter - TRANSMITTER_UNIPHY_A; |
| 4082 | 4056 | if (is_dp_128b_132b_signal(pipe_ctx)) { |
| 4083 | 4057 | config.stream_enc_idx = pipe_ctx->stream_res.hpo_dp_stream_enc->id - ENGINE_ID_HPO_DP_0; |
| 4084 | − config.link_enc_idx = pipe_ctx->stream->link->hpo_dp_link_enc->inst; | |
| 4058 | + | |
| 4059 | + config.link_enc_idx = pipe_ctx->link_res.hpo_dp_link_enc->inst; | |
| 4085 | 4060 | config.dp2_enabled = 1; |
| 4086 | 4061 | } |
| 4087 | 4062 | #endif |
| @@ -4112,7 +4087,7 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pi · 24 unmodified lines | ||
| 4112 | 4087 | stream->link->cur_link_settings = link_settings; |
| 4113 | 4088 | |
| 4114 | 4089 | /* Enable clock, Configure lane count, and Enable Link Encoder*/ |
| 4115 | − enable_dp_hpo_output(stream->link, &stream->link->cur_link_settings); | |
| 4090 | + enable_dp_hpo_output(stream->link, &pipe_ctx->link_res, &stream->link->cur_link_settings); | |
| 4116 | 4091 | |
| 4117 | 4092 | #ifdef DIAGS_BUILD |
| 4118 | 4093 | /* Workaround for FPGA HPO capture DP link data: |
| @@ -4162,12 +4137,12 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pi · 43 unmodified lines | ||
| 4162 | 4137 | proposed_table.stream_allocations[0].hpo_dp_stream_enc = pipe_ctx->stream_res.hpo_dp_stream_enc; |
| 4163 | 4138 | } |
| 4164 | 4139 | |
| 4165 | − stream->link->hpo_dp_link_enc->funcs->update_stream_allocation_table( | |
| 4166 | − stream->link->hpo_dp_link_enc, | |
| 4140 | + pipe_ctx->link_res.hpo_dp_link_enc->funcs->update_stream_allocation_table( | |
| 4141 | + pipe_ctx->link_res.hpo_dp_link_enc, | |
| 4167 | 4142 | &proposed_table); |
| 4168 | 4143 | |
| 4169 | − stream->link->hpo_dp_link_enc->funcs->set_throttled_vcp_size( | |
| 4170 | − stream->link->hpo_dp_link_enc, | |
| 4144 | + pipe_ctx->link_res.hpo_dp_link_enc->funcs->set_throttled_vcp_size( | |
| 4145 | + pipe_ctx->link_res.hpo_dp_link_enc, | |
| 4171 | 4146 | pipe_ctx->stream_res.hpo_dp_stream_enc->inst, |
| 4172 | 4147 | avg_time_slots_per_mtp); |
| 4173 | 4148 | |
| @@ -4356,7 +4331,8 @@ void core_link_enable_stream( · 182 unmodified lines | ||
| 4356 | 4331 | if (status != DC_FAIL_DP_LINK_TRAINING || |
| 4357 | 4332 | pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) { |
| 4358 | 4333 | if (false == stream->link->link_status.link_active) |
| 4359 | − disable_link(stream->link, pipe_ctx->stream->signal); | |
| 4334 | + disable_link(stream->link, &pipe_ctx->link_res, | |
| 4335 | + pipe_ctx->stream->signal); | |
| 4360 | 4336 | BREAK_TO_DEBUGGER(); |
| 4361 | 4337 | return; |
| 4362 | 4338 | } |
| @@ -4505,14 +4481,14 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx) · 142 unmodified lines | ||
| 4505 | 4481 | * state machine. |
| 4506 | 4482 | * In DP2 or MST mode, our encoder will stay video active |
| 4507 | 4483 | */ |
| 4508 | − disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); | |
| 4484 | + disable_link(pipe_ctx->stream->link, &pipe_ctx->link_res, pipe_ctx->stream->signal); | |
| 4509 | 4485 | dc->hwss.disable_stream(pipe_ctx); |
| 4510 | 4486 | } else { |
| 4511 | 4487 | dc->hwss.disable_stream(pipe_ctx); |
| 4512 | − disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); | |
| 4488 | + disable_link(pipe_ctx->stream->link, &pipe_ctx->link_res, pipe_ctx->stream->signal); | |
| 4513 | 4489 | } |
| 4514 | 4490 | #else |
| 4515 | − disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); | |
| 4491 | + disable_link(pipe_ctx->stream->link, &pipe_ctx->link_res, pipe_ctx->stream->signal); | |
| 4516 | 4492 | |
| 4517 | 4493 | dc->hwss.disable_stream(pipe_ctx); |
| 4518 | 4494 | #endif |
| @@ -4595,16 +4571,22 @@ void dc_link_set_drive_settings(struct dc *dc, · 76 unmodified lines | ||
| 4595 | 4571 | { |
| 4596 | 4572 | |
| 4597 | 4573 | int i; |
| 4574 | + struct pipe_ctx *pipe = NULL; | |
| 4575 | + const struct link_resource *link_res; | |
| 4598 | 4576 | |
| 4599 | − for (i = 0; i < dc->link_count; i++) { | |
| 4600 | − if (dc->links[i] == link) | |
| 4601 | − break; | |
| 4602 | − } | |
| 4577 | + link_res = dc_link_get_cur_link_res(link); | |
| 4603 | 4578 | |
| 4604 | − if (i >= dc->link_count) | |
| 4579 | + for (i = 0; i < MAX_PIPES; i++) { | |
| 4580 | + pipe = &dc->current_state->res_ctx.pipe_ctx[i]; | |
| 4581 | + if (pipe->stream && pipe->stream->link) { | |
| 4582 | + if (pipe->stream->link == link) | |
| 4583 | + break; | |
| 4584 | + } | |
| 4585 | + } | |
| 4586 | + if (pipe && link_res) | |
| 4587 | + dc_link_dp_set_drive_settings(pipe->stream->link, link_res, lt_settings); | |
| 4588 | + else | |
| 4605 | 4589 | ASSERT_CRITICAL(false); |
| 4606 | − | |
| 4607 | − dc_link_dp_set_drive_settings(dc->links[i], lt_settings); | |
| 4608 | 4590 | } |
| 4609 | 4591 | |
| 4610 | 4592 | void dc_link_set_preferred_link_settings(struct dc *dc, |
| @@ -4665,11 +4647,9 @@ void dc_link_set_preferred_training_settings(struct dc *dc, · 54 unmodified lines | ||
| 4665 | 4647 | if (link_setting != NULL) { |
| 4666 | 4648 | link->preferred_link_setting = *link_setting; |
| 4667 | 4649 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 4668 | − if (dp_get_link_encoding_format(link_setting) == | |
| 4669 | − DP_128b_132b_ENCODING && !link->hpo_dp_link_enc) { | |
| 4670 | − if (!add_dp_hpo_link_encoder_to_link(link)) | |
| 4671 | − memset(&link->preferred_link_setting, 0, sizeof(link->preferred_link_setting)); | |
| 4672 | − } | |
| 4650 | + if (dp_get_link_encoding_format(link_setting) == DP_128b_132b_ENCODING) | |
| 4651 | + /* TODO: add dc update for acquiring link res */ | |
| 4652 | + skip_immediate_retrain = true; | |
| 4673 | 4653 | #endif |
| 4674 | 4654 | } else { |
| 4675 | 4655 | link->preferred_link_setting.lane_count = LANE_COUNT_UNKNOWN; |
| @@ -4796,6 +4776,9 @@ void dc_link_overwrite_extended_receiver_cap( · 120 unmodified lines | ||
| 4796 | 4776 | |
| 4797 | 4777 | bool dc_link_is_fec_supported(const struct dc_link *link) |
| 4798 | 4778 | { |
| 4779 | + /* TODO - use asic cap instead of link_enc->features | |
| 4780 | + * we no longer know which link enc to use for this link before commit | |
| 4781 | + */ | |
| 4799 | 4782 | struct link_encoder *link_enc = NULL; |
| 4800 | 4783 | |
| 4801 | 4784 | /* Links supporting dynamically assigned link encoder will be assigned next |
| @@ -4890,3 +4873,125 @@ uint32_t dc_bandwidth_in_kbps_from_timing( · 88 unmodified lines | ||
| 4890 | 4873 | return kbps; |
| 4891 | 4874 | |
| 4892 | 4875 | } |
| 4876 | + | |
| 4877 | +const struct link_resource *dc_link_get_cur_link_res(const struct dc_link *link) | |
| 4878 | +{ | |
| 4879 | + int i; | |
| 4880 | + struct pipe_ctx *pipe = NULL; | |
| 4881 | + const struct link_resource *link_res = NULL; | |
| 4882 | + | |
| 4883 | + for (i = 0; i < MAX_PIPES; i++) { | |
| 4884 | + pipe = &link->dc->current_state->res_ctx.pipe_ctx[i]; | |
| 4885 | + if (pipe->stream && pipe->stream->link && pipe->top_pipe == NULL) { | |
| 4886 | + if (pipe->stream->link == link) { | |
| 4887 | + link_res = &pipe->link_res; | |
| 4888 | + break; | |
| 4889 | + } | |
| 4890 | + } | |
| 4891 | + } | |
| 4892 | + | |
| 4893 | + return link_res; | |
| 4894 | +} | |
| 4895 | + | |
| 4896 | +/** | |
| 4897 | + * dc_get_cur_link_res_map() - take a snapshot of current link resource allocation state | |
| 4898 | + * @dc: pointer to dc of the dm calling this | |
| 4899 | + * @map: a dc link resource snapshot defined internally to dc. | |
| 4900 | + * | |
| 4901 | + * DM needs to capture a snapshot of current link resource allocation mapping | |
| 4902 | + * and store it in its persistent storage. | |
| 4903 | + * | |
| 4904 | + * Some of the link resource is using first come first serve policy. | |
| 4905 | + * The allocation mapping depends on original hotplug order. This information | |
| 4906 | + * is lost after driver is loaded next time. The snapshot is used in order to | |
| 4907 | + * restore link resource to its previous state so user will get consistent | |
| 4908 | + * link capability allocation across reboot. | |
| 4909 | + * | |
| 4910 | + * Return: none (void function) | |
| 4911 | + * | |
| 4912 | + */ | |
| 4913 | +void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map) | |
| 4914 | +{ | |
| 4915 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 4916 | + struct dc_link *link; | |
| 4917 | + uint8_t i; | |
| 4918 | + uint32_t hpo_dp_recycle_map = 0; | |
| 4919 | + | |
| 4920 | + *map = 0; | |
| 4921 | + | |
| 4922 | + if (dc->caps.dp_hpo) { | |
| 4923 | + for (i = 0; i < dc->caps.max_links; i++) { | |
| 4924 | + link = dc->links[i]; | |
| 4925 | + if (link->link_status.link_active && | |
| 4926 | + dp_get_link_encoding_format(&link->reported_link_cap) == DP_128b_132b_ENCODING && | |
| 4927 | + dp_get_link_encoding_format(&link->cur_link_settings) != DP_128b_132b_ENCODING) | |
| 4928 | + /* hpo dp link encoder is considered as recycled, when RX reports 128b/132b encoding capability | |
| 4929 | + * but current link doesn't use it. | |
| 4930 | + */ | |
| 4931 | + hpo_dp_recycle_map |= (1 << i); | |
| 4932 | + } | |
| 4933 | + *map |= (hpo_dp_recycle_map << LINK_RES_HPO_DP_REC_MAP__SHIFT); | |
| 4934 | + } | |
| 4935 | +#endif | |
| 4936 | +} | |
| 4937 | + | |
| 4938 | +/** | |
| 4939 | + * dc_restore_link_res_map() - restore link resource allocation state from a snapshot | |
| 4940 | + * @dc: pointer to dc of the dm calling this | |
| 4941 | + * @map: a dc link resource snapshot defined internally to dc. | |
| 4942 | + * | |
| 4943 | + * DM needs to call this function after initial link detection on boot and | |
| 4944 | + * before first commit streams to restore link resource allocation state | |
| 4945 | + * from previous boot session. | |
| 4946 | + * | |
| 4947 | + * Some of the link resource is using first come first serve policy. | |
| 4948 | + * The allocation mapping depends on original hotplug order. This information | |
| 4949 | + * is lost after driver is loaded next time. The snapshot is used in order to | |
| 4950 | + * restore link resource to its previous state so user will get consistent | |
| 4951 | + * link capability allocation across reboot. | |
| 4952 | + * | |
| 4953 | + * Return: none (void function) | |
| 4954 | + * | |
| 4955 | + */ | |
| 4956 | +void dc_restore_link_res_map(const struct dc *dc, uint32_t *map) | |
| 4957 | +{ | |
| 4958 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 4959 | + struct dc_link *link; | |
| 4960 | + uint8_t i; | |
| 4961 | + unsigned int available_hpo_dp_count; | |
| 4962 | + uint32_t hpo_dp_recycle_map = (*map & LINK_RES_HPO_DP_REC_MAP__MASK) | |
| 4963 | + >> LINK_RES_HPO_DP_REC_MAP__SHIFT; | |
| 4964 | + | |
| 4965 | + if (dc->caps.dp_hpo) { | |
| 4966 | + available_hpo_dp_count = dc->res_pool->hpo_dp_link_enc_count; | |
| 4967 | + /* remove excess 128b/132b encoding support for not recycled links */ | |
| 4968 | + for (i = 0; i < dc->caps.max_links; i++) { | |
| 4969 | + if ((hpo_dp_recycle_map & (1 << i)) == 0) { | |
| 4970 | + link = dc->links[i]; | |
| 4971 | + if (link->type != dc_connection_none && | |
| 4972 | + dp_get_link_encoding_format(&link->verified_link_cap) == DP_128b_132b_ENCODING) { | |
| 4973 | + if (available_hpo_dp_count > 0) | |
| 4974 | + available_hpo_dp_count--; | |
| 4975 | + else | |
| 4976 | + /* remove 128b/132b encoding capability by limiting verified link rate to HBR3 */ | |
| 4977 | + link->verified_link_cap.link_rate = LINK_RATE_HIGH3; | |
| 4978 | + } | |
| 4979 | + } | |
| 4980 | + } | |
| 4981 | + /* remove excess 128b/132b encoding support for recycled links */ | |
| 4982 | + for (i = 0; i < dc->caps.max_links; i++) { | |
| 4983 | + if ((hpo_dp_recycle_map & (1 << i)) != 0) { | |
| 4984 | + link = dc->links[i]; | |
| 4985 | + if (link->type != dc_connection_none && | |
| 4986 | + dp_get_link_encoding_format(&link->verified_link_cap) == DP_128b_132b_ENCODING) { | |
| 4987 | + if (available_hpo_dp_count > 0) | |
| 4988 | + available_hpo_dp_count--; | |
| 4989 | + else | |
| 4990 | + /* remove 128b/132b encoding capability by limiting verified link rate to HBR3 */ | |
| 4991 | + link->verified_link_cap.link_rate = LINK_RATE_HIGH3; | |
| 4992 | + } | |
| 4993 | + } | |
| 4994 | + } | |
| 4995 | + } | |
| 4996 | +#endif | |
| 4997 | +} | |
| @@ -1251,6 +1251,7 @@ bool dp_is_max_vs_reached( · 1250 unmodified lines | ||
| 1251 | 1251 | |
| 1252 | 1252 | static bool perform_post_lt_adj_req_sequence( |
| 1253 | 1253 | struct dc_link *link, |
| 1254 | + const struct link_resource *link_res, | |
| 1254 | 1255 | struct link_training_settings *lt_settings) |
| 1255 | 1256 | { |
| 1256 | 1257 | enum dc_lane_count lane_count = |
| @@ -1314,6 +1315,7 @@ static bool perform_post_lt_adj_req_sequence( · 57 unmodified lines | ||
| 1314 | 1315 | lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); |
| 1315 | 1316 | |
| 1316 | 1317 | dc_link_dp_set_drive_settings(link, |
| 1318 | + link_res, | |
| 1317 | 1319 | lt_settings); |
| 1318 | 1320 | break; |
| 1319 | 1321 | } |
| @@ -1388,6 +1390,7 @@ enum link_training_result dp_get_cr_failure(enum dc_lane_count ln_count, · 68 unmodified lines | ||
| 1388 | 1390 | |
| 1389 | 1391 | static enum link_training_result perform_channel_equalization_sequence( |
| 1390 | 1392 | struct dc_link *link, |
| 1393 | + const struct link_resource *link_res, | |
| 1391 | 1394 | struct link_training_settings *lt_settings, |
| 1392 | 1395 | uint32_t offset) |
| 1393 | 1396 | { |
| @@ -1410,12 +1413,12 @@ static enum link_training_result perform_channel_equalization_sequence( · 16 unmodified lines | ||
| 1410 | 1413 | tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4; |
| 1411 | 1414 | #endif |
| 1412 | 1415 | |
| 1413 | − dp_set_hw_training_pattern(link, tr_pattern, offset); | |
| 1416 | + dp_set_hw_training_pattern(link, link_res, tr_pattern, offset); | |
| 1414 | 1417 | |
| 1415 | 1418 | for (retries_ch_eq = 0; retries_ch_eq <= LINK_TRAINING_MAX_RETRY_COUNT; |
| 1416 | 1419 | retries_ch_eq++) { |
| 1417 | 1420 | |
| 1418 | − dp_set_hw_lane_settings(link, lt_settings, offset); | |
| 1421 | + dp_set_hw_lane_settings(link, link_res, lt_settings, offset); | |
| 1419 | 1422 | |
| 1420 | 1423 | /* 2. update DPCD*/ |
| 1421 | 1424 | if (!retries_ch_eq) |
| @@ -1479,18 +1482,20 @@ static enum link_training_result perform_channel_equalization_sequence( · 57 unmodified lines | ||
| 1479 | 1482 | } |
| 1480 | 1483 | |
| 1481 | 1484 | static void start_clock_recovery_pattern_early(struct dc_link *link, |
| 1485 | + const struct link_resource *link_res, | |
| 1482 | 1486 | struct link_training_settings *lt_settings, |
| 1483 | 1487 | uint32_t offset) |
| 1484 | 1488 | { |
| 1485 | 1489 | DC_LOG_HW_LINK_TRAINING("%s\n GPU sends TPS1. Wait 400us.\n", |
| 1486 | 1490 | __func__); |
| 1487 | − dp_set_hw_training_pattern(link, lt_settings->pattern_for_cr, offset); | |
| 1488 | − dp_set_hw_lane_settings(link, lt_settings, offset); | |
| 1491 | + dp_set_hw_training_pattern(link, link_res, lt_settings->pattern_for_cr, offset); | |
| 1492 | + dp_set_hw_lane_settings(link, link_res, lt_settings, offset); | |
| 1489 | 1493 | udelay(400); |
| 1490 | 1494 | } |
| 1491 | 1495 | |
| 1492 | 1496 | static enum link_training_result perform_clock_recovery_sequence( |
| 1493 | 1497 | struct dc_link *link, |
| 1498 | + const struct link_resource *link_res, | |
| 1494 | 1499 | struct link_training_settings *lt_settings, |
| 1495 | 1500 | uint32_t offset) |
| 1496 | 1501 | { |
| @@ -1506,7 +1511,7 @@ static enum link_training_result perform_clock_recovery_sequence( · 9 unmodified lines | ||
| 1506 | 1511 | retry_count = 0; |
| 1507 | 1512 | |
| 1508 | 1513 | if (!link->ctx->dc->work_arounds.lt_early_cr_pattern) |
| 1509 | − dp_set_hw_training_pattern(link, lt_settings->pattern_for_cr, offset); | |
| 1514 | + dp_set_hw_training_pattern(link, link_res, lt_settings->pattern_for_cr, offset); | |
| 1510 | 1515 | |
| 1511 | 1516 | /* najeeb - The synaptics MST hub can put the LT in |
| 1512 | 1517 | * infinite loop by switching the VS |
| @@ -1523,6 +1528,7 @@ static enum link_training_result perform_clock_recovery_sequence( · 10 unmodified lines | ||
| 1523 | 1528 | /* 1. call HWSS to set lane settings*/ |
| 1524 | 1529 | dp_set_hw_lane_settings( |
| 1525 | 1530 | link, |
| 1531 | + link_res, | |
| 1526 | 1532 | lt_settings, |
| 1527 | 1533 | offset); |
| 1528 | 1534 | |
| @@ -1544,9 +1550,6 @@ static enum link_training_result perform_clock_recovery_sequence( · 15 unmodified lines | ||
| 1544 | 1550 | /* 3. wait receiver to lock-on*/ |
| 1545 | 1551 | wait_time_microsec = lt_settings->cr_pattern_time; |
| 1546 | 1552 | |
| 1547 | − if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) | |
| 1548 | − wait_time_microsec = TRAINING_AUX_RD_INTERVAL; | |
| 1549 | − | |
| 1550 | 1553 | if (link->dc->debug.apply_vendor_specific_lttpr_wa && |
| 1551 | 1554 | (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN)) { |
| 1552 | 1555 | wait_time_microsec = 16000; |
| @@ -1624,13 +1627,14 @@ static enum link_training_result perform_clock_recovery_sequence( · 71 unmodified lines | ||
| 1624 | 1627 | |
| 1625 | 1628 | static inline enum link_training_result dp_transition_to_video_idle( |
| 1626 | 1629 | struct dc_link *link, |
| 1630 | + const struct link_resource *link_res, | |
| 1627 | 1631 | struct link_training_settings *lt_settings, |
| 1628 | 1632 | enum link_training_result status) |
| 1629 | 1633 | { |
| 1630 | 1634 | union lane_count_set lane_count_set = {0}; |
| 1631 | 1635 | |
| 1632 | 1636 | /* 4. mainlink output idle pattern*/ |
| 1633 | − dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); | |
| 1637 | + dp_set_hw_test_pattern(link, link_res, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); | |
| 1634 | 1638 | |
| 1635 | 1639 | /* |
| 1636 | 1640 | * 5. post training adjust if required |
| @@ -1654,7 +1658,7 @@ static inline enum link_training_result dp_transition_to_video_idle( · 17 unmodified lines | ||
| 1654 | 1658 | } |
| 1655 | 1659 | |
| 1656 | 1660 | if (status == LINK_TRAINING_SUCCESS && |
| 1657 | − perform_post_lt_adj_req_sequence(link, lt_settings) == false) | |
| 1661 | + perform_post_lt_adj_req_sequence(link, link_res, lt_settings) == false) | |
| 1658 | 1662 | status = LINK_TRAINING_LQA_FAIL; |
| 1659 | 1663 | |
| 1660 | 1664 | lane_count_set.bits.LANE_COUNT_SET = lt_settings->link_settings.lane_count; |
| @@ -2097,10 +2101,11 @@ static void print_status_message( · 436 unmodified lines | ||
| 2097 | 2101 | |
| 2098 | 2102 | void dc_link_dp_set_drive_settings( |
| 2099 | 2103 | struct dc_link *link, |
| 2104 | + const struct link_resource *link_res, | |
| 2100 | 2105 | struct link_training_settings *lt_settings) |
| 2101 | 2106 | { |
| 2102 | 2107 | /* program ASIC PHY settings*/ |
| 2103 | − dp_set_hw_lane_settings(link, lt_settings, DPRX); | |
| 2108 | + dp_set_hw_lane_settings(link, link_res, lt_settings, DPRX); | |
| 2104 | 2109 | |
| 2105 | 2110 | dp_hw_to_dpcd_lane_settings(lt_settings, |
| 2106 | 2111 | lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); |
| @@ -2111,6 +2116,7 @@ void dc_link_dp_set_drive_settings( · 4 unmodified lines | ||
| 2111 | 2116 | |
| 2112 | 2117 | bool dc_link_dp_perform_link_training_skip_aux( |
| 2113 | 2118 | struct dc_link *link, |
| 2119 | + const struct link_resource *link_res, | |
| 2114 | 2120 | const struct dc_link_settings *link_setting) |
| 2115 | 2121 | { |
| 2116 | 2122 | struct link_training_settings lt_settings = {0}; |
| @@ -2127,10 +2133,10 @@ bool dc_link_dp_perform_link_training_skip_aux( · 10 unmodified lines | ||
| 2127 | 2133 | /* 1. Perform_clock_recovery_sequence. */ |
| 2128 | 2134 | |
| 2129 | 2135 | /* transmit training pattern for clock recovery */ |
| 2130 | − dp_set_hw_training_pattern(link, lt_settings.pattern_for_cr, DPRX); | |
| 2136 | + dp_set_hw_training_pattern(link, link_res, lt_settings.pattern_for_cr, DPRX); | |
| 2131 | 2137 | |
| 2132 | 2138 | /* call HWSS to set lane settings*/ |
| 2133 | − dp_set_hw_lane_settings(link, <_settings, DPRX); | |
| 2139 | + dp_set_hw_lane_settings(link, link_res, <_settings, DPRX); | |
| 2134 | 2140 | |
| 2135 | 2141 | /* wait receiver to lock-on*/ |
| 2136 | 2142 | dp_wait_for_training_aux_rd_interval(link, lt_settings.cr_pattern_time); |
| @@ -2138,10 +2144,10 @@ bool dc_link_dp_perform_link_training_skip_aux( · 1 unmodified line | ||
| 2138 | 2144 | /* 2. Perform_channel_equalization_sequence. */ |
| 2139 | 2145 | |
| 2140 | 2146 | /* transmit training pattern for channel equalization. */ |
| 2141 | − dp_set_hw_training_pattern(link, lt_settings.pattern_for_eq, DPRX); | |
| 2147 | + dp_set_hw_training_pattern(link, link_res, lt_settings.pattern_for_eq, DPRX); | |
| 2142 | 2148 | |
| 2143 | 2149 | /* call HWSS to set lane settings*/ |
| 2144 | − dp_set_hw_lane_settings(link, <_settings, DPRX); | |
| 2150 | + dp_set_hw_lane_settings(link, link_res, <_settings, DPRX); | |
| 2145 | 2151 | |
| 2146 | 2152 | /* wait receiver to lock-on. */ |
| 2147 | 2153 | dp_wait_for_training_aux_rd_interval(link, lt_settings.eq_pattern_time); |
| @@ -2149,7 +2155,7 @@ bool dc_link_dp_perform_link_training_skip_aux( · 1 unmodified line | ||
| 2149 | 2155 | /* 3. Perform_link_training_int. */ |
| 2150 | 2156 | |
| 2151 | 2157 | /* Mainlink output idle pattern. */ |
| 2152 | − dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); | |
| 2158 | + dp_set_hw_test_pattern(link, link_res, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); | |
| 2153 | 2159 | |
| 2154 | 2160 | print_status_message(link, <_settings, LINK_TRAINING_SUCCESS); |
| 2155 | 2161 | |
| @@ -2230,6 +2236,7 @@ static void dpcd_128b_132b_get_aux_rd_interval(struct dc_link *link, · 74 unmodified lines | ||
| 2230 | 2236 | |
| 2231 | 2237 | static enum link_training_result dp_perform_128b_132b_channel_eq_done_sequence( |
| 2232 | 2238 | struct dc_link *link, |
| 2239 | + const struct link_resource *link_res, | |
| 2233 | 2240 | struct link_training_settings *lt_settings) |
| 2234 | 2241 | { |
| 2235 | 2242 | uint8_t loop_count; |
| @@ -2241,7 +2248,7 @@ static enum link_training_result dp_perform_128b_132b_channel_eq_done_sequence( · 5 unmodified lines | ||
| 2241 | 2248 | union lane_adjust dpcd_lane_adjust[LANE_COUNT_DP_MAX] = {0}; |
| 2242 | 2249 | |
| 2243 | 2250 | /* Transmit 128b/132b_TPS1 over Main-Link */ |
| 2244 | − dp_set_hw_training_pattern(link, lt_settings->pattern_for_cr, DPRX); | |
| 2251 | + dp_set_hw_training_pattern(link, link_res, lt_settings->pattern_for_cr, DPRX); | |
| 2245 | 2252 | /* Set TRAINING_PATTERN_SET to 01h */ |
| 2246 | 2253 | dpcd_set_training_pattern(link, lt_settings->pattern_for_cr); |
| 2247 | 2254 | |
| @@ -2251,8 +2258,8 @@ static enum link_training_result dp_perform_128b_132b_channel_eq_done_sequence( · 3 unmodified lines | ||
| 2251 | 2258 | &dpcd_lane_status_updated, dpcd_lane_adjust, DPRX); |
| 2252 | 2259 | dp_decide_lane_settings(lt_settings, dpcd_lane_adjust, |
| 2253 | 2260 | lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); |
| 2254 | − dp_set_hw_lane_settings(link, lt_settings, DPRX); | |
| 2255 | − dp_set_hw_training_pattern(link, lt_settings->pattern_for_eq, DPRX); | |
| 2261 | + dp_set_hw_lane_settings(link, link_res, lt_settings, DPRX); | |
| 2262 | + dp_set_hw_training_pattern(link, link_res, lt_settings->pattern_for_eq, DPRX); | |
| 2256 | 2263 | |
| 2257 | 2264 | /* Set loop counter to start from 1 */ |
| 2258 | 2265 | loop_count = 1; |
| @@ -2279,7 +2286,7 @@ static enum link_training_result dp_perform_128b_132b_channel_eq_done_sequence( · 20 unmodified lines | ||
| 2279 | 2286 | } else if (dpcd_lane_status_updated.bits.LT_FAILED_128b_132b) { |
| 2280 | 2287 | status = DP_128b_132b_LT_FAILED; |
| 2281 | 2288 | } else { |
| 2282 | − dp_set_hw_lane_settings(link, lt_settings, DPRX); | |
| 2289 | + dp_set_hw_lane_settings(link, link_res, lt_settings, DPRX); | |
| 2283 | 2290 | dpcd_set_lane_settings(link, lt_settings, DPRX); |
| 2284 | 2291 | } |
| 2285 | 2292 | loop_count++; |
| @@ -2308,6 +2315,7 @@ static enum link_training_result dp_perform_128b_132b_channel_eq_done_sequence( · 22 unmodified lines | ||
| 2308 | 2315 | |
| 2309 | 2316 | static enum link_training_result dp_perform_128b_132b_cds_done_sequence( |
| 2310 | 2317 | struct dc_link *link, |
| 2318 | + const struct link_resource *link_res, | |
| 2311 | 2319 | struct link_training_settings *lt_settings) |
| 2312 | 2320 | { |
| 2313 | 2321 | /* Assumption: assume hardware has transmitted eq pattern */ |
| @@ -2344,6 +2352,7 @@ static enum link_training_result dp_perform_128b_132b_cds_done_sequence( · 30 unmodified lines | ||
| 2344 | 2352 | |
| 2345 | 2353 | static enum link_training_result dp_perform_8b_10b_link_training( |
| 2346 | 2354 | struct dc_link *link, |
| 2355 | + const struct link_resource *link_res, | |
| 2347 | 2356 | struct link_training_settings *lt_settings) |
| 2348 | 2357 | { |
| 2349 | 2358 | enum link_training_result status = LINK_TRAINING_SUCCESS; |
| @@ -2353,7 +2362,7 @@ static enum link_training_result dp_perform_8b_10b_link_training( · 3 unmodified lines | ||
| 2353 | 2362 | uint8_t lane = 0; |
| 2354 | 2363 | |
| 2355 | 2364 | if (link->ctx->dc->work_arounds.lt_early_cr_pattern) |
| 2356 | − start_clock_recovery_pattern_early(link, lt_settings, DPRX); | |
| 2365 | + start_clock_recovery_pattern_early(link, link_res, lt_settings, DPRX); | |
| 2357 | 2366 | |
| 2358 | 2367 | /* 1. set link rate, lane count and spread. */ |
| 2359 | 2368 | dpcd_set_link_settings(link, lt_settings); |
| @@ -2367,12 +2376,13 @@ static enum link_training_result dp_perform_8b_10b_link_training( · 7 unmodified lines | ||
| 2367 | 2376 | |
| 2368 | 2377 | for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS); |
| 2369 | 2378 | repeater_id--) { |
| 2370 | − status = perform_clock_recovery_sequence(link, lt_settings, repeater_id); | |
| 2379 | + status = perform_clock_recovery_sequence(link, link_res, lt_settings, repeater_id); | |
| 2371 | 2380 | |
| 2372 | 2381 | if (status != LINK_TRAINING_SUCCESS) |
| 2373 | 2382 | break; |
| 2374 | 2383 | |
| 2375 | 2384 | status = perform_channel_equalization_sequence(link, |
| 2385 | + link_res, | |
| 2376 | 2386 | lt_settings, |
| 2377 | 2387 | repeater_id); |
| 2378 | 2388 | |
| @@ -2387,9 +2397,10 @@ static enum link_training_result dp_perform_8b_10b_link_training( · 8 unmodified lines | ||
| 2387 | 2397 | } |
| 2388 | 2398 | |
| 2389 | 2399 | if (status == LINK_TRAINING_SUCCESS) { |
| 2390 | − status = perform_clock_recovery_sequence(link, lt_settings, DPRX); | |
| 2400 | + status = perform_clock_recovery_sequence(link, link_res, lt_settings, DPRX); | |
| 2391 | 2401 | if (status == LINK_TRAINING_SUCCESS) { |
| 2392 | 2402 | status = perform_channel_equalization_sequence(link, |
| 2403 | + link_res, | |
| 2393 | 2404 | lt_settings, |
| 2394 | 2405 | DPRX); |
| 2395 | 2406 | } |
| @@ -2401,6 +2412,7 @@ static enum link_training_result dp_perform_8b_10b_link_training( · 5 unmodified lines | ||
| 2401 | 2412 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2402 | 2413 | static enum link_training_result dp_perform_128b_132b_link_training( |
| 2403 | 2414 | struct dc_link *link, |
| 2415 | + const struct link_resource *link_res, | |
| 2404 | 2416 | struct link_training_settings *lt_settings) |
| 2405 | 2417 | { |
| 2406 | 2418 | enum link_training_result result = LINK_TRAINING_SUCCESS; |
| @@ -2412,23 +2424,358 @@ static enum link_training_result dp_perform_128b_132b_link_training( · 5 unmodified lines | ||
| 2412 | 2424 | decide_8b_10b_training_settings(link, |
| 2413 | 2425 | <_settings->link_settings, |
| 2414 | 2426 | &legacy_settings); |
| 2415 | − return dp_perform_8b_10b_link_training(link, &legacy_settings); | |
| 2427 | + return dp_perform_8b_10b_link_training(link, link_res, &legacy_settings); | |
| 2416 | 2428 | } |
| 2417 | 2429 | |
| 2418 | 2430 | dpcd_set_link_settings(link, lt_settings); |
| 2419 | 2431 | |
| 2420 | 2432 | if (result == LINK_TRAINING_SUCCESS) |
| 2421 | − result = dp_perform_128b_132b_channel_eq_done_sequence(link, lt_settings); | |
| 2433 | + result = dp_perform_128b_132b_channel_eq_done_sequence(link, link_res, lt_settings); | |
| 2422 | 2434 | |
| 2423 | 2435 | if (result == LINK_TRAINING_SUCCESS) |
| 2424 | − result = dp_perform_128b_132b_cds_done_sequence(link, lt_settings); | |
| 2436 | + result = dp_perform_128b_132b_cds_done_sequence(link, link_res, lt_settings); | |
| 2425 | 2437 | |
| 2426 | 2438 | return result; |
| 2427 | 2439 | } |
| 2428 | 2440 | #endif |
| 2429 | 2441 | |
| 2442 | +static enum link_training_result dc_link_dp_perform_fixed_vs_pe_training_sequence( | |
| 2443 | + struct dc_link *link, | |
| 2444 | + const struct link_resource *link_res, | |
| 2445 | + struct link_training_settings *lt_settings) | |
| 2446 | +{ | |
| 2447 | + const uint8_t vendor_lttpr_write_data_reset[4] = {0x1, 0x50, 0x63, 0xFF}; | |
| 2448 | + const uint8_t offset = dp_convert_to_count( | |
| 2449 | + link->dpcd_caps.lttpr_caps.phy_repeater_cnt); | |
| 2450 | + const uint8_t vendor_lttpr_write_data_intercept_en[4] = {0x1, 0x55, 0x63, 0x0}; | |
| 2451 | + const uint8_t vendor_lttpr_write_data_intercept_dis[4] = {0x1, 0x55, 0x63, 0x68}; | |
| 2452 | + uint8_t vendor_lttpr_write_data_vs[4] = {0x1, 0x51, 0x63, 0x0}; | |
| 2453 | + uint8_t vendor_lttpr_write_data_pe[4] = {0x1, 0x52, 0x63, 0x0}; | |
| 2454 | + uint32_t vendor_lttpr_write_address = 0xF004F; | |
| 2455 | + enum link_training_result status = LINK_TRAINING_SUCCESS; | |
| 2456 | + uint8_t lane = 0; | |
| 2457 | + union down_spread_ctrl downspread = {0}; | |
| 2458 | + union lane_count_set lane_count_set = {0}; | |
| 2459 | + uint8_t toggle_rate; | |
| 2460 | + uint8_t rate; | |
| 2461 | + | |
| 2462 | + /* Only 8b/10b is supported */ | |
| 2463 | + ASSERT(dp_get_link_encoding_format(<_settings->link_settings) == | |
| 2464 | + DP_8b_10b_ENCODING); | |
| 2465 | + | |
| 2466 | + if (offset != 0xFF) { | |
| 2467 | + vendor_lttpr_write_address += | |
| 2468 | + ((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (offset - 1)); | |
| 2469 | + } | |
| 2470 | + | |
| 2471 | + /* Vendor specific: Reset lane settings */ | |
| 2472 | + core_link_write_dpcd( | |
| 2473 | + link, | |
| 2474 | + vendor_lttpr_write_address, | |
| 2475 | + &vendor_lttpr_write_data_reset[0], | |
| 2476 | + sizeof(vendor_lttpr_write_data_reset)); | |
| 2477 | + core_link_write_dpcd( | |
| 2478 | + link, | |
| 2479 | + vendor_lttpr_write_address, | |
| 2480 | + &vendor_lttpr_write_data_vs[0], | |
| 2481 | + sizeof(vendor_lttpr_write_data_vs)); | |
| 2482 | + core_link_write_dpcd( | |
| 2483 | + link, | |
| 2484 | + vendor_lttpr_write_address, | |
| 2485 | + &vendor_lttpr_write_data_pe[0], | |
| 2486 | + sizeof(vendor_lttpr_write_data_pe)); | |
| 2487 | + | |
| 2488 | + /* Vendor specific: Enable intercept */ | |
| 2489 | + core_link_write_dpcd( | |
| 2490 | + link, | |
| 2491 | + vendor_lttpr_write_address, | |
| 2492 | + &vendor_lttpr_write_data_intercept_en[0], | |
| 2493 | + sizeof(vendor_lttpr_write_data_intercept_en)); | |
| 2494 | + | |
| 2495 | + /* 1. set link rate, lane count and spread. */ | |
| 2496 | + | |
| 2497 | + downspread.raw = (uint8_t)(lt_settings->link_settings.link_spread); | |
| 2498 | + | |
| 2499 | + lane_count_set.bits.LANE_COUNT_SET = | |
| 2500 | + lt_settings->link_settings.lane_count; | |
| 2501 | + | |
| 2502 | + lane_count_set.bits.ENHANCED_FRAMING = lt_settings->enhanced_framing; | |
| 2503 | + lane_count_set.bits.POST_LT_ADJ_REQ_GRANTED = 0; | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + if (lt_settings->pattern_for_eq < DP_TRAINING_PATTERN_SEQUENCE_4) { | |
| 2507 | + lane_count_set.bits.POST_LT_ADJ_REQ_GRANTED = | |
| 2508 | + link->dpcd_caps.max_ln_count.bits.POST_LT_ADJ_REQ_SUPPORTED; | |
| 2509 | + } | |
| 2510 | + | |
| 2511 | + core_link_write_dpcd(link, DP_DOWNSPREAD_CTRL, | |
| 2512 | + &downspread.raw, sizeof(downspread)); | |
| 2513 | + | |
| 2514 | + core_link_write_dpcd(link, DP_LANE_COUNT_SET, | |
| 2515 | + &lane_count_set.raw, 1); | |
| 2516 | + | |
| 2517 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 2518 | + rate = get_dpcd_link_rate(<_settings->link_settings); | |
| 2519 | +#else | |
| 2520 | + rate = (uint8_t) (lt_settings->link_settings.link_rate); | |
| 2521 | +#endif | |
| 2522 | + | |
| 2523 | + /* Vendor specific: Toggle link rate */ | |
| 2524 | + toggle_rate = (rate == 0x6) ? 0xA : 0x6; | |
| 2525 | + | |
| 2526 | + if (link->vendor_specific_lttpr_link_rate_wa == rate) { | |
| 2527 | + core_link_write_dpcd( | |
| 2528 | + link, | |
| 2529 | + DP_LINK_BW_SET, | |
| 2530 | + &toggle_rate, | |
| 2531 | + 1); | |
| 2532 | + } | |
| 2533 | + | |
| 2534 | + link->vendor_specific_lttpr_link_rate_wa = rate; | |
| 2535 | + | |
| 2536 | + core_link_write_dpcd(link, DP_LINK_BW_SET, &rate, 1); | |
| 2537 | + | |
| 2538 | + DC_LOG_HW_LINK_TRAINING("%s\n %x rate = %x\n %x lane = %x framing = %x\n %x spread = %x\n", | |
| 2539 | + __func__, | |
| 2540 | + DP_LINK_BW_SET, | |
| 2541 | + lt_settings->link_settings.link_rate, | |
| 2542 | + DP_LANE_COUNT_SET, | |
| 2543 | + lt_settings->link_settings.lane_count, | |
| 2544 | + lt_settings->enhanced_framing, | |
| 2545 | + DP_DOWNSPREAD_CTRL, | |
| 2546 | + lt_settings->link_settings.link_spread); | |
| 2547 | + | |
| 2548 | + /* 2. Perform link training */ | |
| 2549 | + | |
| 2550 | + /* Perform Clock Recovery Sequence */ | |
| 2551 | + if (status == LINK_TRAINING_SUCCESS) { | |
| 2552 | + uint32_t retries_cr; | |
| 2553 | + uint32_t retry_count; | |
| 2554 | + uint32_t wait_time_microsec; | |
| 2555 | + enum dc_lane_count lane_count = lt_settings->link_settings.lane_count; | |
| 2556 | + union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX]; | |
| 2557 | + union lane_align_status_updated dpcd_lane_status_updated; | |
| 2558 | + union lane_adjust dpcd_lane_adjust[LANE_COUNT_DP_MAX] = {0}; | |
| 2559 | + | |
| 2560 | + retries_cr = 0; | |
| 2561 | + retry_count = 0; | |
| 2562 | + | |
| 2563 | + while ((retries_cr < LINK_TRAINING_MAX_RETRY_COUNT) && | |
| 2564 | + (retry_count < LINK_TRAINING_MAX_CR_RETRY)) { | |
| 2565 | + | |
| 2566 | + memset(&dpcd_lane_status, '\0', sizeof(dpcd_lane_status)); | |
| 2567 | + memset(&dpcd_lane_status_updated, '\0', | |
| 2568 | + sizeof(dpcd_lane_status_updated)); | |
| 2569 | + | |
| 2570 | + /* 1. call HWSS to set lane settings */ | |
| 2571 | + dp_set_hw_lane_settings( | |
| 2572 | + link, | |
| 2573 | + link_res, | |
| 2574 | + lt_settings, | |
| 2575 | + 0); | |
| 2576 | + | |
| 2577 | + /* 2. update DPCD of the receiver */ | |
| 2578 | + if (!retry_count) { | |
| 2579 | + /* EPR #361076 - write as a 5-byte burst, | |
| 2580 | + * but only for the 1-st iteration. | |
| 2581 | + */ | |
| 2582 | + dpcd_set_lt_pattern_and_lane_settings( | |
| 2583 | + link, | |
| 2584 | + lt_settings, | |
| 2585 | + lt_settings->pattern_for_cr, | |
| 2586 | + 0); | |
| 2587 | + /* Vendor specific: Disable intercept */ | |
| 2588 | + core_link_write_dpcd( | |
| 2589 | + link, | |
| 2590 | + vendor_lttpr_write_address, | |
| 2591 | + &vendor_lttpr_write_data_intercept_dis[0], | |
| 2592 | + sizeof(vendor_lttpr_write_data_intercept_dis)); | |
| 2593 | + } else { | |
| 2594 | + vendor_lttpr_write_data_vs[3] = 0; | |
| 2595 | + vendor_lttpr_write_data_pe[3] = 0; | |
| 2596 | + | |
| 2597 | + for (lane = 0; lane < lane_count; lane++) { | |
| 2598 | + vendor_lttpr_write_data_vs[3] |= | |
| 2599 | + lt_settings->dpcd_lane_settings[lane].bits.VOLTAGE_SWING_SET << (2 * lane); | |
| 2600 | + vendor_lttpr_write_data_pe[3] |= | |
| 2601 | + lt_settings->dpcd_lane_settings[lane].bits.PRE_EMPHASIS_SET << (2 * lane); | |
| 2602 | + } | |
| 2603 | + | |
| 2604 | + /* Vendor specific: Update VS and PE to DPRX requested value */ | |
| 2605 | + core_link_write_dpcd( | |
| 2606 | + link, | |
| 2607 | + vendor_lttpr_write_address, | |
| 2608 | + &vendor_lttpr_write_data_vs[0], | |
| 2609 | + sizeof(vendor_lttpr_write_data_vs)); | |
| 2610 | + core_link_write_dpcd( | |
| 2611 | + link, | |
| 2612 | + vendor_lttpr_write_address, | |
| 2613 | + &vendor_lttpr_write_data_pe[0], | |
| 2614 | + sizeof(vendor_lttpr_write_data_pe)); | |
| 2615 | + | |
| 2616 | + dpcd_set_lane_settings( | |
| 2617 | + link, | |
| 2618 | + lt_settings, | |
| 2619 | + 0); | |
| 2620 | + } | |
| 2621 | + | |
| 2622 | + /* 3. wait receiver to lock-on*/ | |
| 2623 | + wait_time_microsec = lt_settings->cr_pattern_time; | |
| 2624 | + | |
| 2625 | + dp_wait_for_training_aux_rd_interval( | |
| 2626 | + link, | |
| 2627 | + wait_time_microsec); | |
| 2628 | + | |
| 2629 | + /* 4. Read lane status and requested drive | |
| 2630 | + * settings as set by the sink | |
| 2631 | + */ | |
| 2632 | + dp_get_lane_status_and_lane_adjust( | |
| 2633 | + link, | |
| 2634 | + lt_settings, | |
| 2635 | + dpcd_lane_status, | |
| 2636 | + &dpcd_lane_status_updated, | |
| 2637 | + dpcd_lane_adjust, | |
| 2638 | + 0); | |
| 2639 | + | |
| 2640 | + /* 5. check CR done*/ | |
| 2641 | + if (dp_is_cr_done(lane_count, dpcd_lane_status)) { | |
| 2642 | + status = LINK_TRAINING_SUCCESS; | |
| 2643 | + break; | |
| 2644 | + } | |
| 2645 | + | |
| 2646 | + /* 6. max VS reached*/ | |
| 2647 | + if (dp_is_max_vs_reached(lt_settings)) | |
| 2648 | + break; | |
| 2649 | + | |
| 2650 | + /* 7. same lane settings */ | |
| 2651 | + /* Note: settings are the same for all lanes, | |
| 2652 | + * so comparing first lane is sufficient | |
| 2653 | + */ | |
| 2654 | + if (lt_settings->dpcd_lane_settings[0].bits.VOLTAGE_SWING_SET == | |
| 2655 | + dpcd_lane_adjust[0].bits.VOLTAGE_SWING_LANE) | |
| 2656 | + retries_cr++; | |
| 2657 | + else | |
| 2658 | + retries_cr = 0; | |
| 2659 | + | |
| 2660 | + /* 8. update VS/PE/PC2 in lt_settings*/ | |
| 2661 | + dp_decide_lane_settings(lt_settings, dpcd_lane_adjust, | |
| 2662 | + lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); | |
| 2663 | + retry_count++; | |
| 2664 | + } | |
| 2665 | + | |
| 2666 | + if (retry_count >= LINK_TRAINING_MAX_CR_RETRY) { | |
| 2667 | + ASSERT(0); | |
| 2668 | + DC_LOG_ERROR("%s: Link Training Error, could not get CR after %d tries. Possibly voltage swing issue", | |
| 2669 | + __func__, | |
| 2670 | + LINK_TRAINING_MAX_CR_RETRY); | |
| 2671 | + | |
| 2672 | + } | |
| 2673 | + | |
| 2674 | + status = dp_get_cr_failure(lane_count, dpcd_lane_status); | |
| 2675 | + } | |
| 2676 | + | |
| 2677 | + /* Perform Channel EQ Sequence */ | |
| 2678 | + if (status == LINK_TRAINING_SUCCESS) { | |
| 2679 | + enum dc_dp_training_pattern tr_pattern; | |
| 2680 | + uint32_t retries_ch_eq; | |
| 2681 | + uint32_t wait_time_microsec; | |
| 2682 | + enum dc_lane_count lane_count = lt_settings->link_settings.lane_count; | |
| 2683 | + union lane_align_status_updated dpcd_lane_status_updated = {0}; | |
| 2684 | + union lane_status dpcd_lane_status[LANE_COUNT_DP_MAX] = {0}; | |
| 2685 | + union lane_adjust dpcd_lane_adjust[LANE_COUNT_DP_MAX] = {0}; | |
| 2686 | + | |
| 2687 | + /* Note: also check that TPS4 is a supported feature*/ | |
| 2688 | + tr_pattern = lt_settings->pattern_for_eq; | |
| 2689 | + | |
| 2690 | + dp_set_hw_training_pattern(link, link_res, tr_pattern, 0); | |
| 2691 | + | |
| 2692 | + status = LINK_TRAINING_EQ_FAIL_EQ; | |
| 2693 | + | |
| 2694 | + for (retries_ch_eq = 0; retries_ch_eq <= LINK_TRAINING_MAX_RETRY_COUNT; | |
| 2695 | + retries_ch_eq++) { | |
| 2696 | + | |
| 2697 | + dp_set_hw_lane_settings(link, link_res, lt_settings, 0); | |
| 2698 | + | |
| 2699 | + vendor_lttpr_write_data_vs[3] = 0; | |
| 2700 | + vendor_lttpr_write_data_pe[3] = 0; | |
| 2701 | + | |
| 2702 | + for (lane = 0; lane < lane_count; lane++) { | |
| 2703 | + vendor_lttpr_write_data_vs[3] |= | |
| 2704 | + lt_settings->dpcd_lane_settings[lane].bits.VOLTAGE_SWING_SET << (2 * lane); | |
| 2705 | + vendor_lttpr_write_data_pe[3] |= | |
| 2706 | + lt_settings->dpcd_lane_settings[lane].bits.PRE_EMPHASIS_SET << (2 * lane); | |
| 2707 | + } | |
| 2708 | + | |
| 2709 | + /* Vendor specific: Update VS and PE to DPRX requested value */ | |
| 2710 | + core_link_write_dpcd( | |
| 2711 | + link, | |
| 2712 | + vendor_lttpr_write_address, | |
| 2713 | + &vendor_lttpr_write_data_vs[0], | |
| 2714 | + sizeof(vendor_lttpr_write_data_vs)); | |
| 2715 | + core_link_write_dpcd( | |
| 2716 | + link, | |
| 2717 | + vendor_lttpr_write_address, | |
| 2718 | + &vendor_lttpr_write_data_pe[0], | |
| 2719 | + sizeof(vendor_lttpr_write_data_pe)); | |
| 2720 | + | |
| 2721 | + /* 2. update DPCD*/ | |
| 2722 | + if (!retries_ch_eq) | |
| 2723 | + /* EPR #361076 - write as a 5-byte burst, | |
| 2724 | + * but only for the 1-st iteration | |
| 2725 | + */ | |
| 2726 | + | |
| 2727 | + dpcd_set_lt_pattern_and_lane_settings( | |
| 2728 | + link, | |
| 2729 | + lt_settings, | |
| 2730 | + tr_pattern, 0); | |
| 2731 | + else | |
| 2732 | + dpcd_set_lane_settings(link, lt_settings, 0); | |
| 2733 | + | |
| 2734 | + /* 3. wait for receiver to lock-on*/ | |
| 2735 | + wait_time_microsec = lt_settings->eq_pattern_time; | |
| 2736 | + | |
| 2737 | + dp_wait_for_training_aux_rd_interval( | |
| 2738 | + link, | |
| 2739 | + wait_time_microsec); | |
| 2740 | + | |
| 2741 | + /* 4. Read lane status and requested | |
| 2742 | + * drive settings as set by the sink | |
| 2743 | + */ | |
| 2744 | + dp_get_lane_status_and_lane_adjust( | |
| 2745 | + link, | |
| 2746 | + lt_settings, | |
| 2747 | + dpcd_lane_status, | |
| 2748 | + &dpcd_lane_status_updated, | |
| 2749 | + dpcd_lane_adjust, | |
| 2750 | + 0); | |
| 2751 | + | |
| 2752 | + /* 5. check CR done*/ | |
| 2753 | + if (!dp_is_cr_done(lane_count, dpcd_lane_status)) { | |
| 2754 | + status = LINK_TRAINING_EQ_FAIL_CR; | |
| 2755 | + break; | |
| 2756 | + } | |
| 2757 | + | |
| 2758 | + /* 6. check CHEQ done*/ | |
| 2759 | + if (dp_is_ch_eq_done(lane_count, dpcd_lane_status) && | |
| 2760 | + dp_is_symbol_locked(lane_count, dpcd_lane_status) && | |
| 2761 | + dp_is_interlane_aligned(dpcd_lane_status_updated)) { | |
| 2762 | + status = LINK_TRAINING_SUCCESS; | |
| 2763 | + break; | |
| 2764 | + } | |
| 2765 | + | |
| 2766 | + /* 7. update VS/PE/PC2 in lt_settings*/ | |
| 2767 | + dp_decide_lane_settings(lt_settings, dpcd_lane_adjust, | |
| 2768 | + lt_settings->hw_lane_settings, lt_settings->dpcd_lane_settings); | |
| 2769 | + } | |
| 2770 | + } | |
| 2771 | + | |
| 2772 | + return status; | |
| 2773 | +} | |
| 2774 | + | |
| 2775 | + | |
| 2430 | 2776 | enum link_training_result dc_link_dp_perform_link_training( |
| 2431 | 2777 | struct dc_link *link, |
| 2778 | + const struct link_resource *link_res, | |
| 2432 | 2779 | const struct dc_link_settings *link_settings, |
| 2433 | 2780 | bool skip_video_pattern) |
| 2434 | 2781 | { |
| @@ -2459,18 +2806,22 @@ enum link_training_result dc_link_dp_perform_link_training( · 24 unmodified lines | ||
| 2459 | 2806 | |
| 2460 | 2807 | /* configure link prior to entering training mode */ |
| 2461 | 2808 | dpcd_configure_lttpr_mode(link, <_settings); |
| 2462 | − dp_set_fec_ready(link, lt_settings.should_set_fec_ready); | |
| 2809 | + dp_set_fec_ready(link, link_res, lt_settings.should_set_fec_ready); | |
| 2463 | 2810 | dpcd_configure_channel_coding(link, <_settings); |
| 2464 | 2811 | |
| 2465 | 2812 | /* enter training mode: |
| 2466 | 2813 | * Per DP specs starting from here, DPTX device shall not issue |
| 2467 | 2814 | * Non-LT AUX transactions inside training mode. |
| 2468 | 2815 | */ |
| 2469 | − if (encoding == DP_8b_10b_ENCODING) | |
| 2470 | − status = dp_perform_8b_10b_link_training(link, <_settings); | |
| 2816 | + if (!link->dc->debug.apply_vendor_specific_lttpr_wa && | |
| 2817 | + (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN) && | |
| 2818 | + link->lttpr_mode == LTTPR_MODE_TRANSPARENT) | |
| 2819 | + status = dc_link_dp_perform_fixed_vs_pe_training_sequence(link, link_res, <_settings); | |
| 2820 | + else if (encoding == DP_8b_10b_ENCODING) | |
| 2821 | + status = dp_perform_8b_10b_link_training(link, link_res, <_settings); | |
| 2471 | 2822 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2472 | 2823 | else if (encoding == DP_128b_132b_ENCODING) |
| 2473 | − status = dp_perform_128b_132b_link_training(link, <_settings); | |
| 2824 | + status = dp_perform_128b_132b_link_training(link, link_res, <_settings); | |
| 2474 | 2825 | #endif |
| 2475 | 2826 | else |
| 2476 | 2827 | ASSERT(0); |
| @@ -2488,6 +2839,7 @@ enum link_training_result dc_link_dp_perform_link_training( · 11 unmodified lines | ||
| 2488 | 2839 | /* switch to video idle */ |
| 2489 | 2840 | if ((status == LINK_TRAINING_SUCCESS) || !skip_video_pattern) |
| 2490 | 2841 | status = dp_transition_to_video_idle(link, |
| 2842 | + link_res, | |
| 2491 | 2843 | <_settings, |
| 2492 | 2844 | status); |
| 2493 | 2845 | |
| @@ -2539,6 +2891,7 @@ bool perform_link_training_with_retries( · 45 unmodified lines | ||
| 2539 | 2891 | |
| 2540 | 2892 | dp_enable_link_phy( |
| 2541 | 2893 | link, |
| 2894 | + &pipe_ctx->link_res, | |
| 2542 | 2895 | signal, |
| 2543 | 2896 | pipe_ctx->clock_source->id, |
| 2544 | 2897 | ¤t_setting); |
| @@ -2566,23 +2919,24 @@ bool perform_link_training_with_retries( · 21 unmodified lines | ||
| 2566 | 2919 | dp_set_panel_mode(link, panel_mode); |
| 2567 | 2920 | |
| 2568 | 2921 | if (link->aux_access_disabled) { |
| 2569 | − dc_link_dp_perform_link_training_skip_aux(link, ¤t_setting); | |
| 2922 | + dc_link_dp_perform_link_training_skip_aux(link, &pipe_ctx->link_res, ¤t_setting); | |
| 2570 | 2923 | return true; |
| 2571 | 2924 | } else { |
| 2572 | 2925 | /** @todo Consolidate USB4 DP and DPx.x training. */ |
| 2573 | 2926 | if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) { |
| 2574 | 2927 | status = dc_link_dpia_perform_link_training(link, |
| 2575 | − ¤t_setting, | |
| 2576 | − skip_video_pattern); | |
| 2928 | + &pipe_ctx->link_res, | |
| 2929 | + ¤t_setting, | |
| 2930 | + skip_video_pattern); | |
| 2577 | 2931 | |
| 2578 | 2932 | /* Transmit idle pattern once training successful. */ |
| 2579 | 2933 | if (status == LINK_TRAINING_SUCCESS) |
| 2580 | − dp_set_hw_test_pattern(link, DP_TEST_PATTERN_VIDEO_MODE, | |
| 2581 | − NULL, 0); | |
| 2934 | + dp_set_hw_test_pattern(link, &pipe_ctx->link_res, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); | |
| 2582 | 2935 | } else { |
| 2583 | 2936 | status = dc_link_dp_perform_link_training(link, |
| 2584 | − ¤t_setting, | |
| 2585 | − skip_video_pattern); | |
| 2937 | + &pipe_ctx->link_res, | |
| 2938 | + ¤t_setting, | |
| 2939 | + skip_video_pattern); | |
| 2586 | 2940 | } |
| 2587 | 2941 | |
| 2588 | 2942 | if (status == LINK_TRAINING_SUCCESS) |
| @@ -2597,7 +2951,7 @@ bool perform_link_training_with_retries( · 8 unmodified lines | ||
| 2597 | 2951 | DC_LOG_WARNING("%s: Link training attempt %u of %d failed\n", |
| 2598 | 2952 | __func__, (unsigned int)j + 1, attempts); |
| 2599 | 2953 | |
| 2600 | − dp_disable_link_phy(link, signal); | |
| 2954 | + dp_disable_link_phy(link, &pipe_ctx->link_res, signal); | |
| 2601 | 2955 | |
| 2602 | 2956 | /* Abort link training if failure due to sink being unplugged. */ |
| 2603 | 2957 | if (status == LINK_TRAINING_ABORT) { |
| @@ -2646,12 +3000,13 @@ static enum clock_source_id get_clock_source_id(struct dc_link *link) · 42 unmodified lines | ||
| 2646 | 3000 | return dp_cs_id; |
| 2647 | 3001 | } |
| 2648 | 3002 | |
| 2649 | −static void set_dp_mst_mode(struct dc_link *link, bool mst_enable) | |
| 3003 | +static void set_dp_mst_mode(struct dc_link *link, const struct link_resource *link_res, | |
| 3004 | + bool mst_enable) | |
| 2650 | 3005 | { |
| 2651 | 3006 | if (mst_enable == false && |
| 2652 | 3007 | link->type == dc_connection_mst_branch) { |
| 2653 | 3008 | /* Disable MST on link. Use only local sink. */ |
| 2654 | − dp_disable_link_phy_mst(link, link->connector_signal); | |
| 3009 | + dp_disable_link_phy_mst(link, link_res, link->connector_signal); | |
| 2655 | 3010 | |
| 2656 | 3011 | link->type = dc_connection_single; |
| 2657 | 3012 | link->local_sink = link->remote_sinks[0]; |
| @@ -2662,7 +3017,7 @@ static void set_dp_mst_mode(struct dc_link *link, bool mst_enable) · 4 unmodified lines | ||
| 2662 | 3017 | link->type == dc_connection_single && |
| 2663 | 3018 | link->remote_sinks[0] != NULL) { |
| 2664 | 3019 | /* Re-enable MST on link. */ |
| 2665 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3020 | + dp_disable_link_phy(link, link_res, link->connector_signal); | |
| 2666 | 3021 | dp_enable_mst_on_sink(link, true); |
| 2667 | 3022 | |
| 2668 | 3023 | link->type = dc_connection_mst_branch; |
| @@ -2688,6 +3043,7 @@ bool dc_link_dp_sync_lt_begin(struct dc_link *link) · 19 unmodified lines | ||
| 2688 | 3043 | |
| 2689 | 3044 | enum link_training_result dc_link_dp_sync_lt_attempt( |
| 2690 | 3045 | struct dc_link *link, |
| 3046 | + const struct link_resource *link_res, | |
| 2691 | 3047 | struct dc_link_settings *link_settings, |
| 2692 | 3048 | struct dc_link_training_overrides *lt_overrides) |
| 2693 | 3049 | { |
| @@ -2707,14 +3063,14 @@ enum link_training_result dc_link_dp_sync_lt_attempt( · 13 unmodified lines | ||
| 2707 | 3063 | <_settings); |
| 2708 | 3064 | /* Setup MST Mode */ |
| 2709 | 3065 | if (lt_overrides->mst_enable) |
| 2710 | − set_dp_mst_mode(link, *lt_overrides->mst_enable); | |
| 3066 | + set_dp_mst_mode(link, link_res, *lt_overrides->mst_enable); | |
| 2711 | 3067 | |
| 2712 | 3068 | /* Disable link */ |
| 2713 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3069 | + dp_disable_link_phy(link, link_res, link->connector_signal); | |
| 2714 | 3070 | |
| 2715 | 3071 | /* Enable link */ |
| 2716 | 3072 | dp_cs_id = get_clock_source_id(link); |
| 2717 | − dp_enable_link_phy(link, link->connector_signal, | |
| 3073 | + dp_enable_link_phy(link, link_res, link->connector_signal, | |
| 2718 | 3074 | dp_cs_id, link_settings); |
| 2719 | 3075 | |
| 2720 | 3076 | /* Set FEC enable */ |
| @@ -2722,7 +3078,7 @@ enum link_training_result dc_link_dp_sync_lt_attempt( · 1 unmodified line | ||
| 2722 | 3078 | if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING) { |
| 2723 | 3079 | #endif |
| 2724 | 3080 | fec_enable = lt_overrides->fec_enable && *lt_overrides->fec_enable; |
| 2725 | − dp_set_fec_ready(link, fec_enable); | |
| 3081 | + dp_set_fec_ready(link, NULL, fec_enable); | |
| 2726 | 3082 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2727 | 3083 | } |
| 2728 | 3084 | #endif |
| @@ -2739,7 +3095,7 @@ enum link_training_result dc_link_dp_sync_lt_attempt( · 10 unmodified lines | ||
| 2739 | 3095 | |
| 2740 | 3096 | /* Attempt to train with given link training settings */ |
| 2741 | 3097 | if (link->ctx->dc->work_arounds.lt_early_cr_pattern) |
| 2742 | − start_clock_recovery_pattern_early(link, <_settings, DPRX); | |
| 3098 | + start_clock_recovery_pattern_early(link, link_res, <_settings, DPRX); | |
| 2743 | 3099 | |
| 2744 | 3100 | /* Set link rate, lane count and spread. */ |
| 2745 | 3101 | dpcd_set_link_settings(link, <_settings); |
| @@ -2747,9 +3103,10 @@ enum link_training_result dc_link_dp_sync_lt_attempt( · 1 unmodified line | ||
| 2747 | 3103 | /* 2. perform link training (set link training done |
| 2748 | 3104 | * to false is done as well) |
| 2749 | 3105 | */ |
| 2750 | − lt_status = perform_clock_recovery_sequence(link, <_settings, DPRX); | |
| 3106 | + lt_status = perform_clock_recovery_sequence(link, link_res, <_settings, DPRX); | |
| 2751 | 3107 | if (lt_status == LINK_TRAINING_SUCCESS) { |
| 2752 | 3108 | lt_status = perform_channel_equalization_sequence(link, |
| 3109 | + link_res, | |
| 2753 | 3110 | <_settings, |
| 2754 | 3111 | DPRX); |
| 2755 | 3112 | } |
| @@ -2770,11 +3127,11 @@ bool dc_link_dp_sync_lt_end(struct dc_link *link, bool link_down) · 14 unmodified lines | ||
| 2770 | 3127 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2771 | 3128 | struct dc_link_settings link_settings = link->cur_link_settings; |
| 2772 | 3129 | #endif |
| 2773 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3130 | + dp_disable_link_phy(link, NULL, link->connector_signal); | |
| 2774 | 3131 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2775 | 3132 | if (dp_get_link_encoding_format(&link_settings) == DP_8b_10b_ENCODING) |
| 2776 | 3133 | #endif |
| 2777 | − dp_set_fec_ready(link, false); | |
| 3134 | + dp_set_fec_ready(link, NULL, false); | |
| 2778 | 3135 | } |
| 2779 | 3136 | |
| 2780 | 3137 | link->sync_lt_in_progress = false; |
| @@ -2829,7 +3186,8 @@ bool dc_link_dp_get_max_link_enc_cap(const struct dc_link *link, struct dc_link_ · 48 unmodified lines | ||
| 2829 | 3186 | return false; |
| 2830 | 3187 | } |
| 2831 | 3188 | |
| 2832 | −static struct dc_link_settings get_max_link_cap(struct dc_link *link) | |
| 3189 | +static struct dc_link_settings get_max_link_cap(struct dc_link *link, | |
| 3190 | + const struct link_resource *link_res) | |
| 2833 | 3191 | { |
| 2834 | 3192 | struct dc_link_settings max_link_cap = {0}; |
| 2835 | 3193 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| @@ -2853,9 +3211,11 @@ static struct dc_link_settings get_max_link_cap(struct dc_link *link) · 17 unmodified lines | ||
| 2853 | 3211 | if (link_enc) |
| 2854 | 3212 | link_enc->funcs->get_max_link_cap(link_enc, &max_link_cap); |
| 2855 | 3213 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2856 | − if (max_link_cap.link_rate >= LINK_RATE_UHBR10 && | |
| 2857 | − !link->hpo_dp_link_enc) | |
| 2858 | − max_link_cap.link_rate = LINK_RATE_HIGH3; | |
| 3214 | + if (max_link_cap.link_rate >= LINK_RATE_UHBR10) { | |
| 3215 | + if (!link_res->hpo_dp_link_enc || | |
| 3216 | + link->dc->debug.disable_uhbr) | |
| 3217 | + max_link_cap.link_rate = LINK_RATE_HIGH3; | |
| 3218 | + } | |
| 2859 | 3219 | #endif |
| 2860 | 3220 | |
| 2861 | 3221 | /* Lower link settings based on sink's link cap */ |
| @@ -2873,7 +3233,7 @@ static struct dc_link_settings get_max_link_cap(struct dc_link *link) · 11 unmodified lines | ||
| 2873 | 3233 | * account for lttpr repeaters cap |
| 2874 | 3234 | * notes: repeaters do not snoop in the DPRX Capabilities addresses (3.6.3). |
| 2875 | 3235 | */ |
| 2876 | − if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) { | |
| 3236 | + if (link->lttpr_mode != LTTPR_MODE_NON_LTTPR) { | |
| 2877 | 3237 | if (link->dpcd_caps.lttpr_caps.max_lane_count < max_link_cap.lane_count) |
| 2878 | 3238 | max_link_cap.lane_count = link->dpcd_caps.lttpr_caps.max_lane_count; |
| 2879 | 3239 | |
| @@ -3012,6 +3372,7 @@ bool hpd_rx_irq_check_link_loss_status( · 132 unmodified lines | ||
| 3012 | 3372 | |
| 3013 | 3373 | bool dp_verify_link_cap( |
| 3014 | 3374 | struct dc_link *link, |
| 3375 | + const struct link_resource *link_res, | |
| 3015 | 3376 | struct dc_link_settings *known_limit_link_setting, |
| 3016 | 3377 | int *fail_count) |
| 3017 | 3378 | { |
| @@ -3029,7 +3390,7 @@ bool dp_verify_link_cap( · 11 unmodified lines | ||
| 3029 | 3390 | /* link training starts with the maximum common settings |
| 3030 | 3391 | * supported by both sink and ASIC. |
| 3031 | 3392 | */ |
| 3032 | − max_link_cap = get_max_link_cap(link); | |
| 3393 | + max_link_cap = get_max_link_cap(link, link_res); | |
| 3033 | 3394 | initial_link_settings = get_common_supported_link_settings( |
| 3034 | 3395 | *known_limit_link_setting, |
| 3035 | 3396 | max_link_cap); |
| @@ -3069,7 +3430,7 @@ bool dp_verify_link_cap( · 33 unmodified lines | ||
| 3069 | 3430 | * find the physical link capability |
| 3070 | 3431 | */ |
| 3071 | 3432 | /* disable PHY done possible by BIOS, will be done by driver itself */ |
| 3072 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3433 | + dp_disable_link_phy(link, link_res, link->connector_signal); | |
| 3073 | 3434 | |
| 3074 | 3435 | dp_cs_id = get_clock_source_id(link); |
| 3075 | 3436 | |
| @@ -3081,8 +3442,8 @@ bool dp_verify_link_cap( · 5 unmodified lines | ||
| 3081 | 3442 | */ |
| 3082 | 3443 | if (link->link_enc && link->link_enc->features.flags.bits.DP_IS_USB_C && |
| 3083 | 3444 | link->dc->debug.usbc_combo_phy_reset_wa) { |
| 3084 | − dp_enable_link_phy(link, link->connector_signal, dp_cs_id, cur); | |
| 3085 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3445 | + dp_enable_link_phy(link, link_res, link->connector_signal, dp_cs_id, cur); | |
| 3446 | + dp_disable_link_phy(link, link_res, link->connector_signal); | |
| 3086 | 3447 | } |
| 3087 | 3448 | |
| 3088 | 3449 | do { |
| @@ -3093,6 +3454,7 @@ bool dp_verify_link_cap( · 4 unmodified lines | ||
| 3093 | 3454 | |
| 3094 | 3455 | dp_enable_link_phy( |
| 3095 | 3456 | link, |
| 3457 | + link_res, | |
| 3096 | 3458 | link->connector_signal, |
| 3097 | 3459 | dp_cs_id, |
| 3098 | 3460 | cur); |
| @@ -3103,6 +3465,7 @@ bool dp_verify_link_cap( · 4 unmodified lines | ||
| 3103 | 3465 | else { |
| 3104 | 3466 | status = dc_link_dp_perform_link_training( |
| 3105 | 3467 | link, |
| 3468 | + link_res, | |
| 3106 | 3469 | cur, |
| 3107 | 3470 | skip_video_pattern); |
| 3108 | 3471 | if (status == LINK_TRAINING_SUCCESS) |
| @@ -3124,7 +3487,7 @@ bool dp_verify_link_cap( · 15 unmodified lines | ||
| 3124 | 3487 | * setting or before returning we'll enable it later |
| 3125 | 3488 | * based on the actual mode we're driving |
| 3126 | 3489 | */ |
| 3127 | − dp_disable_link_phy(link, link->connector_signal); | |
| 3490 | + dp_disable_link_phy(link, link_res, link->connector_signal); | |
| 3128 | 3491 | } while (!success && decide_fallback_link_setting(link, |
| 3129 | 3492 | initial_link_settings, cur, status)); |
| 3130 | 3493 | |
| @@ -3148,6 +3511,7 @@ bool dp_verify_link_cap( · 17 unmodified lines | ||
| 3148 | 3511 | |
| 3149 | 3512 | bool dp_verify_link_cap_with_retries( |
| 3150 | 3513 | struct dc_link *link, |
| 3514 | + const struct link_resource *link_res, | |
| 3151 | 3515 | struct dc_link_settings *known_limit_link_setting, |
| 3152 | 3516 | int attempts) |
| 3153 | 3517 | { |
| @@ -3165,7 +3529,7 @@ bool dp_verify_link_cap_with_retries( · 11 unmodified lines | ||
| 3165 | 3529 | link->verified_link_cap.link_rate = LINK_RATE_LOW; |
| 3166 | 3530 | link->verified_link_cap.link_spread = LINK_SPREAD_DISABLED; |
| 3167 | 3531 | break; |
| 3168 | − } else if (dp_verify_link_cap(link, | |
| 3532 | + } else if (dp_verify_link_cap(link, link_res, | |
| 3169 | 3533 | known_limit_link_setting, |
| 3170 | 3534 | &fail_count) && fail_count == 0) { |
| 3171 | 3535 | success = true; |
| @@ -3177,13 +3541,13 @@ bool dp_verify_link_cap_with_retries( · 5 unmodified lines | ||
| 3177 | 3541 | } |
| 3178 | 3542 | |
| 3179 | 3543 | bool dp_verify_mst_link_cap( |
| 3180 | − struct dc_link *link) | |
| 3544 | + struct dc_link *link, const struct link_resource *link_res) | |
| 3181 | 3545 | { |
| 3182 | 3546 | struct dc_link_settings max_link_cap = {0}; |
| 3183 | 3547 | |
| 3184 | 3548 | if (dp_get_link_encoding_format(&link->reported_link_cap) == |
| 3185 | 3549 | DP_8b_10b_ENCODING) { |
| 3186 | − max_link_cap = get_max_link_cap(link); | |
| 3550 | + max_link_cap = get_max_link_cap(link, link_res); | |
| 3187 | 3551 | link->verified_link_cap = get_common_supported_link_settings( |
| 3188 | 3552 | link->reported_link_cap, |
| 3189 | 3553 | max_link_cap); |
| @@ -3192,6 +3556,7 @@ bool dp_verify_mst_link_cap( · 2 unmodified lines | ||
| 3192 | 3556 | else if (dp_get_link_encoding_format(&link->reported_link_cap) == |
| 3193 | 3557 | DP_128b_132b_ENCODING) { |
| 3194 | 3558 | dp_verify_link_cap_with_retries(link, |
| 3559 | + link_res, | |
| 3195 | 3560 | &link->reported_link_cap, |
| 3196 | 3561 | LINK_TRAINING_MAX_VERIFY_RETRY); |
| 3197 | 3562 | } |
| @@ -5720,7 +6085,7 @@ bool dc_link_dp_set_test_pattern( · 2522 unmodified lines | ||
| 5720 | 6085 | DP_TEST_PATTERN_VIDEO_MODE) { |
| 5721 | 6086 | /* Set CRTC Test Pattern */ |
| 5722 | 6087 | set_crtc_test_pattern(link, pipe_ctx, test_pattern, test_pattern_color_space); |
| 5723 | − dp_set_hw_test_pattern(link, test_pattern, | |
| 6088 | + dp_set_hw_test_pattern(link, &pipe_ctx->link_res, test_pattern, | |
| 5724 | 6089 | (uint8_t *)p_custom_pattern, |
| 5725 | 6090 | (uint32_t)cust_pattern_size); |
| 5726 | 6091 | |
| @@ -5751,7 +6116,7 @@ bool dc_link_dp_set_test_pattern( · 24 unmodified lines | ||
| 5751 | 6116 | p_link_settings->dpcd_lane_settings, |
| 5752 | 6117 | p_link_settings->link_settings.lane_count); |
| 5753 | 6118 | } else { |
| 5754 | − dp_set_hw_lane_settings(link, p_link_settings, DPRX); | |
| 6119 | + dp_set_hw_lane_settings(link, &pipe_ctx->link_res, p_link_settings, DPRX); | |
| 5755 | 6120 | dpcd_set_lane_settings(link, p_link_settings, DPRX); |
| 5756 | 6121 | } |
| 5757 | 6122 | } |
| @@ -5766,7 +6131,7 @@ bool dc_link_dp_set_test_pattern( · 8 unmodified lines | ||
| 5766 | 6131 | pipes->stream_res.stream_enc->funcs->dp_blank(link, pipe_ctx->stream_res.stream_enc); |
| 5767 | 6132 | } |
| 5768 | 6133 | |
| 5769 | − dp_set_hw_test_pattern(link, test_pattern, | |
| 6134 | + dp_set_hw_test_pattern(link, &pipe_ctx->link_res, test_pattern, | |
| 5770 | 6135 | (uint8_t *)p_custom_pattern, |
| 5771 | 6136 | (uint32_t)cust_pattern_size); |
| 5772 | 6137 | |
| @@ -6086,7 +6451,7 @@ enum dp_panel_mode dp_get_panel_mode(struct dc_link *link) · 313 unmodified lines | ||
| 6086 | 6451 | return DP_PANEL_MODE_DEFAULT; |
| 6087 | 6452 | } |
| 6088 | 6453 | |
| 6089 | −enum dc_status dp_set_fec_ready(struct dc_link *link, bool ready) | |
| 6454 | +enum dc_status dp_set_fec_ready(struct dc_link *link, const struct link_resource *link_res, bool ready) | |
| 6090 | 6455 | { |
| 6091 | 6456 | /* FEC has to be "set ready" before the link training. |
| 6092 | 6457 | * The policy is to always train with FEC |
| @@ -6653,8 +7018,10 @@ struct fixed31_32 calculate_sst_avg_time_slots_per_mtp( · 560 unmodified lines | ||
| 6653 | 7018 | |
| 6654 | 7019 | bool is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx) |
| 6655 | 7020 | { |
| 7021 | + /* If this assert is hit then we have a link encoder dynamic management issue */ | |
| 7022 | + ASSERT(pipe_ctx->stream_res.hpo_dp_stream_enc ? pipe_ctx->link_res.hpo_dp_link_enc != NULL : true); | |
| 6656 | 7023 | return (pipe_ctx->stream_res.hpo_dp_stream_enc && |
| 6657 | − pipe_ctx->stream->link->hpo_dp_link_enc && | |
| 7024 | + pipe_ctx->link_res.hpo_dp_link_enc && | |
| 6658 | 7025 | dc_is_dp_signal(pipe_ctx->stream->signal)); |
| 6659 | 7026 | } |
| 6660 | 7027 | #endif |
| @@ -77,7 +77,9 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link) · 76 unmodified lines | ||
| 77 | 77 | * @param[in] link_setting Lane count, link rate and downspread control. |
| 78 | 78 | * @param[out] lt_settings Link settings and drive settings (voltage swing and pre-emphasis). |
| 79 | 79 | */ |
| 80 | −static enum link_training_result dpia_configure_link(struct dc_link *link, | |
| 80 | +static enum link_training_result dpia_configure_link( | |
| 81 | + struct dc_link *link, | |
| 82 | + const struct link_resource *link_res, | |
| 81 | 83 | const struct dc_link_settings *link_setting, |
| 82 | 84 | struct link_training_settings *lt_settings) |
| 83 | 85 | { |
| @@ -111,7 +113,7 @@ static enum link_training_result dpia_configure_link(struct dc_link *link, · 27 unmodified lines | ||
| 111 | 113 | fec_enable = *link->preferred_training_settings.fec_enable; |
| 112 | 114 | else |
| 113 | 115 | fec_enable = true; |
| 114 | − status = dp_set_fec_ready(link, fec_enable); | |
| 116 | + status = dp_set_fec_ready(link, link_res, fec_enable); | |
| 115 | 117 | if (status != DC_OK && link->is_hpd_pending) |
| 116 | 118 | return LINK_TRAINING_ABORT; |
| 117 | 119 | |
| @@ -252,7 +254,9 @@ static enum dc_status dpcd_set_lt_pattern(struct dc_link *link, · 134 unmodified lines | ||
| 252 | 254 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 253 | 255 | * @param hop The Hop in display path. DPRX = 0. |
| 254 | 256 | */ |
| 255 | −static enum link_training_result dpia_training_cr_non_transparent(struct dc_link *link, | |
| 257 | +static enum link_training_result dpia_training_cr_non_transparent( | |
| 258 | + struct dc_link *link, | |
| 259 | + const struct link_resource *link_res, | |
| 256 | 260 | struct link_training_settings *lt_settings, |
| 257 | 261 | uint32_t hop) |
| 258 | 262 | { |
| @@ -411,7 +415,9 @@ static enum link_training_result dpia_training_cr_non_transparent(struct dc_link · 152 unmodified lines | ||
| 411 | 415 | * @param link DPIA link being trained. |
| 412 | 416 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 413 | 417 | */ |
| 414 | −static enum link_training_result dpia_training_cr_transparent(struct dc_link *link, | |
| 418 | +static enum link_training_result dpia_training_cr_transparent( | |
| 419 | + struct dc_link *link, | |
| 420 | + const struct link_resource *link_res, | |
| 415 | 421 | struct link_training_settings *lt_settings) |
| 416 | 422 | { |
| 417 | 423 | enum link_training_result result = LINK_TRAINING_CR_FAIL_LANE0; |
| @@ -511,16 +517,18 @@ static enum link_training_result dpia_training_cr_transparent(struct dc_link *li · 93 unmodified lines | ||
| 511 | 517 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 512 | 518 | * @param hop The Hop in display path. DPRX = 0. |
| 513 | 519 | */ |
| 514 | −static enum link_training_result dpia_training_cr_phase(struct dc_link *link, | |
| 520 | +static enum link_training_result dpia_training_cr_phase( | |
| 521 | + struct dc_link *link, | |
| 522 | + const struct link_resource *link_res, | |
| 515 | 523 | struct link_training_settings *lt_settings, |
| 516 | 524 | uint32_t hop) |
| 517 | 525 | { |
| 518 | 526 | enum link_training_result result = LINK_TRAINING_CR_FAIL_LANE0; |
| 519 | 527 | |
| 520 | 528 | if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) |
| 521 | − result = dpia_training_cr_non_transparent(link, lt_settings, hop); | |
| 529 | + result = dpia_training_cr_non_transparent(link, link_res, lt_settings, hop); | |
| 522 | 530 | else |
| 523 | − result = dpia_training_cr_transparent(link, lt_settings); | |
| 531 | + result = dpia_training_cr_transparent(link, link_res, lt_settings); | |
| 524 | 532 | |
| 525 | 533 | return result; |
| 526 | 534 | } |
| @@ -561,7 +569,9 @@ static uint32_t dpia_get_eq_aux_rd_interval(const struct dc_link *link, · 34 unmodified lines | ||
| 561 | 569 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 562 | 570 | * @param hop The Hop in display path. DPRX = 0. |
| 563 | 571 | */ |
| 564 | −static enum link_training_result dpia_training_eq_non_transparent(struct dc_link *link, | |
| 572 | +static enum link_training_result dpia_training_eq_non_transparent( | |
| 573 | + struct dc_link *link, | |
| 574 | + const struct link_resource *link_res, | |
| 565 | 575 | struct link_training_settings *lt_settings, |
| 566 | 576 | uint32_t hop) |
| 567 | 577 | { |
| @@ -700,7 +710,9 @@ static enum link_training_result dpia_training_eq_non_transparent(struct dc_link · 132 unmodified lines | ||
| 700 | 710 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 701 | 711 | * @param hop The Hop in display path. DPRX = 0. |
| 702 | 712 | */ |
| 703 | −static enum link_training_result dpia_training_eq_transparent(struct dc_link *link, | |
| 713 | +static enum link_training_result dpia_training_eq_transparent( | |
| 714 | + struct dc_link *link, | |
| 715 | + const struct link_resource *link_res, | |
| 704 | 716 | struct link_training_settings *lt_settings) |
| 705 | 717 | { |
| 706 | 718 | enum link_training_result result = LINK_TRAINING_EQ_FAIL_EQ; |
| @@ -779,16 +791,18 @@ static enum link_training_result dpia_training_eq_transparent(struct dc_link *li · 72 unmodified lines | ||
| 779 | 791 | * @param lt_settings link_setting and drive settings (voltage swing and pre-emphasis). |
| 780 | 792 | * @param hop The Hop in display path. DPRX = 0. |
| 781 | 793 | */ |
| 782 | −static enum link_training_result dpia_training_eq_phase(struct dc_link *link, | |
| 794 | +static enum link_training_result dpia_training_eq_phase( | |
| 795 | + struct dc_link *link, | |
| 796 | + const struct link_resource *link_res, | |
| 783 | 797 | struct link_training_settings *lt_settings, |
| 784 | 798 | uint32_t hop) |
| 785 | 799 | { |
| 786 | 800 | enum link_training_result result; |
| 787 | 801 | |
| 788 | 802 | if (link->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) |
| 789 | − result = dpia_training_eq_non_transparent(link, lt_settings, hop); | |
| 803 | + result = dpia_training_eq_non_transparent(link, link_res, lt_settings, hop); | |
| 790 | 804 | else |
| 791 | − result = dpia_training_eq_transparent(link, lt_settings); | |
| 805 | + result = dpia_training_eq_transparent(link, link_res, lt_settings); | |
| 792 | 806 | |
| 793 | 807 | return result; |
| 794 | 808 | } |
| @@ -908,7 +922,9 @@ static void dpia_training_abort(struct dc_link *link, uint32_t hop) · 113 unmodified lines | ||
| 908 | 922 | core_link_send_set_config(link, DPIA_SET_CFG_SET_LINK, data); |
| 909 | 923 | } |
| 910 | 924 | |
| 911 | −enum link_training_result dc_link_dpia_perform_link_training(struct dc_link *link, | |
| 925 | +enum link_training_result dc_link_dpia_perform_link_training( | |
| 926 | + struct dc_link *link, | |
| 927 | + const struct link_resource *link_res, | |
| 912 | 928 | const struct dc_link_settings *link_setting, |
| 913 | 929 | bool skip_video_pattern) |
| 914 | 930 | { |
| @@ -918,7 +934,7 @@ enum link_training_result dc_link_dpia_perform_link_training(struct dc_link *lin · 3 unmodified lines | ||
| 918 | 934 | int8_t repeater_id; /* Current hop. */ |
| 919 | 935 | |
| 920 | 936 | /* Configure link as prescribed in link_setting and set LTTPR mode. */ |
| 921 | − result = dpia_configure_link(link, link_setting, <_settings); | |
| 937 | + result = dpia_configure_link(link, link_res, link_setting, <_settings); | |
| 922 | 938 | if (result != LINK_TRAINING_SUCCESS) |
| 923 | 939 | return result; |
| 924 | 940 | |
| @@ -930,12 +946,12 @@ enum link_training_result dc_link_dpia_perform_link_training(struct dc_link *lin · 5 unmodified lines | ||
| 930 | 946 | */ |
| 931 | 947 | for (repeater_id = repeater_cnt; repeater_id >= 0; repeater_id--) { |
| 932 | 948 | /* Clock recovery. */ |
| 933 | − result = dpia_training_cr_phase(link, <_settings, repeater_id); | |
| 949 | + result = dpia_training_cr_phase(link, link_res, <_settings, repeater_id); | |
| 934 | 950 | if (result != LINK_TRAINING_SUCCESS) |
| 935 | 951 | break; |
| 936 | 952 | |
| 937 | 953 | /* Equalization. */ |
| 938 | − result = dpia_training_eq_phase(link, <_settings, repeater_id); | |
| 954 | + result = dpia_training_eq_phase(link, link_res, <_settings, repeater_id); | |
| 939 | 955 | if (result != LINK_TRAINING_SUCCESS) |
| 940 | 956 | break; |
| 941 | 957 | |
| @@ -71,6 +71,7 @@ void dp_source_sequence_trace(struct dc_link *link, uint8_t dp_test_mode) · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | void dp_enable_link_phy( |
| 73 | 73 | struct dc_link *link, |
| 74 | + const struct link_resource *link_res, | |
| 74 | 75 | enum signal_type signal, |
| 75 | 76 | enum clock_source_id clock_source, |
| 76 | 77 | const struct dc_link_settings *link_settings) |
| @@ -135,7 +136,7 @@ void dp_enable_link_phy( · 58 unmodified lines | ||
| 135 | 136 | |
| 136 | 137 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 137 | 138 | if (dp_get_link_encoding_format(link_settings) == DP_128b_132b_ENCODING) { |
| 138 | − enable_dp_hpo_output(link, link_settings); | |
| 139 | + enable_dp_hpo_output(link, link_res, link_settings); | |
| 139 | 140 | } else if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING) { |
| 140 | 141 | if (dc_is_dp_sst_signal(signal)) { |
| 141 | 142 | link_enc->funcs->enable_dp_output( |
| @@ -236,12 +237,13 @@ bool edp_receiver_ready_T7(struct dc_link *link) · 94 unmodified lines | ||
| 236 | 237 | return result; |
| 237 | 238 | } |
| 238 | 239 | |
| 239 | −void dp_disable_link_phy(struct dc_link *link, enum signal_type signal) | |
| 240 | +void dp_disable_link_phy(struct dc_link *link, const struct link_resource *link_res, | |
| 241 | + enum signal_type signal) | |
| 240 | 242 | { |
| 241 | 243 | struct dc *dc = link->ctx->dc; |
| 242 | 244 | struct dmcu *dmcu = dc->res_pool->dmcu; |
| 243 | 245 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 244 | − struct hpo_dp_link_encoder *hpo_link_enc = link->hpo_dp_link_enc; | |
| 246 | + struct hpo_dp_link_encoder *hpo_link_enc = link_res->hpo_dp_link_enc; | |
| 245 | 247 | #endif |
| 246 | 248 | struct link_encoder *link_enc; |
| 247 | 249 | |
| @@ -260,7 +262,7 @@ void dp_disable_link_phy(struct dc_link *link, enum signal_type signal) · 12 unmodified lines | ||
| 260 | 262 | link->dc->hwss.edp_backlight_control(link, false); |
| 261 | 263 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 262 | 264 | if (dp_get_link_encoding_format(&link->cur_link_settings) == DP_128b_132b_ENCODING) |
| 263 | − disable_dp_hpo_output(link, signal); | |
| 265 | + disable_dp_hpo_output(link, link_res, signal); | |
| 264 | 266 | else |
| 265 | 267 | link_enc->funcs->disable_output(link_enc, signal); |
| 266 | 268 | #else |
| @@ -274,7 +276,7 @@ void dp_disable_link_phy(struct dc_link *link, enum signal_type signal) · 7 unmodified lines | ||
| 274 | 276 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 275 | 277 | if (dp_get_link_encoding_format(&link->cur_link_settings) == DP_128b_132b_ENCODING && |
| 276 | 278 | hpo_link_enc) |
| 277 | − disable_dp_hpo_output(link, signal); | |
| 279 | + disable_dp_hpo_output(link, link_res, signal); | |
| 278 | 280 | else |
| 279 | 281 | link_enc->funcs->disable_output(link_enc, signal); |
| 280 | 282 | #else |
| @@ -294,13 +296,14 @@ void dp_disable_link_phy(struct dc_link *link, enum signal_type signal) · 13 unmodified lines | ||
| 294 | 296 | dc->clk_mgr->funcs->notify_link_rate_change(dc->clk_mgr, link); |
| 295 | 297 | } |
| 296 | 298 | |
| 297 | −void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal) | |
| 299 | +void dp_disable_link_phy_mst(struct dc_link *link, const struct link_resource *link_res, | |
| 300 | + enum signal_type signal) | |
| 298 | 301 | { |
| 299 | 302 | /* MST disable link only when no stream use the link */ |
| 300 | 303 | if (link->mst_stream_alloc_table.stream_count > 0) |
| 301 | 304 | return; |
| 302 | 305 | |
| 303 | − dp_disable_link_phy(link, signal); | |
| 306 | + dp_disable_link_phy(link, link_res, signal); | |
| 304 | 307 | |
| 305 | 308 | /* set the sink to SST mode after disabling the link */ |
| 306 | 309 | dp_enable_mst_on_sink(link, false); |
| @@ -308,6 +311,7 @@ void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal) · 1 unmodified line | ||
| 308 | 311 | |
| 309 | 312 | bool dp_set_hw_training_pattern( |
| 310 | 313 | struct dc_link *link, |
| 314 | + const struct link_resource *link_res, | |
| 311 | 315 | enum dc_dp_training_pattern pattern, |
| 312 | 316 | uint32_t offset) |
| 313 | 317 | { |
| @@ -338,7 +342,7 @@ bool dp_set_hw_training_pattern( · 24 unmodified lines | ||
| 338 | 342 | break; |
| 339 | 343 | } |
| 340 | 344 | |
| 341 | − dp_set_hw_test_pattern(link, test_pattern, NULL, 0); | |
| 345 | + dp_set_hw_test_pattern(link, link_res, test_pattern, NULL, 0); | |
| 342 | 346 | |
| 343 | 347 | return true; |
| 344 | 348 | } |
| @@ -349,6 +353,7 @@ bool dp_set_hw_training_pattern( · 4 unmodified lines | ||
| 349 | 353 | #endif |
| 350 | 354 | void dp_set_hw_lane_settings( |
| 351 | 355 | struct dc_link *link, |
| 356 | + const struct link_resource *link_res, | |
| 352 | 357 | const struct link_training_settings *link_settings, |
| 353 | 358 | uint32_t offset) |
| 354 | 359 | { |
| @@ -361,8 +366,8 @@ void dp_set_hw_lane_settings( · 6 unmodified lines | ||
| 361 | 366 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 362 | 367 | if (dp_get_link_encoding_format(&link_settings->link_settings) == |
| 363 | 368 | DP_128b_132b_ENCODING) { |
| 364 | − link->hpo_dp_link_enc->funcs->set_ffe( | |
| 365 | − link->hpo_dp_link_enc, | |
| 369 | + link_res->hpo_dp_link_enc->funcs->set_ffe( | |
| 370 | + link_res->hpo_dp_link_enc, | |
| 366 | 371 | &link_settings->link_settings, |
| 367 | 372 | link_settings->lane_settings[0].FFE_PRESET.raw); |
| 368 | 373 | } else if (dp_get_link_encoding_format(&link_settings->link_settings) |
| @@ -379,6 +384,7 @@ void dp_set_hw_lane_settings( · 10 unmodified lines | ||
| 379 | 384 | |
| 380 | 385 | void dp_set_hw_test_pattern( |
| 381 | 386 | struct dc_link *link, |
| 387 | + const struct link_resource *link_res, | |
| 382 | 388 | enum dp_test_pattern test_pattern, |
| 383 | 389 | uint8_t *custom_pattern, |
| 384 | 390 | uint32_t custom_pattern_size) |
| @@ -406,8 +412,8 @@ void dp_set_hw_test_pattern( · 21 unmodified lines | ||
| 406 | 412 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 407 | 413 | switch (link_encoding_format) { |
| 408 | 414 | case DP_128b_132b_ENCODING: |
| 409 | − link->hpo_dp_link_enc->funcs->set_link_test_pattern( | |
| 410 | − link->hpo_dp_link_enc, &pattern_param); | |
| 415 | + link_res->hpo_dp_link_enc->funcs->set_link_test_pattern( | |
| 416 | + link_res->hpo_dp_link_enc, &pattern_param); | |
| 411 | 417 | break; |
| 412 | 418 | case DP_8b_10b_ENCODING: |
| 413 | 419 | ASSERT(encoder); |
| @@ -446,7 +452,7 @@ void dp_retrain_link_dp_test(struct dc_link *link, · 32 unmodified lines | ||
| 446 | 452 | pipes[i].stream_res.stream_enc); |
| 447 | 453 | |
| 448 | 454 | /* disable any test pattern that might be active */ |
| 449 | − dp_set_hw_test_pattern(link, | |
| 455 | + dp_set_hw_test_pattern(link, &pipes[i].link_res, | |
| 450 | 456 | DP_TEST_PATTERN_VIDEO_MODE, NULL, 0); |
| 451 | 457 | |
| 452 | 458 | dp_receiver_power_ctrl(link, false); |
| @@ -763,7 +769,9 @@ static enum phyd32clk_clock_source get_phyd32clk_src(struct dc_link *link) · 310 unmodified lines | ||
| 763 | 769 | } |
| 764 | 770 | } |
| 765 | 771 | |
| 766 | −void enable_dp_hpo_output(struct dc_link *link, const struct dc_link_settings *link_settings) | |
| 772 | +void enable_dp_hpo_output(struct dc_link *link, | |
| 773 | + const struct link_resource *link_res, | |
| 774 | + const struct dc_link_settings *link_settings) | |
| 767 | 775 | { |
| 768 | 776 | const struct dc *dc = link->dc; |
| 769 | 777 | enum phyd32clk_clock_source phyd32clk; |
| @@ -789,10 +797,11 @@ void enable_dp_hpo_output(struct dc_link *link, const struct dc_link_settings *l · 19 unmodified lines | ||
| 789 | 797 | } |
| 790 | 798 | } else { |
| 791 | 799 | /* DP2.0 HW: call transmitter control to enable PHY */ |
| 792 | − link->hpo_dp_link_enc->funcs->enable_link_phy( | |
| 793 | − link->hpo_dp_link_enc, | |
| 800 | + link_res->hpo_dp_link_enc->funcs->enable_link_phy( | |
| 801 | + link_res->hpo_dp_link_enc, | |
| 794 | 802 | link_settings, |
| 795 | − link->link_enc->transmitter); | |
| 803 | + link->link_enc->transmitter, | |
| 804 | + link->link_enc->hpd_source); | |
| 796 | 805 | } |
| 797 | 806 | |
| 798 | 807 | /* DCCG muxing and DTBCLK DTO */ |
| @@ -806,24 +815,26 @@ void enable_dp_hpo_output(struct dc_link *link, const struct dc_link_settings *l · 7 unmodified lines | ||
| 806 | 815 | phyd32clk = get_phyd32clk_src(link); |
| 807 | 816 | dc->res_pool->dccg->funcs->enable_symclk32_le( |
| 808 | 817 | dc->res_pool->dccg, |
| 809 | − link->hpo_dp_link_enc->inst, | |
| 818 | + link_res->hpo_dp_link_enc->inst, | |
| 810 | 819 | phyd32clk); |
| 811 | − link->hpo_dp_link_enc->funcs->link_enable( | |
| 812 | − link->hpo_dp_link_enc, | |
| 813 | − link_settings->lane_count); | |
| 820 | + link_res->hpo_dp_link_enc->funcs->link_enable( | |
| 821 | + link_res->hpo_dp_link_enc, | |
| 822 | + link_settings->lane_count); | |
| 814 | 823 | } |
| 815 | 824 | } |
| 816 | 825 | |
| 817 | −void disable_dp_hpo_output(struct dc_link *link, enum signal_type signal) | |
| 826 | +void disable_dp_hpo_output(struct dc_link *link, | |
| 827 | + const struct link_resource *link_res, | |
| 828 | + enum signal_type signal) | |
| 818 | 829 | { |
| 819 | 830 | const struct dc *dc = link->dc; |
| 820 | 831 | |
| 821 | − link->hpo_dp_link_enc->funcs->link_disable(link->hpo_dp_link_enc); | |
| 832 | + link_res->hpo_dp_link_enc->funcs->link_disable(link_res->hpo_dp_link_enc); | |
| 822 | 833 | |
| 823 | 834 | if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) { |
| 824 | 835 | dc->res_pool->dccg->funcs->disable_symclk32_le( |
| 825 | 836 | dc->res_pool->dccg, |
| 826 | − link->hpo_dp_link_enc->inst); | |
| 837 | + link_res->hpo_dp_link_enc->inst); | |
| 827 | 838 | |
| 828 | 839 | dc->res_pool->dccg->funcs->set_physymclk( |
| 829 | 840 | dc->res_pool->dccg, |
| @@ -834,8 +845,8 @@ void disable_dp_hpo_output(struct dc_link *link, enum signal_type signal) · 4 unmodified lines | ||
| 834 | 845 | dm_set_phyd32clk(dc->ctx, 0); |
| 835 | 846 | } else { |
| 836 | 847 | /* DP2.0 HW: call transmitter control to disable PHY */ |
| 837 | − link->hpo_dp_link_enc->funcs->disable_link_phy( | |
| 838 | − link->hpo_dp_link_enc, | |
| 848 | + link_res->hpo_dp_link_enc->funcs->disable_link_phy( | |
| 849 | + link_res->hpo_dp_link_enc, | |
| 839 | 850 | signal); |
| 840 | 851 | } |
| 841 | 852 | } |
| @@ -734,10 +734,6 @@ static void calculate_split_count_and_index(struct pipe_ctx *pipe_ctx, int *spli · 733 unmodified lines | ||
| 734 | 734 | (*split_idx)++; |
| 735 | 735 | split_pipe = split_pipe->top_pipe; |
| 736 | 736 | } |
| 737 | − | |
| 738 | − /* MPO window on right side of ODM split */ | |
| 739 | − if (split_pipe && split_pipe->prev_odm_pipe && !pipe_ctx->prev_odm_pipe) | |
| 740 | − (*split_idx)++; | |
| 741 | 737 | } else { |
| 742 | 738 | /*Get odm split index*/ |
| 743 | 739 | struct pipe_ctx *split_pipe = pipe_ctx->prev_odm_pipe; |
| @@ -784,11 +780,7 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx) · 40 unmodified lines | ||
| 784 | 780 | /* |
| 785 | 781 | * Only the leftmost ODM pipe should be offset by a nonzero distance |
| 786 | 782 | */ |
| 787 | − if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->prev_odm_pipe && !pipe_ctx->prev_odm_pipe) { | |
| 788 | − /* MPO window on right side of ODM split */ | |
| 789 | − data->recout.x = stream->dst.x + (surf_clip.x - stream->dst.width/2) * | |
| 790 | − stream->dst.width / stream->src.width; | |
| 791 | − } else if (!pipe_ctx->prev_odm_pipe || split_idx == split_count) { | |
| 783 | + if (!pipe_ctx->prev_odm_pipe || split_idx == split_count) { | |
| 792 | 784 | data->recout.x = stream->dst.x; |
| 793 | 785 | if (stream->src.x < surf_clip.x) |
| 794 | 786 | data->recout.x += (surf_clip.x - stream->src.x) * stream->dst.width |
| @@ -986,8 +978,6 @@ static void calculate_inits_and_viewports(struct pipe_ctx *pipe_ctx) · 191 unmodified lines | ||
| 986 | 978 | * stream->dst.height / stream->src.height; |
| 987 | 979 | if (pipe_ctx->prev_odm_pipe && split_idx) |
| 988 | 980 | ro_lb = data->h_active * split_idx - recout_full_x; |
| 989 | − else if (pipe_ctx->top_pipe && pipe_ctx->top_pipe->prev_odm_pipe) | |
| 990 | − ro_lb = data->h_active * split_idx - recout_full_x + data->recout.x; | |
| 991 | 981 | else |
| 992 | 982 | ro_lb = data->recout.x - recout_full_x; |
| 993 | 983 | ro_tb = data->recout.y - recout_full_y; |
| @@ -1086,9 +1076,6 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) · 92 unmodified lines | ||
| 1086 | 1076 | timing->v_border_top + timing->v_border_bottom; |
| 1087 | 1077 | if (pipe_ctx->next_odm_pipe || pipe_ctx->prev_odm_pipe) |
| 1088 | 1078 | pipe_ctx->plane_res.scl_data.h_active /= get_num_odm_splits(pipe_ctx) + 1; |
| 1089 | − /* ODM + windows MPO, where window is on either right or left ODM half */ | |
| 1090 | − else if (pipe_ctx->top_pipe && (pipe_ctx->top_pipe->next_odm_pipe || pipe_ctx->top_pipe->prev_odm_pipe)) | |
| 1091 | − pipe_ctx->plane_res.scl_data.h_active /= get_num_odm_splits(pipe_ctx->top_pipe) + 1; | |
| 1092 | 1079 | |
| 1093 | 1080 | /* depends on h_active */ |
| 1094 | 1081 | calculate_recout(pipe_ctx); |
| @@ -1097,6 +1084,11 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) · 2 unmodified lines | ||
| 1097 | 1084 | /* depends on scaling ratios and recout, does not calculate offset yet */ |
| 1098 | 1085 | calculate_viewport_size(pipe_ctx); |
| 1099 | 1086 | |
| 1087 | + /* Stopgap for validation of ODM + MPO on one side of screen case */ | |
| 1088 | + if (pipe_ctx->plane_res.scl_data.viewport.height < 1 || | |
| 1089 | + pipe_ctx->plane_res.scl_data.viewport.width < 1) | |
| 1090 | + return false; | |
| 1091 | + | |
| 1100 | 1092 | /* |
| 1101 | 1093 | * LB calculations depend on vp size, h/v_active and scaling ratios |
| 1102 | 1094 | * Setting line buffer pixel depth to 24bpp yields banding |
| @@ -1445,54 +1437,23 @@ bool dc_add_plane_to_context( · 342 unmodified lines | ||
| 1445 | 1437 | if (head_pipe != free_pipe) { |
| 1446 | 1438 | tail_pipe = resource_get_tail_pipe(&context->res_ctx, head_pipe); |
| 1447 | 1439 | ASSERT(tail_pipe); |
| 1448 | − | |
| 1449 | − /* ODM + window MPO, where MPO window is on right half only */ | |
| 1450 | − if (free_pipe->plane_state && | |
| 1451 | − (free_pipe->plane_state->clip_rect.x >= free_pipe->stream->src.width/2) && | |
| 1452 | − tail_pipe->next_odm_pipe) { | |
| 1453 | − free_pipe->stream_res.tg = tail_pipe->next_odm_pipe->stream_res.tg; | |
| 1454 | − free_pipe->stream_res.abm = tail_pipe->next_odm_pipe->stream_res.abm; | |
| 1455 | − free_pipe->stream_res.opp = tail_pipe->next_odm_pipe->stream_res.opp; | |
| 1456 | − free_pipe->stream_res.stream_enc = tail_pipe->next_odm_pipe->stream_res.stream_enc; | |
| 1457 | − free_pipe->stream_res.audio = tail_pipe->next_odm_pipe->stream_res.audio; | |
| 1458 | − free_pipe->clock_source = tail_pipe->next_odm_pipe->clock_source; | |
| 1459 | − | |
| 1460 | − free_pipe->top_pipe = tail_pipe->next_odm_pipe; | |
| 1461 | − tail_pipe->next_odm_pipe->bottom_pipe = free_pipe; | |
| 1462 | − } else { | |
| 1463 | − free_pipe->stream_res.tg = tail_pipe->stream_res.tg; | |
| 1464 | − free_pipe->stream_res.abm = tail_pipe->stream_res.abm; | |
| 1465 | − free_pipe->stream_res.opp = tail_pipe->stream_res.opp; | |
| 1466 | − free_pipe->stream_res.stream_enc = tail_pipe->stream_res.stream_enc; | |
| 1467 | − free_pipe->stream_res.audio = tail_pipe->stream_res.audio; | |
| 1468 | − free_pipe->clock_source = tail_pipe->clock_source; | |
| 1469 | − | |
| 1470 | − free_pipe->top_pipe = tail_pipe; | |
| 1471 | − tail_pipe->bottom_pipe = free_pipe; | |
| 1472 | − | |
| 1473 | − if (!free_pipe->next_odm_pipe && tail_pipe->next_odm_pipe && tail_pipe->next_odm_pipe->bottom_pipe) { | |
| 1474 | − free_pipe->next_odm_pipe = tail_pipe->next_odm_pipe->bottom_pipe; | |
| 1475 | − tail_pipe->next_odm_pipe->bottom_pipe->prev_odm_pipe = free_pipe; | |
| 1476 | − } | |
| 1477 | − if (!free_pipe->prev_odm_pipe && tail_pipe->prev_odm_pipe && tail_pipe->prev_odm_pipe->bottom_pipe) { | |
| 1478 | − free_pipe->prev_odm_pipe = tail_pipe->prev_odm_pipe->bottom_pipe; | |
| 1479 | − tail_pipe->prev_odm_pipe->bottom_pipe->next_odm_pipe = free_pipe; | |
| 1480 | − } | |
| 1440 | + free_pipe->stream_res.tg = tail_pipe->stream_res.tg; | |
| 1441 | + free_pipe->stream_res.abm = tail_pipe->stream_res.abm; | |
| 1442 | + free_pipe->stream_res.opp = tail_pipe->stream_res.opp; | |
| 1443 | + free_pipe->stream_res.stream_enc = tail_pipe->stream_res.stream_enc; | |
| 1444 | + free_pipe->stream_res.audio = tail_pipe->stream_res.audio; | |
| 1445 | + free_pipe->clock_source = tail_pipe->clock_source; | |
| 1446 | + free_pipe->top_pipe = tail_pipe; | |
| 1447 | + tail_pipe->bottom_pipe = free_pipe; | |
| 1448 | + if (!free_pipe->next_odm_pipe && tail_pipe->next_odm_pipe && tail_pipe->next_odm_pipe->bottom_pipe) { | |
| 1449 | + free_pipe->next_odm_pipe = tail_pipe->next_odm_pipe->bottom_pipe; | |
| 1450 | + tail_pipe->next_odm_pipe->bottom_pipe->prev_odm_pipe = free_pipe; | |
| 1451 | + } | |
| 1452 | + if (!free_pipe->prev_odm_pipe && tail_pipe->prev_odm_pipe && tail_pipe->prev_odm_pipe->bottom_pipe) { | |
| 1453 | + free_pipe->prev_odm_pipe = tail_pipe->prev_odm_pipe->bottom_pipe; | |
| 1454 | + tail_pipe->prev_odm_pipe->bottom_pipe->next_odm_pipe = free_pipe; | |
| 1481 | 1455 | } |
| 1482 | 1456 | } |
| 1483 | − | |
| 1484 | − /* ODM + window MPO, where MPO window is on left half only */ | |
| 1485 | − if (free_pipe->plane_state && | |
| 1486 | − (free_pipe->plane_state->clip_rect.x + free_pipe->plane_state->clip_rect.width <= | |
| 1487 | − free_pipe->stream->src.x + free_pipe->stream->src.width/2)) { | |
| 1488 | − break; | |
| 1489 | − } | |
| 1490 | − /* ODM + window MPO, where MPO window is on right half only */ | |
| 1491 | − if (free_pipe->plane_state && | |
| 1492 | − (free_pipe->plane_state->clip_rect.x >= free_pipe->stream->src.width/2)) { | |
| 1493 | − break; | |
| 1494 | − } | |
| 1495 | − | |
| 1496 | 1457 | head_pipe = head_pipe->next_odm_pipe; |
| 1497 | 1458 | } |
| 1498 | 1459 | /* assign new surfaces*/ |
| @@ -1763,6 +1724,94 @@ static void update_hpo_dp_stream_engine_usage( · 264 unmodified lines | ||
| 1763 | 1724 | res_ctx->is_hpo_dp_stream_enc_acquired[i] = acquired; |
| 1764 | 1725 | } |
| 1765 | 1726 | } |
| 1727 | + | |
| 1728 | +static inline int find_acquired_hpo_dp_link_enc_for_link( | |
| 1729 | + const struct resource_context *res_ctx, | |
| 1730 | + const struct dc_link *link) | |
| 1731 | +{ | |
| 1732 | + int i; | |
| 1733 | + | |
| 1734 | + for (i = 0; i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_to_link_idx); i++) | |
| 1735 | + if (res_ctx->hpo_dp_link_enc_ref_cnts[i] > 0 && | |
| 1736 | + res_ctx->hpo_dp_link_enc_to_link_idx[i] == link->link_index) | |
| 1737 | + return i; | |
| 1738 | + | |
| 1739 | + return -1; | |
| 1740 | +} | |
| 1741 | + | |
| 1742 | +static inline int find_free_hpo_dp_link_enc(const struct resource_context *res_ctx, | |
| 1743 | + const struct resource_pool *pool) | |
| 1744 | +{ | |
| 1745 | + int i; | |
| 1746 | + | |
| 1747 | + for (i = 0; i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_ref_cnts); i++) | |
| 1748 | + if (res_ctx->hpo_dp_link_enc_ref_cnts[i] == 0) | |
| 1749 | + break; | |
| 1750 | + | |
| 1751 | + return (i < ARRAY_SIZE(res_ctx->hpo_dp_link_enc_ref_cnts) && | |
| 1752 | + i < pool->hpo_dp_link_enc_count) ? i : -1; | |
| 1753 | +} | |
| 1754 | + | |
| 1755 | +static inline void acquire_hpo_dp_link_enc( | |
| 1756 | + struct resource_context *res_ctx, | |
| 1757 | + unsigned int link_index, | |
| 1758 | + int enc_index) | |
| 1759 | +{ | |
| 1760 | + res_ctx->hpo_dp_link_enc_to_link_idx[enc_index] = link_index; | |
| 1761 | + res_ctx->hpo_dp_link_enc_ref_cnts[enc_index] = 1; | |
| 1762 | +} | |
| 1763 | + | |
| 1764 | +static inline void retain_hpo_dp_link_enc( | |
| 1765 | + struct resource_context *res_ctx, | |
| 1766 | + int enc_index) | |
| 1767 | +{ | |
| 1768 | + res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]++; | |
| 1769 | +} | |
| 1770 | + | |
| 1771 | +static inline void release_hpo_dp_link_enc( | |
| 1772 | + struct resource_context *res_ctx, | |
| 1773 | + int enc_index) | |
| 1774 | +{ | |
| 1775 | + ASSERT(res_ctx->hpo_dp_link_enc_ref_cnts[enc_index] > 0); | |
| 1776 | + res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]--; | |
| 1777 | +} | |
| 1778 | + | |
| 1779 | +static bool add_hpo_dp_link_enc_to_ctx(struct resource_context *res_ctx, | |
| 1780 | + const struct resource_pool *pool, | |
| 1781 | + struct pipe_ctx *pipe_ctx, | |
| 1782 | + struct dc_stream_state *stream) | |
| 1783 | +{ | |
| 1784 | + int enc_index; | |
| 1785 | + | |
| 1786 | + enc_index = find_acquired_hpo_dp_link_enc_for_link(res_ctx, stream->link); | |
| 1787 | + | |
| 1788 | + if (enc_index >= 0) { | |
| 1789 | + retain_hpo_dp_link_enc(res_ctx, enc_index); | |
| 1790 | + } else { | |
| 1791 | + enc_index = find_free_hpo_dp_link_enc(res_ctx, pool); | |
| 1792 | + if (enc_index >= 0) | |
| 1793 | + acquire_hpo_dp_link_enc(res_ctx, stream->link->link_index, enc_index); | |
| 1794 | + } | |
| 1795 | + | |
| 1796 | + if (enc_index >= 0) | |
| 1797 | + pipe_ctx->link_res.hpo_dp_link_enc = pool->hpo_dp_link_enc[enc_index]; | |
| 1798 | + | |
| 1799 | + return pipe_ctx->link_res.hpo_dp_link_enc != NULL; | |
| 1800 | +} | |
| 1801 | + | |
| 1802 | +static void remove_hpo_dp_link_enc_from_ctx(struct resource_context *res_ctx, | |
| 1803 | + struct pipe_ctx *pipe_ctx, | |
| 1804 | + struct dc_stream_state *stream) | |
| 1805 | +{ | |
| 1806 | + int enc_index; | |
| 1807 | + | |
| 1808 | + enc_index = find_acquired_hpo_dp_link_enc_for_link(res_ctx, stream->link); | |
| 1809 | + | |
| 1810 | + if (enc_index >= 0) { | |
| 1811 | + release_hpo_dp_link_enc(res_ctx, enc_index); | |
| 1812 | + pipe_ctx->link_res.hpo_dp_link_enc = NULL; | |
| 1813 | + } | |
| 1814 | +} | |
| 1766 | 1815 | #endif |
| 1767 | 1816 | |
| 1768 | 1817 | /* TODO: release audio object */ |
| @@ -1925,6 +1974,7 @@ enum dc_status dc_remove_stream_from_ctx( · 156 unmodified lines | ||
| 1925 | 1974 | &new_ctx->res_ctx, dc->res_pool, |
| 1926 | 1975 | del_pipe->stream_res.hpo_dp_stream_enc, |
| 1927 | 1976 | false); |
| 1977 | + remove_hpo_dp_link_enc_from_ctx(&new_ctx->res_ctx, del_pipe, del_pipe->stream); | |
| 1928 | 1978 | } |
| 1929 | 1979 | #endif |
| 1930 | 1980 | |
| @@ -2200,6 +2250,8 @@ enum dc_status resource_map_pool_resources( · 269 unmodified lines | ||
| 2200 | 2250 | &context->res_ctx, pool, |
| 2201 | 2251 | pipe_ctx->stream_res.hpo_dp_stream_enc, |
| 2202 | 2252 | true); |
| 2253 | + if (!add_hpo_dp_link_enc_to_ctx(&context->res_ctx, pool, pipe_ctx, stream)) | |
| 2254 | + return DC_NO_LINK_ENC_RESOURCE; | |
| 2203 | 2255 | } |
| 2204 | 2256 | } |
| 2205 | 2257 | #endif |
| @@ -2875,6 +2927,8 @@ bool pipe_need_reprogram( · 669 unmodified lines | ||
| 2875 | 2927 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 2876 | 2928 | if (pipe_ctx_old->stream_res.hpo_dp_stream_enc != pipe_ctx->stream_res.hpo_dp_stream_enc) |
| 2877 | 2929 | return true; |
| 2930 | + if (pipe_ctx_old->link_res.hpo_dp_link_enc != pipe_ctx->link_res.hpo_dp_link_enc) | |
| 2931 | + return true; | |
| 2878 | 2932 | #endif |
| 2879 | 2933 | |
| 2880 | 2934 | /* DIG link encoder resource assignment for stream changed. */ |
| @@ -3143,22 +3197,23 @@ void get_audio_check(struct audio_info *aud_modes, · 262 unmodified lines | ||
| 3143 | 3197 | } |
| 3144 | 3198 | |
| 3145 | 3199 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 3146 | −struct hpo_dp_link_encoder *resource_get_unused_hpo_dp_link_encoder( | |
| 3147 | − const struct resource_pool *pool) | |
| 3200 | +struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( | |
| 3201 | + const struct resource_context *res_ctx, | |
| 3202 | + const struct resource_pool *pool, | |
| 3203 | + const struct dc_link *link) | |
| 3148 | 3204 | { |
| 3149 | − uint8_t i; | |
| 3150 | − struct hpo_dp_link_encoder *enc = NULL; | |
| 3205 | + struct hpo_dp_link_encoder *hpo_dp_link_enc = NULL; | |
| 3206 | + int enc_index; | |
| 3151 | 3207 | |
| 3152 | − ASSERT(pool->hpo_dp_link_enc_count <= MAX_HPO_DP2_LINK_ENCODERS); | |
| 3208 | + enc_index = find_acquired_hpo_dp_link_enc_for_link(res_ctx, link); | |
| 3153 | 3209 | |
| 3154 | − for (i = 0; i < pool->hpo_dp_link_enc_count; i++) { | |
| 3155 | − if (pool->hpo_dp_link_enc[i]->transmitter == TRANSMITTER_UNKNOWN) { | |
| 3156 | − enc = pool->hpo_dp_link_enc[i]; | |
| 3157 | − break; | |
| 3158 | − } | |
| 3159 | − } | |
| 3210 | + if (enc_index < 0) | |
| 3211 | + enc_index = find_free_hpo_dp_link_enc(res_ctx, pool); | |
| 3212 | + | |
| 3213 | + if (enc_index >= 0) | |
| 3214 | + hpo_dp_link_enc = pool->hpo_dp_link_enc[enc_index]; | |
| 3160 | 3215 | |
| 3161 | − return enc; | |
| 3216 | + return hpo_dp_link_enc; | |
| 3162 | 3217 | } |
| 3163 | 3218 | #endif |
| 3164 | 3219 | |
| @@ -47,7 +47,7 @@ struct aux_payload; · 46 unmodified lines | ||
| 47 | 47 | struct set_config_cmd_payload; |
| 48 | 48 | struct dmub_notification; |
| 49 | 49 | |
| 50 | −#define DC_VER "3.2.166" | |
| 50 | +#define DC_VER "3.2.167" | |
| 51 | 51 | |
| 52 | 52 | #define MAX_SURFACES 3 |
| 53 | 53 | #define MAX_PLANES 6 |
| @@ -691,6 +691,7 @@ struct dc_debug_options { · 637 unmodified lines | ||
| 691 | 691 | /* TODO - remove once tested */ |
| 692 | 692 | bool legacy_dp2_lt; |
| 693 | 693 | bool set_mst_en_for_sst; |
| 694 | + bool disable_uhbr; | |
| 694 | 695 | bool force_dp2_lt_fallback_method; |
| 695 | 696 | #endif |
| 696 | 697 | union mem_low_power_enable_options enable_mem_low_power; |
| @@ -30,6 +30,8 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "dc_types.h" |
| 31 | 31 | #include "grph_object_defs.h" |
| 32 | 32 | |
| 33 | +struct link_resource; | |
| 34 | + | |
| 33 | 35 | enum dc_link_fec_state { |
| 34 | 36 | dc_link_fec_not_ready, |
| 35 | 37 | dc_link_fec_ready, |
| @@ -160,9 +162,6 @@ struct dc_link { · 124 unmodified lines | ||
| 160 | 162 | |
| 161 | 163 | struct panel_cntl *panel_cntl; |
| 162 | 164 | struct link_encoder *link_enc; |
| 163 | −#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 164 | − struct hpo_dp_link_encoder *hpo_dp_link_enc; | |
| 165 | −#endif | |
| 166 | 165 | struct graphics_object_id link_id; |
| 167 | 166 | /* Endpoint type distinguishes display endpoints which do not have entries |
| 168 | 167 | * in the BIOS connector table from those that do. Helps when tracking link |
| @@ -359,14 +358,17 @@ void dc_link_remove_remote_sink( · 190 unmodified lines | ||
| 359 | 358 | |
| 360 | 359 | void dc_link_dp_set_drive_settings( |
| 361 | 360 | struct dc_link *link, |
| 361 | + const struct link_resource *link_res, | |
| 362 | 362 | struct link_training_settings *lt_settings); |
| 363 | 363 | |
| 364 | 364 | bool dc_link_dp_perform_link_training_skip_aux( |
| 365 | 365 | struct dc_link *link, |
| 366 | + const struct link_resource *link_res, | |
| 366 | 367 | const struct dc_link_settings *link_setting); |
| 367 | 368 | |
| 368 | 369 | enum link_training_result dc_link_dp_perform_link_training( |
| 369 | 370 | struct dc_link *link, |
| 371 | + const struct link_resource *link_res, | |
| 370 | 372 | const struct dc_link_settings *link_settings, |
| 371 | 373 | bool skip_video_pattern); |
| 372 | 374 | |
| @@ -374,6 +376,7 @@ bool dc_link_dp_sync_lt_begin(struct dc_link *link); · 1 unmodified line | ||
| 374 | 376 | |
| 375 | 377 | enum link_training_result dc_link_dp_sync_lt_attempt( |
| 376 | 378 | struct dc_link *link, |
| 379 | + const struct link_resource *link_res, | |
| 377 | 380 | struct dc_link_settings *link_setting, |
| 378 | 381 | struct dc_link_training_overrides *lt_settings); |
| 379 | 382 | |
| @@ -454,4 +457,10 @@ bool dc_link_should_enable_fec(const struct dc_link *link); · 74 unmodified lines | ||
| 454 | 457 | uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(uint8_t bw); |
| 455 | 458 | enum dp_link_encoding dc_link_dp_mst_decide_link_encoding_format(const struct dc_link *link); |
| 456 | 459 | #endif |
| 460 | + | |
| 461 | +const struct link_resource *dc_link_get_cur_link_res(const struct dc_link *link); | |
| 462 | +/* take a snapshot of current link resource allocation state */ | |
| 463 | +void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map); | |
| 464 | +/* restore link resource allocation state from a snapshot */ | |
| 465 | +void dc_restore_link_res_map(const struct dc *dc, uint32_t *map); | |
| 457 | 466 | #endif /* DC_LINK_H_ */ |
| @@ -468,8 +468,6 @@ void dcn10_log_hw_state(struct dc *dc, · 467 unmodified lines | ||
| 468 | 468 | log_mpc_crc(dc, log_ctx); |
| 469 | 469 | |
| 470 | 470 | { |
| 471 | − int hpo_dp_link_enc_count = 0; | |
| 472 | − | |
| 473 | 471 | if (pool->hpo_dp_stream_enc_count > 0) { |
| 474 | 472 | DTN_INFO("DP HPO S_ENC: Enabled OTG Format Depth Vid SDP Compressed Link\n"); |
| 475 | 473 | for (i = 0; i < pool->hpo_dp_stream_enc_count; i++) { |
| @@ -500,18 +498,14 @@ void dcn10_log_hw_state(struct dc *dc, · 24 unmodified lines | ||
| 500 | 498 | } |
| 501 | 499 | |
| 502 | 500 | /* log DP HPO L_ENC section if any hpo_dp_link_enc exists */ |
| 503 | − for (i = 0; i < dc->link_count; i++) | |
| 504 | − if (dc->links[i]->hpo_dp_link_enc) | |
| 505 | − hpo_dp_link_enc_count++; | |
| 506 | − | |
| 507 | − if (hpo_dp_link_enc_count) { | |
| 501 | + if (pool->hpo_dp_link_enc_count) { | |
| 508 | 502 | DTN_INFO("DP HPO L_ENC: Enabled Mode Lanes Stream Slots VC Rate X VC Rate Y\n"); |
| 509 | 503 | |
| 510 | − for (i = 0; i < dc->link_count; i++) { | |
| 511 | − struct hpo_dp_link_encoder *hpo_dp_link_enc = dc->links[i]->hpo_dp_link_enc; | |
| 504 | + for (i = 0; i < pool->hpo_dp_link_enc_count; i++) { | |
| 505 | + struct hpo_dp_link_encoder *hpo_dp_link_enc = pool->hpo_dp_link_enc[i]; | |
| 512 | 506 | struct hpo_dp_link_enc_state hpo_dp_le_state = {0}; |
| 513 | 507 | |
| 514 | − if (hpo_dp_link_enc && hpo_dp_link_enc->funcs->read_state) { | |
| 508 | + if (hpo_dp_link_enc->funcs->read_state) { | |
| 515 | 509 | hpo_dp_link_enc->funcs->read_state(hpo_dp_link_enc, &hpo_dp_le_state); |
| 516 | 510 | DTN_INFO("[%d]: %d %6s %d %d %d %d %d\n", |
| 517 | 511 | hpo_dp_link_enc->inst, |
| @@ -78,6 +78,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 77 unmodified lines | ||
| 78 | 78 | .get_clock = dcn10_get_clock, |
| 79 | 79 | .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, |
| 80 | 80 | .calc_vupdate_position = dcn10_calc_vupdate_position, |
| 81 | + .power_down = dce110_power_down, | |
| 81 | 82 | .set_backlight_level = dce110_set_backlight_level, |
| 82 | 83 | .set_abm_immediate_disable = dce110_set_abm_immediate_disable, |
| 83 | 84 | .set_pipe = dce110_set_pipe, |
| @@ -2414,7 +2414,7 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 2413 unmodified lines | ||
| 2414 | 2414 | pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->map_stream_to_link( |
| 2415 | 2415 | pipe_ctx->stream_res.hpo_dp_stream_enc, |
| 2416 | 2416 | pipe_ctx->stream_res.hpo_dp_stream_enc->inst, |
| 2417 | − link->hpo_dp_link_enc->inst); | |
| 2417 | + pipe_ctx->link_res.hpo_dp_link_enc->inst); | |
| 2418 | 2418 | } |
| 2419 | 2419 | |
| 2420 | 2420 | if (!is_dp_128b_132b_signal(pipe_ctx) && link_enc) |
| @@ -1069,7 +1069,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 1068 unmodified lines | ||
| 1069 | 1069 | .timing_trace = false, |
| 1070 | 1070 | .clock_trace = true, |
| 1071 | 1071 | .disable_pplib_clock_request = true, |
| 1072 | − .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, | |
| 1072 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 1073 | 1073 | .force_single_disp_pipe_split = false, |
| 1074 | 1074 | .disable_dcc = DCC_ENABLE, |
| 1075 | 1075 | .vsr_support = true, |
| @@ -3093,8 +3093,7 @@ static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struc · 2017 unmodified lines | ||
| 3093 | 3093 | else if (context->stream_count == 1 && context->streams[0]->signal == SIGNAL_TYPE_EDP) { |
| 3094 | 3094 | struct dc_link *link = context->streams[0]->sink->link; |
| 3095 | 3095 | |
| 3096 | − if ((link->link_index == 0 && link->psr_settings.psr_feature_enabled) | |
| 3097 | − || context->bw_ctx.dml.vba.StutterPeriod > 5000.0) | |
| 3096 | + if (link->link_index == 0 && context->bw_ctx.dml.vba.StutterPeriod > 5000.0) | |
| 3098 | 3097 | return DCN_ZSTATE_SUPPORT_ALLOW; |
| 3099 | 3098 | else |
| 3100 | 3099 | return DCN_ZSTATE_SUPPORT_DISALLOW; |
| @@ -134,11 +134,12 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) · 133 unmodified lines | ||
| 134 | 134 | PHYSICAL_ADDRESS_LOC addr; |
| 135 | 135 | struct dc_plane_state *plane_state = pipe_ctx->plane_state; |
| 136 | 136 | struct dce_hwseq *hws = dc->hwseq; |
| 137 | − struct dc_plane_address uma = plane_state->address; | |
| 137 | + struct dc_plane_address uma; | |
| 138 | 138 | |
| 139 | 139 | if (plane_state == NULL) |
| 140 | 140 | return; |
| 141 | 141 | |
| 142 | + uma = plane_state->address; | |
| 142 | 143 | addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr); |
| 143 | 144 | |
| 144 | 145 | plane_address_in_gpu_space_to_uma(hws, &uma); |
| @@ -603,7 +603,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 602 unmodified lines | ||
| 603 | 603 | .timing_trace = false, |
| 604 | 604 | .clock_trace = true, |
| 605 | 605 | .disable_pplib_clock_request = true, |
| 606 | − .pipe_split_policy = MPC_SPLIT_AVOID, | |
| 606 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 607 | 607 | .force_single_disp_pipe_split = false, |
| 608 | 608 | .disable_dcc = DCC_ENABLE, |
| 609 | 609 | .vsr_support = true, |
| @@ -873,7 +873,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 872 unmodified lines | ||
| 873 | 873 | .clock_trace = true, |
| 874 | 874 | .disable_pplib_clock_request = true, |
| 875 | 875 | .min_disp_clk_khz = 100000, |
| 876 | − .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, | |
| 876 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 877 | 877 | .force_single_disp_pipe_split = false, |
| 878 | 878 | .disable_dcc = DCC_ENABLE, |
| 879 | 879 | .vsr_support = true, |
| @@ -840,7 +840,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 839 unmodified lines | ||
| 840 | 840 | .timing_trace = false, |
| 841 | 841 | .clock_trace = true, |
| 842 | 842 | .disable_pplib_clock_request = true, |
| 843 | − .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, | |
| 843 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 844 | 844 | .force_single_disp_pipe_split = false, |
| 845 | 845 | .disable_dcc = DCC_ENABLE, |
| 846 | 846 | .vsr_support = true, |
| @@ -1761,17 +1761,6 @@ static bool dcn30_split_stream_for_mpc_or_odm( · 914 unmodified lines | ||
| 1761 | 1761 | int pipe_idx = sec_pipe->pipe_idx; |
| 1762 | 1762 | const struct resource_pool *pool = dc->res_pool; |
| 1763 | 1763 | |
| 1764 | − if (pri_pipe->plane_state) { | |
| 1765 | − /* ODM + window MPO, where MPO window is on left half only */ | |
| 1766 | − if (pri_pipe->plane_state->clip_rect.x + pri_pipe->plane_state->clip_rect.width <= | |
| 1767 | − pri_pipe->stream->src.x + pri_pipe->stream->src.width/2) | |
| 1768 | − return true; | |
| 1769 | − | |
| 1770 | − /* ODM + window MPO, where MPO window is on right half only */ | |
| 1771 | − if (pri_pipe->plane_state->clip_rect.x >= pri_pipe->stream->src.width/2) | |
| 1772 | − return true; | |
| 1773 | − } | |
| 1774 | − | |
| 1775 | 1764 | *sec_pipe = *pri_pipe; |
| 1776 | 1765 | |
| 1777 | 1766 | sec_pipe->pipe_idx = pipe_idx; |
| @@ -686,7 +686,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 685 unmodified lines | ||
| 686 | 686 | .disable_clock_gate = true, |
| 687 | 687 | .disable_pplib_clock_request = true, |
| 688 | 688 | .disable_pplib_wm_range = true, |
| 689 | − .pipe_split_policy = MPC_SPLIT_AVOID, | |
| 689 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 690 | 690 | .force_single_disp_pipe_split = false, |
| 691 | 691 | .disable_dcc = DCC_ENABLE, |
| 692 | 692 | .vsr_support = true, |
| @@ -211,7 +211,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 210 unmodified lines | ||
| 211 | 211 | .timing_trace = false, |
| 212 | 212 | .clock_trace = true, |
| 213 | 213 | .disable_pplib_clock_request = true, |
| 214 | − .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, | |
| 214 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 215 | 215 | .force_single_disp_pipe_split = false, |
| 216 | 216 | .disable_dcc = DCC_ENABLE, |
| 217 | 217 | .vsr_support = true, |
| @@ -15,7 +15,11 @@ · 14 unmodified lines | ||
| 15 | 15 | SR(DPPCLK_DTO_CTRL),\ |
| 16 | 16 | DCCG_SRII(DTO_PARAM, DPPCLK, 0),\ |
| 17 | 17 | DCCG_SRII(DTO_PARAM, DPPCLK, 1),\ |
| 18 | − SR(REFCLK_CNTL) | |
| 18 | + SR(REFCLK_CNTL),\ | |
| 19 | + SR(DISPCLK_FREQ_CHANGE_CNTL),\ | |
| 20 | + DCCG_SRII(PIXEL_RATE_CNTL, OTG, 0),\ | |
| 21 | + DCCG_SRII(PIXEL_RATE_CNTL, OTG, 1) | |
| 22 | + | |
| 19 | 23 | |
| 20 | 24 | #define DCCG_MASK_SH_LIST_DCN3_03(mask_sh) \ |
| 21 | 25 | DCCG_SFI(DPPCLK_DTO_CTRL, DTO_ENABLE, DPPCLK, 0, mask_sh),\ |
| @@ -25,6 +29,18 @@ · 3 unmodified lines | ||
| 25 | 29 | DCCG_SF(DPPCLK0_DTO_PARAM, DPPCLK0_DTO_PHASE, mask_sh),\ |
| 26 | 30 | DCCG_SF(DPPCLK0_DTO_PARAM, DPPCLK0_DTO_MODULO, mask_sh),\ |
| 27 | 31 | DCCG_SF(REFCLK_CNTL, REFCLK_CLOCK_EN, mask_sh),\ |
| 28 | − DCCG_SF(REFCLK_CNTL, REFCLK_SRC_SEL, mask_sh) | |
| 32 | + DCCG_SF(REFCLK_CNTL, REFCLK_SRC_SEL, mask_sh),\ | |
| 33 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DISPCLK_STEP_DELAY, mask_sh),\ | |
| 34 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DISPCLK_STEP_SIZE, mask_sh),\ | |
| 35 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DISPCLK_FREQ_RAMP_DONE, mask_sh),\ | |
| 36 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DISPCLK_MAX_ERRDET_CYCLES, mask_sh),\ | |
| 37 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DCCG_FIFO_ERRDET_RESET, mask_sh),\ | |
| 38 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DCCG_FIFO_ERRDET_STATE, mask_sh),\ | |
| 39 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DCCG_FIFO_ERRDET_OVR_EN, mask_sh),\ | |
| 40 | + DCCG_SF(DISPCLK_FREQ_CHANGE_CNTL, DISPCLK_CHG_FWD_CORR_DISABLE, mask_sh),\ | |
| 41 | + DCCG_SFII(OTG, PIXEL_RATE_CNTL, OTG, ADD_PIXEL, 0, mask_sh),\ | |
| 42 | + DCCG_SFII(OTG, PIXEL_RATE_CNTL, OTG, ADD_PIXEL, 1, mask_sh),\ | |
| 43 | + DCCG_SFII(OTG, PIXEL_RATE_CNTL, OTG, DROP_PIXEL, 0, mask_sh),\ | |
| 44 | + DCCG_SFII(OTG, PIXEL_RATE_CNTL, OTG, DROP_PIXEL, 1, mask_sh) | |
| 29 | 45 | |
| 30 | 46 | #endif //__DCN303_DCCG_H__ |
| @@ -193,7 +193,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 192 unmodified lines | ||
| 193 | 193 | .timing_trace = false, |
| 194 | 194 | .clock_trace = true, |
| 195 | 195 | .disable_pplib_clock_request = true, |
| 196 | − .pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP, | |
| 196 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 197 | 197 | .force_single_disp_pipe_split = false, |
| 198 | 198 | .disable_dcc = DCC_ENABLE, |
| 199 | 199 | .vsr_support = true, |
| @@ -499,7 +499,8 @@ static enum bp_result link_transmitter_control( · 498 unmodified lines | ||
| 499 | 499 | void dcn31_hpo_dp_link_enc_enable_dp_output( |
| 500 | 500 | struct hpo_dp_link_encoder *enc, |
| 501 | 501 | const struct dc_link_settings *link_settings, |
| 502 | − enum transmitter transmitter) | |
| 502 | + enum transmitter transmitter, | |
| 503 | + enum hpd_source_id hpd_source) | |
| 503 | 504 | { |
| 504 | 505 | struct dcn31_hpo_dp_link_encoder *enc3 = DCN3_1_HPO_DP_LINK_ENC_FROM_HPO_LINK_ENC(enc); |
| 505 | 506 | struct bp_transmitter_control cntl = { 0 }; |
| @@ -508,6 +509,9 @@ void dcn31_hpo_dp_link_enc_enable_dp_output( · 2 unmodified lines | ||
| 508 | 509 | /* Set the transmitter */ |
| 509 | 510 | enc3->base.transmitter = transmitter; |
| 510 | 511 | |
| 512 | + /* Set the hpd source */ | |
| 513 | + enc3->base.hpd_source = hpd_source; | |
| 514 | + | |
| 511 | 515 | /* Enable the PHY */ |
| 512 | 516 | cntl.action = TRANSMITTER_CONTROL_ENABLE; |
| 513 | 517 | cntl.engine_id = ENGINE_ID_UNKNOWN; |
| @@ -184,7 +184,8 @@ void hpo_dp_link_encoder31_construct(struct dcn31_hpo_dp_link_encoder *enc31, · 183 unmodified lines | ||
| 184 | 184 | void dcn31_hpo_dp_link_enc_enable_dp_output( |
| 185 | 185 | struct hpo_dp_link_encoder *enc, |
| 186 | 186 | const struct dc_link_settings *link_settings, |
| 187 | − enum transmitter transmitter); | |
| 187 | + enum transmitter transmitter, | |
| 188 | + enum hpd_source_id hpd_source); | |
| 188 | 189 | |
| 189 | 190 | void dcn31_hpo_dp_link_enc_disable_output( |
| 190 | 191 | struct hpo_dp_link_encoder *enc, |
| @@ -103,6 +103,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = { · 102 unmodified lines | ||
| 103 | 103 | .z10_restore = dcn31_z10_restore, |
| 104 | 104 | .z10_save_init = dcn31_z10_save_init, |
| 105 | 105 | .set_disp_pattern_generator = dcn30_set_disp_pattern_generator, |
| 106 | + .optimize_pwr_state = dcn21_optimize_pwr_state, | |
| 106 | 107 | .exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state, |
| 107 | 108 | .update_visual_confirm_color = dcn20_update_visual_confirm_color, |
| 108 | 109 | }; |
| @@ -355,6 +355,14 @@ static const struct dce110_clk_src_regs clk_src_regs[] = { · 354 unmodified lines | ||
| 355 | 355 | clk_src_regs(3, D), |
| 356 | 356 | clk_src_regs(4, E) |
| 357 | 357 | }; |
| 358 | +/*pll_id being rempped in dmub, in driver it is logical instance*/ | |
| 359 | +static const struct dce110_clk_src_regs clk_src_regs_b0[] = { | |
| 360 | + clk_src_regs(0, A), | |
| 361 | + clk_src_regs(1, B), | |
| 362 | + clk_src_regs(2, F), | |
| 363 | + clk_src_regs(3, G), | |
| 364 | + clk_src_regs(4, E) | |
| 365 | +}; | |
| 358 | 366 | |
| 359 | 367 | static const struct dce110_clk_src_shift cs_shift = { |
| 360 | 368 | CS_COMMON_MASK_SH_LIST_DCN2_0(__SHIFT) |
| @@ -995,7 +1003,7 @@ static const struct dc_debug_options debug_defaults_drv = { · 634 unmodified lines | ||
| 995 | 1003 | .timing_trace = false, |
| 996 | 1004 | .clock_trace = true, |
| 997 | 1005 | .disable_pplib_clock_request = false, |
| 998 | − .pipe_split_policy = MPC_SPLIT_AVOID, | |
| 1006 | + .pipe_split_policy = MPC_SPLIT_DYNAMIC, | |
| 999 | 1007 | .force_single_disp_pipe_split = false, |
| 1000 | 1008 | .disable_dcc = DCC_ENABLE, |
| 1001 | 1009 | .vsr_support = true, |
| @@ -2294,14 +2302,27 @@ static bool dcn31_resource_construct( · 1292 unmodified lines | ||
| 2294 | 2302 | dcn30_clock_source_create(ctx, ctx->dc_bios, |
| 2295 | 2303 | CLOCK_SOURCE_COMBO_PHY_PLL1, |
| 2296 | 2304 | &clk_src_regs[1], false); |
| 2297 | − pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = | |
| 2305 | + /*move phypllx_pixclk_resync to dmub next*/ | |
| 2306 | + if (dc->ctx->asic_id.hw_internal_rev == YELLOW_CARP_B0) { | |
| 2307 | + pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = | |
| 2308 | + dcn30_clock_source_create(ctx, ctx->dc_bios, | |
| 2309 | + CLOCK_SOURCE_COMBO_PHY_PLL2, | |
| 2310 | + &clk_src_regs_b0[2], false); | |
| 2311 | + pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = | |
| 2312 | + dcn30_clock_source_create(ctx, ctx->dc_bios, | |
| 2313 | + CLOCK_SOURCE_COMBO_PHY_PLL3, | |
| 2314 | + &clk_src_regs_b0[3], false); | |
| 2315 | + } else { | |
| 2316 | + pool->base.clock_sources[DCN31_CLK_SRC_PLL2] = | |
| 2298 | 2317 | dcn30_clock_source_create(ctx, ctx->dc_bios, |
| 2299 | 2318 | CLOCK_SOURCE_COMBO_PHY_PLL2, |
| 2300 | 2319 | &clk_src_regs[2], false); |
| 2301 | − pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = | |
| 2320 | + pool->base.clock_sources[DCN31_CLK_SRC_PLL3] = | |
| 2302 | 2321 | dcn30_clock_source_create(ctx, ctx->dc_bios, |
| 2303 | 2322 | CLOCK_SOURCE_COMBO_PHY_PLL3, |
| 2304 | 2323 | &clk_src_regs[3], false); |
| 2324 | + } | |
| 2325 | + | |
| 2305 | 2326 | pool->base.clock_sources[DCN31_CLK_SRC_PLL4] = |
| 2306 | 2327 | dcn30_clock_source_create(ctx, ctx->dc_bios, |
| 2307 | 2328 | CLOCK_SOURCE_COMBO_PHY_PLL4, |
| @@ -49,4 +49,35 @@ struct resource_pool *dcn31_create_resource_pool( · 48 unmodified lines | ||
| 49 | 49 | const struct dc_init_data *init_data, |
| 50 | 50 | struct dc *dc); |
| 51 | 51 | |
| 52 | +/*temp: B0 specific before switch to dcn313 headers*/ | |
| 53 | +#ifndef regPHYPLLF_PIXCLK_RESYNC_CNTL | |
| 54 | +#define regPHYPLLF_PIXCLK_RESYNC_CNTL 0x007e | |
| 55 | +#define regPHYPLLF_PIXCLK_RESYNC_CNTL_BASE_IDX 1 | |
| 56 | +#define regPHYPLLG_PIXCLK_RESYNC_CNTL 0x005f | |
| 57 | +#define regPHYPLLG_PIXCLK_RESYNC_CNTL_BASE_IDX 1 | |
| 58 | + | |
| 59 | +//PHYPLLF_PIXCLK_RESYNC_CNTL | |
| 60 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_RESYNC_ENABLE__SHIFT 0x0 | |
| 61 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DEEP_COLOR_DTO_ENABLE_STATUS__SHIFT 0x1 | |
| 62 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DCCG_DEEP_COLOR_CNTL__SHIFT 0x4 | |
| 63 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_ENABLE__SHIFT 0x8 | |
| 64 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_DOUBLE_RATE_ENABLE__SHIFT 0x9 | |
| 65 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_RESYNC_ENABLE_MASK 0x00000001L | |
| 66 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DEEP_COLOR_DTO_ENABLE_STATUS_MASK 0x00000002L | |
| 67 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_DCCG_DEEP_COLOR_CNTL_MASK 0x00000030L | |
| 68 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_ENABLE_MASK 0x00000100L | |
| 69 | +#define PHYPLLF_PIXCLK_RESYNC_CNTL__PHYPLLF_PIXCLK_DOUBLE_RATE_ENABLE_MASK 0x00000200L | |
| 70 | + | |
| 71 | +//PHYPLLG_PIXCLK_RESYNC_CNTL | |
| 72 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_RESYNC_ENABLE__SHIFT 0x0 | |
| 73 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DEEP_COLOR_DTO_ENABLE_STATUS__SHIFT 0x1 | |
| 74 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DCCG_DEEP_COLOR_CNTL__SHIFT 0x4 | |
| 75 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_ENABLE__SHIFT 0x8 | |
| 76 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_DOUBLE_RATE_ENABLE__SHIFT 0x9 | |
| 77 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_RESYNC_ENABLE_MASK 0x00000001L | |
| 78 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DEEP_COLOR_DTO_ENABLE_STATUS_MASK 0x00000002L | |
| 79 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_DCCG_DEEP_COLOR_CNTL_MASK 0x00000030L | |
| 80 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_ENABLE_MASK 0x00000100L | |
| 81 | +#define PHYPLLG_PIXCLK_RESYNC_CNTL__PHYPLLG_PIXCLK_DOUBLE_RATE_ENABLE_MASK 0x00000200L | |
| 82 | +#endif | |
| 52 | 83 | #endif /* _DCN31_RESOURCE_H_ */ |
| @@ -1274,7 +1274,7 @@ static void dcn20_adjust_adaptive_sync_v_startup( · 1273 unmodified lines | ||
| 1274 | 1274 | static bool is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx) |
| 1275 | 1275 | { |
| 1276 | 1276 | return (pipe_ctx->stream_res.hpo_dp_stream_enc && |
| 1277 | − pipe_ctx->stream->link->hpo_dp_link_enc && | |
| 1277 | + pipe_ctx->link_res.hpo_dp_link_enc && | |
| 1278 | 1278 | dc_is_dp_signal(pipe_ctx->stream->signal)); |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| @@ -53,6 +53,8 @@ enum dc_status { · 52 unmodified lines | ||
| 53 | 53 | DC_NOT_SUPPORTED = 24, |
| 54 | 54 | DC_UNSUPPORTED_VALUE = 25, |
| 55 | 55 | |
| 56 | + DC_NO_LINK_ENC_RESOURCE = 26, | |
| 57 | + | |
| 56 | 58 | DC_ERROR_UNEXPECTED = -1 |
| 57 | 59 | }; |
| 58 | 60 | |
| @@ -334,6 +334,20 @@ struct plane_resource { · 333 unmodified lines | ||
| 334 | 334 | struct dcn_fe_bandwidth bw; |
| 335 | 335 | }; |
| 336 | 336 | |
| 337 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 338 | +#define LINK_RES_HPO_DP_REC_MAP__MASK 0xFFFF | |
| 339 | +#define LINK_RES_HPO_DP_REC_MAP__SHIFT 0 | |
| 340 | +#endif | |
| 341 | + | |
| 342 | +/* all mappable hardware resources used to enable a link */ | |
| 343 | +struct link_resource { | |
| 344 | +#if defined(CONFIG_DRM_AMD_DC_DCN) | |
| 345 | + struct hpo_dp_link_encoder *hpo_dp_link_enc; | |
| 346 | +#else | |
| 347 | + void *dummy; | |
| 348 | +#endif | |
| 349 | +}; | |
| 350 | + | |
| 337 | 351 | union pipe_update_flags { |
| 338 | 352 | struct { |
| 339 | 353 | uint32_t enable : 1; |
| @@ -361,6 +375,7 @@ struct pipe_ctx { · 21 unmodified lines | ||
| 361 | 375 | |
| 362 | 376 | struct plane_resource plane_res; |
| 363 | 377 | struct stream_resource stream_res; |
| 378 | + struct link_resource link_res; | |
| 364 | 379 | |
| 365 | 380 | struct clock_source *clock_source; |
| 366 | 381 | |
| @@ -412,6 +427,8 @@ struct resource_context { · 45 unmodified lines | ||
| 412 | 427 | struct link_enc_cfg_context link_enc_cfg_ctx; |
| 413 | 428 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 414 | 429 | bool is_hpo_dp_stream_enc_acquired[MAX_HPO_DP2_ENCODERS]; |
| 430 | + unsigned int hpo_dp_link_enc_to_link_idx[MAX_HPO_DP2_LINK_ENCODERS]; | |
| 431 | + int hpo_dp_link_enc_ref_cnts[MAX_HPO_DP2_LINK_ENCODERS]; | |
| 415 | 432 | #endif |
| 416 | 433 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 417 | 434 | bool is_mpc_3dlut_acquired[MAX_PIPES]; |
| @@ -56,16 +56,19 @@ enum { · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | bool dp_verify_link_cap( |
| 58 | 58 | struct dc_link *link, |
| 59 | + const struct link_resource *link_res, | |
| 59 | 60 | struct dc_link_settings *known_limit_link_setting, |
| 60 | 61 | int *fail_count); |
| 61 | 62 | |
| 62 | 63 | bool dp_verify_link_cap_with_retries( |
| 63 | 64 | struct dc_link *link, |
| 65 | + const struct link_resource *link_res, | |
| 64 | 66 | struct dc_link_settings *known_limit_link_setting, |
| 65 | 67 | int attempts); |
| 66 | 68 | |
| 67 | 69 | bool dp_verify_mst_link_cap( |
| 68 | − struct dc_link *link); | |
| 70 | + struct dc_link *link, | |
| 71 | + const struct link_resource *link_res); | |
| 69 | 72 | |
| 70 | 73 | bool dp_validate_mode_timing( |
| 71 | 74 | struct dc_link *link, |
| @@ -168,7 +171,7 @@ uint8_t dc_dp_initialize_scrambling_data_symbols( · 96 unmodified lines | ||
| 168 | 171 | struct dc_link *link, |
| 169 | 172 | enum dc_dp_training_pattern pattern); |
| 170 | 173 | |
| 171 | −enum dc_status dp_set_fec_ready(struct dc_link *link, bool ready); | |
| 174 | +enum dc_status dp_set_fec_ready(struct dc_link *link, const struct link_resource *link_res, bool ready); | |
| 172 | 175 | void dp_set_fec_enable(struct dc_link *link, bool enable); |
| 173 | 176 | struct link_encoder *dp_get_link_enc(struct dc_link *link); |
| 174 | 177 | bool dp_set_dsc_enable(struct pipe_ctx *pipe_ctx, bool enable); |
| @@ -211,8 +214,12 @@ bool dpcd_poll_for_allocation_change_trigger(struct dc_link *link); · 36 unmodified lines | ||
| 211 | 214 | struct fixed31_32 calculate_sst_avg_time_slots_per_mtp( |
| 212 | 215 | const struct dc_stream_state *stream, |
| 213 | 216 | const struct dc_link *link); |
| 214 | −void enable_dp_hpo_output(struct dc_link *link, const struct dc_link_settings *link_settings); | |
| 215 | −void disable_dp_hpo_output(struct dc_link *link, enum signal_type signal); | |
| 217 | +void enable_dp_hpo_output(struct dc_link *link, | |
| 218 | + const struct link_resource *link_res, | |
| 219 | + const struct dc_link_settings *link_settings); | |
| 220 | +void disable_dp_hpo_output(struct dc_link *link, | |
| 221 | + const struct link_resource *link_res, | |
| 222 | + enum signal_type signal); | |
| 216 | 223 | void setup_dp_hpo_stream(struct pipe_ctx *pipe_ctx, bool enable); |
| 217 | 224 | bool is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx); |
| 218 | 225 | void reset_dp_hpo_stream_encoders_for_link(struct dc_link *link); |
| @@ -91,8 +91,9 @@ enum dc_status dpcd_get_tunneling_device_data(struct dc_link *link); · 90 unmodified lines | ||
| 91 | 91 | * DPIA equivalent of dc_link_dp_perfrorm_link_training. |
| 92 | 92 | * Aborts link training upon detection of sink unplug. |
| 93 | 93 | */ |
| 94 | −enum link_training_result | |
| 95 | −dc_link_dpia_perform_link_training(struct dc_link *link, | |
| 94 | +enum link_training_result dc_link_dpia_perform_link_training( | |
| 95 | + struct dc_link *link, | |
| 96 | + const struct link_resource *link_res, | |
| 96 | 97 | const struct dc_link_settings *link_setting, |
| 97 | 98 | bool skip_video_pattern); |
| 98 | 99 | |
| @@ -268,7 +268,8 @@ struct hpo_dp_link_encoder_funcs { · 267 unmodified lines | ||
| 268 | 268 | |
| 269 | 269 | void (*enable_link_phy)(struct hpo_dp_link_encoder *enc, |
| 270 | 270 | const struct dc_link_settings *link_settings, |
| 271 | − enum transmitter transmitter); | |
| 271 | + enum transmitter transmitter, | |
| 272 | + enum hpd_source_id hpd_source); | |
| 272 | 273 | |
| 273 | 274 | void (*disable_link_phy)(struct hpo_dp_link_encoder *link_enc, |
| 274 | 275 | enum signal_type signal); |
| @@ -32,6 +32,7 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb, · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | void dp_enable_link_phy( |
| 34 | 34 | struct dc_link *link, |
| 35 | + const struct link_resource *link_res, | |
| 35 | 36 | enum signal_type signal, |
| 36 | 37 | enum clock_source_id clock_source, |
| 37 | 38 | const struct dc_link_settings *link_settings); |
| @@ -42,22 +43,27 @@ void edp_add_delay_for_T9(struct dc_link *link); · 4 unmodified lines | ||
| 42 | 43 | bool edp_receiver_ready_T9(struct dc_link *link); |
| 43 | 44 | bool edp_receiver_ready_T7(struct dc_link *link); |
| 44 | 45 | |
| 45 | −void dp_disable_link_phy(struct dc_link *link, enum signal_type signal); | |
| 46 | +void dp_disable_link_phy(struct dc_link *link, const struct link_resource *link_res, | |
| 47 | + enum signal_type signal); | |
| 46 | 48 | |
| 47 | −void dp_disable_link_phy_mst(struct dc_link *link, enum signal_type signal); | |
| 49 | +void dp_disable_link_phy_mst(struct dc_link *link, const struct link_resource *link_res, | |
| 50 | + enum signal_type signal); | |
| 48 | 51 | |
| 49 | 52 | bool dp_set_hw_training_pattern( |
| 50 | 53 | struct dc_link *link, |
| 54 | + const struct link_resource *link_res, | |
| 51 | 55 | enum dc_dp_training_pattern pattern, |
| 52 | 56 | uint32_t offset); |
| 53 | 57 | |
| 54 | 58 | void dp_set_hw_lane_settings( |
| 55 | 59 | struct dc_link *link, |
| 60 | + const struct link_resource *link_res, | |
| 56 | 61 | const struct link_training_settings *link_settings, |
| 57 | 62 | uint32_t offset); |
| 58 | 63 | |
| 59 | 64 | void dp_set_hw_test_pattern( |
| 60 | 65 | struct dc_link *link, |
| 66 | + const struct link_resource *link_res, | |
| 61 | 67 | enum dp_test_pattern test_pattern, |
| 62 | 68 | uint8_t *custom_pattern, |
| 63 | 69 | uint32_t custom_pattern_size); |
| @@ -206,8 +206,10 @@ int get_num_mpc_splits(struct pipe_ctx *pipe); · 205 unmodified lines | ||
| 206 | 206 | int get_num_odm_splits(struct pipe_ctx *pipe); |
| 207 | 207 | |
| 208 | 208 | #if defined(CONFIG_DRM_AMD_DC_DCN) |
| 209 | −struct hpo_dp_link_encoder *resource_get_unused_hpo_dp_link_encoder( | |
| 210 | − const struct resource_pool *pool); | |
| 209 | +struct hpo_dp_link_encoder *resource_get_hpo_dp_link_enc_for_det_lt( | |
| 210 | + const struct resource_context *res_ctx, | |
| 211 | + const struct resource_pool *pool, | |
| 212 | + const struct dc_link *link); | |
| 211 | 213 | #endif |
| 212 | 214 | |
| 213 | 215 | void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, |
| @@ -46,10 +46,10 @@ · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | /* Firmware versioning. */ |
| 48 | 48 | #ifdef DMUB_EXPOSE_VERSION |
| 49 | −#define DMUB_FW_VERSION_GIT_HASH 0xc99a4517 | |
| 49 | +#define DMUB_FW_VERSION_GIT_HASH 0xbaf06b95 | |
| 50 | 50 | #define DMUB_FW_VERSION_MAJOR 0 |
| 51 | 51 | #define DMUB_FW_VERSION_MINOR 0 |
| 52 | −#define DMUB_FW_VERSION_REVISION 97 | |
| 52 | +#define DMUB_FW_VERSION_REVISION 98 | |
| 53 | 53 | #define DMUB_FW_VERSION_TEST 0 |
| 54 | 54 | #define DMUB_FW_VERSION_VBIOS 0 |
| 55 | 55 | #define DMUB_FW_VERSION_HOTFIX 0 |
| @@ -852,7 +852,7 @@ bool dmub_srv_should_detect(struct dmub_srv *dmub) · 851 unmodified lines | ||
| 852 | 852 | |
| 853 | 853 | enum dmub_status dmub_srv_clear_inbox0_ack(struct dmub_srv *dmub) |
| 854 | 854 | { |
| 855 | − if (!dmub->hw_init || dmub->hw_funcs.clear_inbox0_ack_register) | |
| 855 | + if (!dmub->hw_init || !dmub->hw_funcs.clear_inbox0_ack_register) | |
| 856 | 856 | return DMUB_STATUS_INVALID; |
| 857 | 857 | |
| 858 | 858 | dmub->hw_funcs.clear_inbox0_ack_register(dmub); |
| @@ -878,7 +878,7 @@ enum dmub_status dmub_srv_wait_for_inbox0_ack(struct dmub_srv *dmub, uint32_t ti · 19 unmodified lines | ||
| 878 | 878 | enum dmub_status dmub_srv_send_inbox0_cmd(struct dmub_srv *dmub, |
| 879 | 879 | union dmub_inbox0_data_register data) |
| 880 | 880 | { |
| 881 | − if (!dmub->hw_init || dmub->hw_funcs.send_inbox0_cmd) | |
| 881 | + if (!dmub->hw_init || !dmub->hw_funcs.send_inbox0_cmd) | |
| 882 | 882 | return DMUB_STATUS_INVALID; |
| 883 | 883 | |
| 884 | 884 | dmub->hw_funcs.send_inbox0_cmd(dmub, data); |
| @@ -20753,8 +20753,6 @@ · 20752 unmodified lines | ||
| 20753 | 20753 | |
| 20754 | 20754 | // addressBlock: nbio_nbif0_gdc_GDCDEC |
| 20755 | 20755 | // base address: 0xd0000000 |
| 20756 | −#define regGDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL 0x2ffc0eda | |
| 20757 | −#define regGDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL_BASE_IDX 5 | |
| 20758 | 20756 | #define regGDC1_NGDC_SDP_PORT_CTRL 0x2ffc0ee2 |
| 20759 | 20757 | #define regGDC1_NGDC_SDP_PORT_CTRL_BASE_IDX 5 |
| 20760 | 20758 | #define regGDC1_SHUB_REGS_IF_CTL 0x2ffc0ee3 |
| @@ -1,4 +1,3 @@ | ||
| 1 | − | |
| 2 | 1 | /* |
| 3 | 2 | * Copyright (C) 2020 Advanced Micro Devices, Inc. |
| 4 | 3 | * |
| @@ -108541,17 +108540,6 @@ · 108536 unmodified lines | ||
| 108541 | 108540 | |
| 108542 | 108541 | |
| 108543 | 108542 | // addressBlock: nbio_nbif0_gdc_GDCDEC |
| 108544 | −//GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL | |
| 108545 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN0_FAST_WRITE_RESPONSE_EN__SHIFT 0x0 | |
| 108546 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN1_FAST_WRITE_RESPONSE_EN__SHIFT 0x1 | |
| 108547 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN2_FAST_WRITE_RESPONSE_EN__SHIFT 0x2 | |
| 108548 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN3_FAST_WRITE_RESPONSE_EN__SHIFT 0x3 | |
| 108549 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__FWR_NORMAL_ARB_MODE__SHIFT 0x10 | |
| 108550 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN0_FAST_WRITE_RESPONSE_EN_MASK 0x00000001L | |
| 108551 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN1_FAST_WRITE_RESPONSE_EN_MASK 0x00000002L | |
| 108552 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN2_FAST_WRITE_RESPONSE_EN_MASK 0x00000004L | |
| 108553 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__LOGAN3_FAST_WRITE_RESPONSE_EN_MASK 0x00000008L | |
| 108554 | −#define GDC1_LOGAN_FAST_WRITE_RESPONSE_CNTL__FWR_NORMAL_ARB_MODE_MASK 0x00010000L | |
| 108555 | 108543 | //GDC1_NGDC_SDP_PORT_CTRL |
| 108556 | 108544 | #define GDC1_NGDC_SDP_PORT_CTRL__SDP_DISCON_HYSTERESIS__SHIFT 0x0 |
| 108557 | 108545 | #define GDC1_NGDC_SDP_PORT_CTRL__NGDC_OBFF_HW_URGENT_EARLY_WAKEUP_EN__SHIFT 0xf |
| @@ -143,6 +143,55 @@ struct gc_info_v1_0 { · 142 unmodified lines | ||
| 143 | 143 | uint32_t gc_num_gl2a; |
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | +struct gc_info_v1_1 { | |
| 147 | + struct gpu_info_header header; | |
| 148 | + | |
| 149 | + uint32_t gc_num_se; | |
| 150 | + uint32_t gc_num_wgp0_per_sa; | |
| 151 | + uint32_t gc_num_wgp1_per_sa; | |
| 152 | + uint32_t gc_num_rb_per_se; | |
| 153 | + uint32_t gc_num_gl2c; | |
| 154 | + uint32_t gc_num_gprs; | |
| 155 | + uint32_t gc_num_max_gs_thds; | |
| 156 | + uint32_t gc_gs_table_depth; | |
| 157 | + uint32_t gc_gsprim_buff_depth; | |
| 158 | + uint32_t gc_parameter_cache_depth; | |
| 159 | + uint32_t gc_double_offchip_lds_buffer; | |
| 160 | + uint32_t gc_wave_size; | |
| 161 | + uint32_t gc_max_waves_per_simd; | |
| 162 | + uint32_t gc_max_scratch_slots_per_cu; | |
| 163 | + uint32_t gc_lds_size; | |
| 164 | + uint32_t gc_num_sc_per_se; | |
| 165 | + uint32_t gc_num_sa_per_se; | |
| 166 | + uint32_t gc_num_packer_per_sc; | |
| 167 | + uint32_t gc_num_gl2a; | |
| 168 | + uint32_t gc_num_tcp_per_sa; | |
| 169 | + uint32_t gc_num_sdp_interface; | |
| 170 | + uint32_t gc_num_tcps; | |
| 171 | +}; | |
| 172 | + | |
| 173 | +struct gc_info_v2_0 { | |
| 174 | + struct gpu_info_header header; | |
| 175 | + | |
| 176 | + uint32_t gc_num_se; | |
| 177 | + uint32_t gc_num_cu_per_sh; | |
| 178 | + uint32_t gc_num_sh_per_se; | |
| 179 | + uint32_t gc_num_rb_per_se; | |
| 180 | + uint32_t gc_num_tccs; | |
| 181 | + uint32_t gc_num_gprs; | |
| 182 | + uint32_t gc_num_max_gs_thds; | |
| 183 | + uint32_t gc_gs_table_depth; | |
| 184 | + uint32_t gc_gsprim_buff_depth; | |
| 185 | + uint32_t gc_parameter_cache_depth; | |
| 186 | + uint32_t gc_double_offchip_lds_buffer; | |
| 187 | + uint32_t gc_wave_size; | |
| 188 | + uint32_t gc_max_waves_per_simd; | |
| 189 | + uint32_t gc_max_scratch_slots_per_cu; | |
| 190 | + uint32_t gc_lds_size; | |
| 191 | + uint32_t gc_num_sc_per_se; | |
| 192 | + uint32_t gc_num_packer_per_sc; | |
| 193 | +}; | |
| 194 | + | |
| 146 | 195 | typedef struct harvest_info_header { |
| 147 | 196 | uint32_t signature; /* Table Signature */ |
| 148 | 197 | uint32_t version; /* Table Version */ |
| @@ -2090,7 +2090,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · 2089 unmodified lines | ||
| 2090 | 2090 | } else if (DEVICE_ATTR_IS(unique_id)) { |
| 2091 | 2091 | if (asic_type != CHIP_VEGA10 && |
| 2092 | 2092 | asic_type != CHIP_VEGA20 && |
| 2093 | − asic_type != CHIP_ARCTURUS) | |
| 2093 | + asic_type != CHIP_ARCTURUS && | |
| 2094 | + asic_type != CHIP_ALDEBARAN) | |
| 2094 | 2095 | *states = ATTR_STATE_UNSUPPORTED; |
| 2095 | 2096 | } else if (DEVICE_ATTR_IS(pp_features)) { |
| 2096 | 2097 | if (adev->flags & AMD_IS_APU || asic_type < CHIP_VEGA10) |
| @@ -2133,6 +2134,12 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · 36 unmodified lines | ||
| 2133 | 2134 | } |
| 2134 | 2135 | } |
| 2135 | 2136 | |
| 2137 | + /* setting should not be allowed from VF */ | |
| 2138 | + if (amdgpu_sriov_vf(adev)) { | |
| 2139 | + dev_attr->attr.mode &= ~S_IWUGO; | |
| 2140 | + dev_attr->store = NULL; | |
| 2141 | + } | |
| 2142 | + | |
| 2136 | 2143 | #undef DEVICE_ATTR_IS |
| 2137 | 2144 | |
| 2138 | 2145 | return 0; |
| @@ -102,7 +102,9 @@ · 101 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | #define PPSMC_MSG_GfxDriverResetRecovery 0x42 |
| 104 | 104 | #define PPSMC_MSG_BoardPowerCalibration 0x43 |
| 105 | −#define PPSMC_Message_Count 0x44 | |
| 105 | +#define PPSMC_MSG_HeavySBR 0x45 | |
| 106 | +#define PPSMC_Message_Count 0x46 | |
| 107 | + | |
| 106 | 108 | |
| 107 | 109 | //PPSMC Reset Types |
| 108 | 110 | #define PPSMC_RESET_TYPE_WARM_RESET 0x00 |
| @@ -1257,9 +1257,9 @@ struct pptable_funcs { · 1256 unmodified lines | ||
| 1257 | 1257 | int (*set_fine_grain_gfx_freq_parameters)(struct smu_context *smu); |
| 1258 | 1258 | |
| 1259 | 1259 | /** |
| 1260 | − * @set_light_sbr: Set light sbr mode for the SMU. | |
| 1260 | + * @smu_handle_passthrough_sbr: Send message to SMU about special handling for SBR. | |
| 1261 | 1261 | */ |
| 1262 | − int (*set_light_sbr)(struct smu_context *smu, bool enable); | |
| 1262 | + int (*smu_handle_passthrough_sbr)(struct smu_context *smu, bool enable); | |
| 1263 | 1263 | |
| 1264 | 1264 | /** |
| 1265 | 1265 | * @wait_for_event: Wait for events from SMU. |
| @@ -1415,7 +1415,7 @@ int smu_allow_xgmi_power_down(struct smu_context *smu, bool en); · 149 unmodified lines | ||
| 1415 | 1415 | |
| 1416 | 1416 | int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value); |
| 1417 | 1417 | |
| 1418 | −int smu_set_light_sbr(struct smu_context *smu, bool enable); | |
| 1418 | +int smu_handle_passthrough_sbr(struct smu_context *smu, bool enable); | |
| 1419 | 1419 | |
| 1420 | 1420 | int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, |
| 1421 | 1421 | uint64_t event_arg); |
| @@ -229,7 +229,8 @@ · 228 unmodified lines | ||
| 229 | 229 | __SMU_DUMMY_MAP(BoardPowerCalibration), \ |
| 230 | 230 | __SMU_DUMMY_MAP(RequestGfxclk), \ |
| 231 | 231 | __SMU_DUMMY_MAP(ForceGfxVid), \ |
| 232 | − __SMU_DUMMY_MAP(UnforceGfxVid), | |
| 232 | + __SMU_DUMMY_MAP(UnforceGfxVid), \ | |
| 233 | + __SMU_DUMMY_MAP(HeavySBR), | |
| 233 | 234 | |
| 234 | 235 | #undef __SMU_DUMMY_MAP |
| 235 | 236 | #define __SMU_DUMMY_MAP(type) SMU_MSG_##type |
| @@ -312,7 +312,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu, · 311 unmodified lines | ||
| 312 | 312 | |
| 313 | 313 | void smu_v11_0_interrupt_work(struct smu_context *smu); |
| 314 | 314 | |
| 315 | −int smu_v11_0_set_light_sbr(struct smu_context *smu, bool enable); | |
| 315 | +int smu_v11_0_handle_passthrough_sbr(struct smu_context *smu, bool enable); | |
| 316 | 316 | |
| 317 | 317 | int smu_v11_0_restore_user_od_settings(struct smu_context *smu); |
| 318 | 318 | |
| @@ -1569,9 +1569,7 @@ static int smu_suspend(void *handle) · 1568 unmodified lines | ||
| 1569 | 1569 | |
| 1570 | 1570 | smu->watermarks_bitmap &= ~(WATERMARKS_LOADED); |
| 1571 | 1571 | |
| 1572 | − /* skip CGPG when in S0ix */ | |
| 1573 | − if (smu->is_apu && !adev->in_s0ix) | |
| 1574 | − smu_set_gfx_cgpg(&adev->smu, false); | |
| 1572 | + smu_set_gfx_cgpg(&adev->smu, false); | |
| 1575 | 1573 | |
| 1576 | 1574 | return 0; |
| 1577 | 1575 | } |
| @@ -1602,8 +1600,7 @@ static int smu_resume(void *handle) · 24 unmodified lines | ||
| 1602 | 1600 | return ret; |
| 1603 | 1601 | } |
| 1604 | 1602 | |
| 1605 | − if (smu->is_apu) | |
| 1606 | − smu_set_gfx_cgpg(&adev->smu, true); | |
| 1603 | + smu_set_gfx_cgpg(&adev->smu, true); | |
| 1607 | 1604 | |
| 1608 | 1605 | smu->disable_uclk_switch = 0; |
| 1609 | 1606 | |
| @@ -3061,13 +3058,13 @@ static int smu_gfx_state_change_set(void *handle, · 1451 unmodified lines | ||
| 3061 | 3058 | return ret; |
| 3062 | 3059 | } |
| 3063 | 3060 | |
| 3064 | −int smu_set_light_sbr(struct smu_context *smu, bool enable) | |
| 3061 | +int smu_handle_passthrough_sbr(struct smu_context *smu, bool enable) | |
| 3065 | 3062 | { |
| 3066 | 3063 | int ret = 0; |
| 3067 | 3064 | |
| 3068 | 3065 | mutex_lock(&smu->mutex); |
| 3069 | − if (smu->ppt_funcs->set_light_sbr) | |
| 3070 | − ret = smu->ppt_funcs->set_light_sbr(smu, enable); | |
| 3066 | + if (smu->ppt_funcs->smu_handle_passthrough_sbr) | |
| 3067 | + ret = smu->ppt_funcs->smu_handle_passthrough_sbr(smu, enable); | |
| 3071 | 3068 | mutex_unlock(&smu->mutex); |
| 3072 | 3069 | |
| 3073 | 3070 | return ret; |
| @@ -2472,7 +2472,7 @@ static const struct pptable_funcs arcturus_ppt_funcs = { · 2471 unmodified lines | ||
| 2472 | 2472 | .deep_sleep_control = smu_v11_0_deep_sleep_control, |
| 2473 | 2473 | .get_fan_parameters = arcturus_get_fan_parameters, |
| 2474 | 2474 | .interrupt_work = smu_v11_0_interrupt_work, |
| 2475 | − .set_light_sbr = smu_v11_0_set_light_sbr, | |
| 2475 | + .smu_handle_passthrough_sbr = smu_v11_0_handle_passthrough_sbr, | |
| 2476 | 2476 | .set_mp1_state = smu_cmn_set_mp1_state, |
| 2477 | 2477 | }; |
| 2478 | 2478 | |
| @@ -1724,7 +1724,7 @@ int smu_v11_0_mode1_reset(struct smu_context *smu) · 1723 unmodified lines | ||
| 1724 | 1724 | return ret; |
| 1725 | 1725 | } |
| 1726 | 1726 | |
| 1727 | −int smu_v11_0_set_light_sbr(struct smu_context *smu, bool enable) | |
| 1727 | +int smu_v11_0_handle_passthrough_sbr(struct smu_context *smu, bool enable) | |
| 1728 | 1728 | { |
| 1729 | 1729 | int ret = 0; |
| 1730 | 1730 | |
| @@ -120,7 +120,8 @@ int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate) · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | int smu_v12_0_set_gfx_cgpg(struct smu_context *smu, bool enable) |
| 122 | 122 | { |
| 123 | − if (!(smu->adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) | |
| 123 | + /* Until now the SMU12 only implemented for Renoir series so here neen't do APU check. */ | |
| 124 | + if (!(smu->adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) || smu->adev->in_s0ix) | |
| 124 | 125 | return 0; |
| 125 | 126 | |
| 126 | 127 | return smu_cmn_send_smc_msg_with_param(smu, |
| @@ -141,6 +141,7 @@ static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT · 140 unmodified lines | ||
| 141 | 141 | MSG_MAP(SetUclkDpmMode, PPSMC_MSG_SetUclkDpmMode, 0), |
| 142 | 142 | MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0), |
| 143 | 143 | MSG_MAP(BoardPowerCalibration, PPSMC_MSG_BoardPowerCalibration, 0), |
| 144 | + MSG_MAP(HeavySBR, PPSMC_MSG_HeavySBR, 0), | |
| 144 | 145 | }; |
| 145 | 146 | |
| 146 | 147 | static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] = { |
| @@ -1605,7 +1606,8 @@ out_unlock: · 1458 unmodified lines | ||
| 1605 | 1606 | mutex_unlock(&smu->metrics_lock); |
| 1606 | 1607 | |
| 1607 | 1608 | adev->unique_id = ((uint64_t)upper32 << 32) | lower32; |
| 1608 | − sprintf(adev->serial, "%016llx", adev->unique_id); | |
| 1609 | + if (adev->serial[0] == '\0') | |
| 1610 | + sprintf(adev->serial, "%016llx", adev->unique_id); | |
| 1609 | 1611 | } |
| 1610 | 1612 | |
| 1611 | 1613 | static bool aldebaran_is_baco_supported(struct smu_context *smu) |
| @@ -1625,7 +1627,7 @@ static int aldebaran_allow_xgmi_power_down(struct smu_context *smu, bool en) · 13 unmodified lines | ||
| 1625 | 1627 | { |
| 1626 | 1628 | return smu_cmn_send_smc_msg_with_param(smu, |
| 1627 | 1629 | SMU_MSG_GmiPwrDnControl, |
| 1628 | − en ? 1 : 0, | |
| 1630 | + en ? 0 : 1, | |
| 1629 | 1631 | NULL); |
| 1630 | 1632 | } |
| 1631 | 1633 | |
| @@ -1912,6 +1914,14 @@ out: · 280 unmodified lines | ||
| 1912 | 1914 | return ret; |
| 1913 | 1915 | } |
| 1914 | 1916 | |
| 1917 | +static int aldebaran_smu_handle_passthrough_sbr(struct smu_context *smu, bool enable) | |
| 1918 | +{ | |
| 1919 | + int ret = 0; | |
| 1920 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_HeavySBR, enable ? 1 : 0, NULL); | |
| 1921 | + | |
| 1922 | + return ret; | |
| 1923 | +} | |
| 1924 | + | |
| 1915 | 1925 | static bool aldebaran_is_mode1_reset_supported(struct smu_context *smu) |
| 1916 | 1926 | { |
| 1917 | 1927 | #if 0 |
| @@ -2021,6 +2031,7 @@ static const struct pptable_funcs aldebaran_ppt_funcs = { · 103 unmodified lines | ||
| 2021 | 2031 | .get_gpu_metrics = aldebaran_get_gpu_metrics, |
| 2022 | 2032 | .mode1_reset_is_support = aldebaran_is_mode1_reset_supported, |
| 2023 | 2033 | .mode2_reset_is_support = aldebaran_is_mode2_reset_supported, |
| 2034 | + .smu_handle_passthrough_sbr = aldebaran_smu_handle_passthrough_sbr, | |
| 2024 | 2035 | .mode1_reset = aldebaran_mode1_reset, |
| 2025 | 2036 | .set_mp1_state = aldebaran_set_mp1_state, |
| 2026 | 2037 | .mode2_reset = aldebaran_mode2_reset, |
| @@ -212,7 +212,7 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) · 211 unmodified lines | ||
| 212 | 212 | if (smu->is_apu) |
| 213 | 213 | adev->pm.fw_version = smu_version; |
| 214 | 214 | |
| 215 | − switch (smu->adev->ip_versions[MP1_HWIP][0]) { | |
| 215 | + switch (adev->ip_versions[MP1_HWIP][0]) { | |
| 216 | 216 | case IP_VERSION(13, 0, 2): |
| 217 | 217 | smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_ALDE; |
| 218 | 218 | break; |
| @@ -221,12 +221,17 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) · 2 unmodified lines | ||
| 221 | 221 | smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_YELLOW_CARP; |
| 222 | 222 | break; |
| 223 | 223 | default: |
| 224 | − dev_err(smu->adev->dev, "smu unsupported IP version: 0x%x.\n", | |
| 225 | − smu->adev->ip_versions[MP1_HWIP][0]); | |
| 224 | + dev_err(adev->dev, "smu unsupported IP version: 0x%x.\n", | |
| 225 | + adev->ip_versions[MP1_HWIP][0]); | |
| 226 | 226 | smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_INV; |
| 227 | 227 | break; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | + /* only for dGPU w/ SMU13*/ | |
| 231 | + if (adev->pm.fw) | |
| 232 | + dev_dbg(adev->dev, "smu fw reported version = 0x%08x (%d.%d.%d)\n", | |
| 233 | + smu_version, smu_major, smu_minor, smu_debug); | |
| 234 | + | |
| 230 | 235 | /* |
| 231 | 236 | * 1. if_version mismatch is not critical as our fw is designed |
| 232 | 237 | * to be backward compatible. |
| @@ -236,11 +241,11 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) · 3 unmodified lines | ||
| 236 | 241 | * of halt driver loading. |
| 237 | 242 | */ |
| 238 | 243 | if (if_version != smu->smc_driver_if_version) { |
| 239 | − dev_info(smu->adev->dev, "smu driver if version = 0x%08x, smu fw if version = 0x%08x, " | |
| 244 | + dev_info(adev->dev, "smu driver if version = 0x%08x, smu fw if version = 0x%08x, " | |
| 240 | 245 | "smu fw version = 0x%08x (%d.%d.%d)\n", |
| 241 | 246 | smu->smc_driver_if_version, if_version, |
| 242 | 247 | smu_version, smu_major, smu_minor, smu_debug); |
| 243 | − dev_warn(smu->adev->dev, "SMU driver if version not matched\n"); | |
| 248 | + dev_warn(adev->dev, "SMU driver if version not matched\n"); | |
| 244 | 249 | } |
| 245 | 250 | |
| 246 | 251 | return ret; |