amd-drm-fixes-6.9-2024-05-01: amdgpu: - Fix VRAM memory accounting - DCN 3.1 fixes - DCN 2.0 fix - DCN 3.1.5 fix - DCN 3.5 fix - DCN 3.2.1 fix - DP fixes - Seamless boot fix - Fix call order in amdgpu_ttm_move() - Fix doorbell regression - Disable panel replay temporarily amdkfd: - Flush wq before creating kfd process Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -220,7 +220,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev, · 219 unmodified lines | |||
| 220 | (kfd_mem_limit.ttm_mem_used + ttm_mem_needed > | 220 | (kfd_mem_limit.ttm_mem_used + ttm_mem_needed > |
| 221 | kfd_mem_limit.max_ttm_mem_limit) || | 221 | kfd_mem_limit.max_ttm_mem_limit) || |
| 222 | (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed > | 222 | (adev && xcp_id >= 0 && adev->kfd.vram_used[xcp_id] + vram_needed > |
| 223 | vram_size - reserved_for_pt)) { | 223 | vram_size - reserved_for_pt - atomic64_read(&adev->vram_pin_size))) { |
| 224 | ret = -ENOMEM; | 224 | ret = -ENOMEM; |
| 225 | goto release; | 225 | goto release; |
| 226 | } | 226 | } |
| @@ -1243,14 +1243,18 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, · 1242 unmodified lines | |||
| 1243 | * amdgpu_bo_move_notify - notification about a memory move | 1243 | * amdgpu_bo_move_notify - notification about a memory move |
| 1244 | * @bo: pointer to a buffer object | 1244 | * @bo: pointer to a buffer object |
| 1245 | * @evict: if this move is evicting the buffer from the graphics address space | 1245 | * @evict: if this move is evicting the buffer from the graphics address space |
| 1246 | * @new_mem: new resource for backing the BO | ||
| 1246 | * | 1247 | * |
| 1247 | * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs | 1248 | * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs |
| 1248 | * bookkeeping. | 1249 | * bookkeeping. |
| 1249 | * TTM driver callback which is called when ttm moves a buffer. | 1250 | * TTM driver callback which is called when ttm moves a buffer. |
| 1250 | */ | 1251 | */ |
| 1251 | void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) | 1252 | void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, |
| 1253 | bool evict, | ||
| 1254 | struct ttm_resource *new_mem) | ||
| 1252 | { | 1255 | { |
| 1253 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); | 1256 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); |
| 1257 | struct ttm_resource *old_mem = bo->resource; | ||
| 1254 | struct amdgpu_bo *abo; | 1258 | struct amdgpu_bo *abo; |
| 1255 | 1259 | ||
| 1256 | if (!amdgpu_bo_is_amdgpu_bo(bo)) | 1260 | if (!amdgpu_bo_is_amdgpu_bo(bo)) |
| @@ -1262,12 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) · 5 unmodified lines | |||
| 1262 | amdgpu_bo_kunmap(abo); | 1266 | amdgpu_bo_kunmap(abo); |
| 1263 | 1267 | ||
| 1264 | if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && | 1268 | if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && |
| 1265 | bo->resource->mem_type != TTM_PL_SYSTEM) | 1269 | old_mem && old_mem->mem_type != TTM_PL_SYSTEM) |
| 1266 | dma_buf_move_notify(abo->tbo.base.dma_buf); | 1270 | dma_buf_move_notify(abo->tbo.base.dma_buf); |
| 1267 | 1271 | ||
| 1268 | /* remember the eviction */ | 1272 | /* move_notify is called before move happens */ |
| 1269 | if (evict) | 1273 | trace_amdgpu_bo_move(abo, new_mem ? new_mem->mem_type : -1, |
| 1270 | atomic64_inc(&adev->num_evictions); | 1274 | old_mem ? old_mem->mem_type : -1); |
| 1271 | } | 1275 | } |
| 1272 | 1276 | ||
| 1273 | void amdgpu_bo_get_memory(struct amdgpu_bo *bo, | 1277 | void amdgpu_bo_get_memory(struct amdgpu_bo *bo, |
| @@ -328,7 +328,9 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, · 327 unmodified lines | |||
| 328 | int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, | 328 | int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer, |
| 329 | size_t buffer_size, uint32_t *metadata_size, | 329 | size_t buffer_size, uint32_t *metadata_size, |
| 330 | uint64_t *flags); | 330 | uint64_t *flags); |
| 331 | void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict); | 331 | void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, |
| 332 | bool evict, | ||
| 333 | struct ttm_resource *new_mem); | ||
| 332 | void amdgpu_bo_release_notify(struct ttm_buffer_object *bo); | 334 | void amdgpu_bo_release_notify(struct ttm_buffer_object *bo); |
| 333 | vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); | 335 | vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo); |
| 334 | void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence, | 336 | void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence, |
| @@ -419,7 +419,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev, · 418 unmodified lines | |||
| 419 | return false; | 419 | return false; |
| 420 | 420 | ||
| 421 | if (res->mem_type == TTM_PL_SYSTEM || res->mem_type == TTM_PL_TT || | 421 | if (res->mem_type == TTM_PL_SYSTEM || res->mem_type == TTM_PL_TT || |
| 422 | res->mem_type == AMDGPU_PL_PREEMPT) | 422 | res->mem_type == AMDGPU_PL_PREEMPT || res->mem_type == AMDGPU_PL_DOORBELL) |
| 423 | return true; | 423 | return true; |
| 424 | 424 | ||
| 425 | if (res->mem_type != TTM_PL_VRAM) | 425 | if (res->mem_type != TTM_PL_VRAM) |
| @@ -481,14 +481,16 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 55 unmodified lines | |||
| 481 | 481 | ||
| 482 | if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && | 482 | if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && |
| 483 | bo->ttm == NULL)) { | 483 | bo->ttm == NULL)) { |
| 484 | amdgpu_bo_move_notify(bo, evict, new_mem); | ||
| 484 | ttm_bo_move_null(bo, new_mem); | 485 | ttm_bo_move_null(bo, new_mem); |
| 485 | goto out; | 486 | return 0; |
| 486 | } | 487 | } |
| 487 | if (old_mem->mem_type == TTM_PL_SYSTEM && | 488 | if (old_mem->mem_type == TTM_PL_SYSTEM && |
| 488 | (new_mem->mem_type == TTM_PL_TT || | 489 | (new_mem->mem_type == TTM_PL_TT || |
| 489 | new_mem->mem_type == AMDGPU_PL_PREEMPT)) { | 490 | new_mem->mem_type == AMDGPU_PL_PREEMPT)) { |
| 491 | amdgpu_bo_move_notify(bo, evict, new_mem); | ||
| 490 | ttm_bo_move_null(bo, new_mem); | 492 | ttm_bo_move_null(bo, new_mem); |
| 491 | goto out; | 493 | return 0; |
| 492 | } | 494 | } |
| 493 | if ((old_mem->mem_type == TTM_PL_TT || | 495 | if ((old_mem->mem_type == TTM_PL_TT || |
| 494 | old_mem->mem_type == AMDGPU_PL_PREEMPT) && | 496 | old_mem->mem_type == AMDGPU_PL_PREEMPT) && |
| @@ -498,9 +500,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 3 unmodified lines | |||
| 498 | return r; | 500 | return r; |
| 499 | 501 | ||
| 500 | amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm); | 502 | amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm); |
| 503 | amdgpu_bo_move_notify(bo, evict, new_mem); | ||
| 501 | ttm_resource_free(bo, &bo->resource); | 504 | ttm_resource_free(bo, &bo->resource); |
| 502 | ttm_bo_assign_mem(bo, new_mem); | 505 | ttm_bo_assign_mem(bo, new_mem); |
| 503 | goto out; | 506 | return 0; |
| 504 | } | 507 | } |
| 505 | 508 | ||
| 506 | if (old_mem->mem_type == AMDGPU_PL_GDS || | 509 | if (old_mem->mem_type == AMDGPU_PL_GDS || |
| @@ -512,8 +515,9 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 5 unmodified lines | |||
| 512 | new_mem->mem_type == AMDGPU_PL_OA || | 515 | new_mem->mem_type == AMDGPU_PL_OA || |
| 513 | new_mem->mem_type == AMDGPU_PL_DOORBELL) { | 516 | new_mem->mem_type == AMDGPU_PL_DOORBELL) { |
| 514 | /* Nothing to save here */ | 517 | /* Nothing to save here */ |
| 518 | amdgpu_bo_move_notify(bo, evict, new_mem); | ||
| 515 | ttm_bo_move_null(bo, new_mem); | 519 | ttm_bo_move_null(bo, new_mem); |
| 516 | goto out; | 520 | return 0; |
| 517 | } | 521 | } |
| 518 | 522 | ||
| 519 | if (bo->type == ttm_bo_type_device && | 523 | if (bo->type == ttm_bo_type_device && |
| @@ -525,22 +529,23 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 5 unmodified lines | |||
| 525 | abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; | 529 | abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; |
| 526 | } | 530 | } |
| 527 | 531 | ||
| 528 | if (adev->mman.buffer_funcs_enabled) { | 532 | if (adev->mman.buffer_funcs_enabled && |
| 529 | if (((old_mem->mem_type == TTM_PL_SYSTEM && | 533 | ((old_mem->mem_type == TTM_PL_SYSTEM && |
| 530 | new_mem->mem_type == TTM_PL_VRAM) || | 534 | new_mem->mem_type == TTM_PL_VRAM) || |
| 531 | (old_mem->mem_type == TTM_PL_VRAM && | 535 | (old_mem->mem_type == TTM_PL_VRAM && |
| 532 | new_mem->mem_type == TTM_PL_SYSTEM))) { | 536 | new_mem->mem_type == TTM_PL_SYSTEM))) { |
| 533 | hop->fpfn = 0; | 537 | hop->fpfn = 0; |
| 534 | hop->lpfn = 0; | 538 | hop->lpfn = 0; |
| 535 | hop->mem_type = TTM_PL_TT; | 539 | hop->mem_type = TTM_PL_TT; |
| 536 | hop->flags = TTM_PL_FLAG_TEMPORARY; | 540 | hop->flags = TTM_PL_FLAG_TEMPORARY; |
| 537 | return -EMULTIHOP; | 541 | return -EMULTIHOP; |
| 538 | } | 542 | } |
| 539 | 543 | ||
| 544 | amdgpu_bo_move_notify(bo, evict, new_mem); | ||
| 545 | if (adev->mman.buffer_funcs_enabled) | ||
| 540 | r = amdgpu_move_blit(bo, evict, new_mem, old_mem); | 546 | r = amdgpu_move_blit(bo, evict, new_mem, old_mem); |
| 541 | } else { | 547 | else |
| 542 | r = -ENODEV; | 548 | r = -ENODEV; |
| 543 | } | ||
| 544 | 549 | ||
| 545 | if (r) { | 550 | if (r) { |
| 546 | /* Check that all memory is CPU accessible */ | 551 | /* Check that all memory is CPU accessible */ |
| @@ -555,11 +560,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 8 unmodified lines | |||
| 555 | return r; | 560 | return r; |
| 556 | } | 561 | } |
| 557 | 562 | ||
| 558 | trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type); | 563 | /* update statistics after the move */ |
| 559 | out: | 564 | if (evict) |
| 560 | /* update statistics */ | 565 | atomic64_inc(&adev->num_evictions); |
| 561 | atomic64_add(bo->base.size, &adev->num_bytes_moved); | 566 | atomic64_add(bo->base.size, &adev->num_bytes_moved); |
| 562 | amdgpu_bo_move_notify(bo, evict); | ||
| 563 | return 0; | 567 | return 0; |
| 564 | } | 568 | } |
| 565 | 569 | ||
| @@ -1559,7 +1563,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo, · 993 unmodified lines | |||
| 1559 | static void | 1563 | static void |
| 1560 | amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo) | 1564 | amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo) |
| 1561 | { | 1565 | { |
| 1562 | amdgpu_bo_move_notify(bo, false); | 1566 | amdgpu_bo_move_notify(bo, false, NULL); |
| 1563 | } | 1567 | } |
| 1564 | 1568 | ||
| 1565 | static struct ttm_device_funcs amdgpu_bo_driver = { | 1569 | static struct ttm_device_funcs amdgpu_bo_driver = { |
| @@ -829,6 +829,14 @@ struct kfd_process *kfd_create_process(struct task_struct *thread) · 828 unmodified lines | |||
| 829 | if (process) { | 829 | if (process) { |
| 830 | pr_debug("Process already found\n"); | 830 | pr_debug("Process already found\n"); |
| 831 | } else { | 831 | } else { |
| 832 | /* If the process just called exec(3), it is possible that the | ||
| 833 | * cleanup of the kfd_process (following the release of the mm | ||
| 834 | * of the old process image) is still in the cleanup work queue. | ||
| 835 | * Make sure to drain any job before trying to recreate any | ||
| 836 | * resource for this process. | ||
| 837 | */ | ||
| 838 | flush_workqueue(kfd_process_wq); | ||
| 839 | |||
| 832 | process = create_process(thread); | 840 | process = create_process(thread); |
| 833 | if (IS_ERR(process)) | 841 | if (IS_ERR(process)) |
| 834 | goto out; | 842 | goto out; |
| @@ -4537,15 +4537,18 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 4536 unmodified lines | |||
| 4537 | /* Determine whether to enable Replay support by default. */ | 4537 | /* Determine whether to enable Replay support by default. */ |
| 4538 | if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { | 4538 | if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { |
| 4539 | switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) { | 4539 | switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) { |
| 4540 | case IP_VERSION(3, 1, 4): | 4540 | /* |
| 4541 | case IP_VERSION(3, 1, 5): | 4541 | * Disabled by default due to https://gitlab.freedesktop.org/drm/amd/-/issues/3344 |
| 4542 | case IP_VERSION(3, 1, 6): | 4542 | * case IP_VERSION(3, 1, 4): |
| 4543 | case IP_VERSION(3, 2, 0): | 4543 | * case IP_VERSION(3, 1, 5): |
| 4544 | case IP_VERSION(3, 2, 1): | 4544 | * case IP_VERSION(3, 1, 6): |
| 4545 | case IP_VERSION(3, 5, 0): | 4545 | * case IP_VERSION(3, 2, 0): |
| 4546 | case IP_VERSION(3, 5, 1): | 4546 | * case IP_VERSION(3, 2, 1): |
| 4547 | replay_feature_enabled = true; | 4547 | * case IP_VERSION(3, 5, 0): |
| 4548 | break; | 4548 | * case IP_VERSION(3, 5, 1): |
| 4549 | * replay_feature_enabled = true; | ||
| 4550 | * break; | ||
| 4551 | */ | ||
| 4549 | default: | 4552 | default: |
| 4550 | replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; | 4553 | replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; |
| 4551 | break; | 4554 | break; |
| @@ -1495,7 +1495,9 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf, · 1494 unmodified lines | |||
| 1495 | for (i = 0; i < MAX_PIPES; i++) { | 1495 | for (i = 0; i < MAX_PIPES; i++) { |
| 1496 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1496 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1497 | if (pipe_ctx->stream && | 1497 | if (pipe_ctx->stream && |
| 1498 | pipe_ctx->stream->link == aconnector->dc_link) | 1498 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1499 | pipe_ctx->stream->sink && | ||
| 1500 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1499 | break; | 1501 | break; |
| 1500 | } | 1502 | } |
| 1501 | 1503 | ||
| @@ -1596,7 +1598,9 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf, · 94 unmodified lines | |||
| 1596 | for (i = 0; i < MAX_PIPES; i++) { | 1598 | for (i = 0; i < MAX_PIPES; i++) { |
| 1597 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1599 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1598 | if (pipe_ctx->stream && | 1600 | if (pipe_ctx->stream && |
| 1599 | pipe_ctx->stream->link == aconnector->dc_link) | 1601 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1602 | pipe_ctx->stream->sink && | ||
| 1603 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1600 | break; | 1604 | break; |
| 1601 | } | 1605 | } |
| 1602 | 1606 | ||
| @@ -1681,7 +1685,9 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf, · 78 unmodified lines | |||
| 1681 | for (i = 0; i < MAX_PIPES; i++) { | 1685 | for (i = 0; i < MAX_PIPES; i++) { |
| 1682 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1686 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1683 | if (pipe_ctx->stream && | 1687 | if (pipe_ctx->stream && |
| 1684 | pipe_ctx->stream->link == aconnector->dc_link) | 1688 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1689 | pipe_ctx->stream->sink && | ||
| 1690 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1685 | break; | 1691 | break; |
| 1686 | } | 1692 | } |
| 1687 | 1693 | ||
| @@ -1780,7 +1786,9 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf, · 92 unmodified lines | |||
| 1780 | for (i = 0; i < MAX_PIPES; i++) { | 1786 | for (i = 0; i < MAX_PIPES; i++) { |
| 1781 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1787 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1782 | if (pipe_ctx->stream && | 1788 | if (pipe_ctx->stream && |
| 1783 | pipe_ctx->stream->link == aconnector->dc_link) | 1789 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1790 | pipe_ctx->stream->sink && | ||
| 1791 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1784 | break; | 1792 | break; |
| 1785 | } | 1793 | } |
| 1786 | 1794 | ||
| @@ -1865,7 +1873,9 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf, · 78 unmodified lines | |||
| 1865 | for (i = 0; i < MAX_PIPES; i++) { | 1873 | for (i = 0; i < MAX_PIPES; i++) { |
| 1866 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1874 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1867 | if (pipe_ctx->stream && | 1875 | if (pipe_ctx->stream && |
| 1868 | pipe_ctx->stream->link == aconnector->dc_link) | 1876 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1877 | pipe_ctx->stream->sink && | ||
| 1878 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1869 | break; | 1879 | break; |
| 1870 | } | 1880 | } |
| 1871 | 1881 | ||
| @@ -1964,7 +1974,9 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf, · 92 unmodified lines | |||
| 1964 | for (i = 0; i < MAX_PIPES; i++) { | 1974 | for (i = 0; i < MAX_PIPES; i++) { |
| 1965 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 1975 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 1966 | if (pipe_ctx->stream && | 1976 | if (pipe_ctx->stream && |
| 1967 | pipe_ctx->stream->link == aconnector->dc_link) | 1977 | pipe_ctx->stream->link == aconnector->dc_link && |
| 1978 | pipe_ctx->stream->sink && | ||
| 1979 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 1968 | break; | 1980 | break; |
| 1969 | } | 1981 | } |
| 1970 | 1982 | ||
| @@ -2045,7 +2057,9 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf, · 74 unmodified lines | |||
| 2045 | for (i = 0; i < MAX_PIPES; i++) { | 2057 | for (i = 0; i < MAX_PIPES; i++) { |
| 2046 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2058 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2047 | if (pipe_ctx->stream && | 2059 | if (pipe_ctx->stream && |
| 2048 | pipe_ctx->stream->link == aconnector->dc_link) | 2060 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2061 | pipe_ctx->stream->sink && | ||
| 2062 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2049 | break; | 2063 | break; |
| 2050 | } | 2064 | } |
| 2051 | 2065 | ||
| @@ -2141,7 +2155,9 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bu · 89 unmodified lines | |||
| 2141 | for (i = 0; i < MAX_PIPES; i++) { | 2155 | for (i = 0; i < MAX_PIPES; i++) { |
| 2142 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2156 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2143 | if (pipe_ctx->stream && | 2157 | if (pipe_ctx->stream && |
| 2144 | pipe_ctx->stream->link == aconnector->dc_link) | 2158 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2159 | pipe_ctx->stream->sink && | ||
| 2160 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2145 | break; | 2161 | break; |
| 2146 | } | 2162 | } |
| 2147 | 2163 | ||
| @@ -2220,7 +2236,9 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf, · 72 unmodified lines | |||
| 2220 | for (i = 0; i < MAX_PIPES; i++) { | 2236 | for (i = 0; i < MAX_PIPES; i++) { |
| 2221 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2237 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2222 | if (pipe_ctx->stream && | 2238 | if (pipe_ctx->stream && |
| 2223 | pipe_ctx->stream->link == aconnector->dc_link) | 2239 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2240 | pipe_ctx->stream->sink && | ||
| 2241 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2224 | break; | 2242 | break; |
| 2225 | } | 2243 | } |
| 2226 | 2244 | ||
| @@ -2276,7 +2294,9 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf, · 49 unmodified lines | |||
| 2276 | for (i = 0; i < MAX_PIPES; i++) { | 2294 | for (i = 0; i < MAX_PIPES; i++) { |
| 2277 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2295 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2278 | if (pipe_ctx->stream && | 2296 | if (pipe_ctx->stream && |
| 2279 | pipe_ctx->stream->link == aconnector->dc_link) | 2297 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2298 | pipe_ctx->stream->sink && | ||
| 2299 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2280 | break; | 2300 | break; |
| 2281 | } | 2301 | } |
| 2282 | 2302 | ||
| @@ -2347,7 +2367,9 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf, · 64 unmodified lines | |||
| 2347 | for (i = 0; i < MAX_PIPES; i++) { | 2367 | for (i = 0; i < MAX_PIPES; i++) { |
| 2348 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2368 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2349 | if (pipe_ctx->stream && | 2369 | if (pipe_ctx->stream && |
| 2350 | pipe_ctx->stream->link == aconnector->dc_link) | 2370 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2371 | pipe_ctx->stream->sink && | ||
| 2372 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2351 | break; | 2373 | break; |
| 2352 | } | 2374 | } |
| 2353 | 2375 | ||
| @@ -2418,7 +2440,9 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf, · 64 unmodified lines | |||
| 2418 | for (i = 0; i < MAX_PIPES; i++) { | 2440 | for (i = 0; i < MAX_PIPES; i++) { |
| 2419 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; | 2441 | pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; |
| 2420 | if (pipe_ctx->stream && | 2442 | if (pipe_ctx->stream && |
| 2421 | pipe_ctx->stream->link == aconnector->dc_link) | 2443 | pipe_ctx->stream->link == aconnector->dc_link && |
| 2444 | pipe_ctx->stream->sink && | ||
| 2445 | pipe_ctx->stream->sink == aconnector->dc_sink) | ||
| 2422 | break; | 2446 | break; |
| 2423 | } | 2447 | } |
| 2424 | 2448 | ||
| @@ -2948,6 +2948,7 @@ static enum bp_result construct_integrated_info( · 2947 unmodified lines | |||
| 2948 | result = get_integrated_info_v2_1(bp, info); | 2948 | result = get_integrated_info_v2_1(bp, info); |
| 2949 | break; | 2949 | break; |
| 2950 | case 2: | 2950 | case 2: |
| 2951 | case 3: | ||
| 2951 | result = get_integrated_info_v2_2(bp, info); | 2952 | result = get_integrated_info_v2_2(bp, info); |
| 2952 | break; | 2953 | break; |
| 2953 | default: | 2954 | default: |
| @@ -145,6 +145,10 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base, · 144 unmodified lines | |||
| 145 | */ | 145 | */ |
| 146 | clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; | 146 | clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; |
| 147 | if (safe_to_lower) { | 147 | if (safe_to_lower) { |
| 148 | if (clk_mgr_base->clks.dtbclk_en && !new_clocks->dtbclk_en) { | ||
| 149 | dcn315_smu_set_dtbclk(clk_mgr, false); | ||
| 150 | clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; | ||
| 151 | } | ||
| 148 | /* check that we're not already in lower */ | 152 | /* check that we're not already in lower */ |
| 149 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) { | 153 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) { |
| 150 | display_count = dcn315_get_active_display_cnt_wa(dc, context); | 154 | display_count = dcn315_get_active_display_cnt_wa(dc, context); |
| @@ -160,6 +164,10 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base, · 9 unmodified lines | |||
| 160 | } | 164 | } |
| 161 | } | 165 | } |
| 162 | } else { | 166 | } else { |
| 167 | if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) { | ||
| 168 | dcn315_smu_set_dtbclk(clk_mgr, true); | ||
| 169 | clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; | ||
| 170 | } | ||
| 163 | /* check that we're not already in D0 */ | 171 | /* check that we're not already in D0 */ |
| 164 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_MISSION_MODE) { | 172 | if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_MISSION_MODE) { |
| 165 | union display_idle_optimization_u idle_info = { 0 }; | 173 | union display_idle_optimization_u idle_info = { 0 }; |
| @@ -712,8 +712,12 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base, · 711 unmodified lines | |||
| 712 | * since we calculate mode support based on softmax being the max UCLK | 712 | * since we calculate mode support based on softmax being the max UCLK |
| 713 | * frequency. | 713 | * frequency. |
| 714 | */ | 714 | */ |
| 715 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, | 715 | if (dc->debug.disable_dc_mode_overwrite) { |
| 716 | dc->clk_mgr->bw_params->dc_mode_softmax_memclk); | 716 | dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); |
| 717 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); | ||
| 718 | } else | ||
| 719 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, | ||
| 720 | dc->clk_mgr->bw_params->dc_mode_softmax_memclk); | ||
| 717 | } else { | 721 | } else { |
| 718 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); | 722 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, dc->clk_mgr->bw_params->max_memclk_mhz); |
| 719 | } | 723 | } |
| @@ -746,8 +750,13 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base, · 26 unmodified lines | |||
| 746 | /* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ | 750 | /* set UCLK to requested value if P-State switching is supported, or to re-enable P-State switching */ |
| 747 | if (clk_mgr_base->clks.p_state_change_support && | 751 | if (clk_mgr_base->clks.p_state_change_support && |
| 748 | (update_uclk || !clk_mgr_base->clks.prev_p_state_change_support) && | 752 | (update_uclk || !clk_mgr_base->clks.prev_p_state_change_support) && |
| 749 | !dc->work_arounds.clock_update_disable_mask.uclk) | 753 | !dc->work_arounds.clock_update_disable_mask.uclk) { |
| 754 | if (dc->clk_mgr->dc_mode_softmax_enabled && dc->debug.disable_dc_mode_overwrite) | ||
| 755 | dcn30_smu_set_hard_max_by_freq(clk_mgr, PPCLK_UCLK, | ||
| 756 | max((int)dc->clk_mgr->bw_params->dc_mode_softmax_memclk, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz))); | ||
| 757 | |||
| 750 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz)); | 758 | dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_UCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dramclk_khz)); |
| 759 | } | ||
| 751 | 760 | ||
| 752 | if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && | 761 | if (clk_mgr_base->clks.num_ways != new_clocks->num_ways && |
| 753 | clk_mgr_base->clks.num_ways > new_clocks->num_ways) { | 762 | clk_mgr_base->clks.num_ways > new_clocks->num_ways) { |
| @@ -1801,6 +1801,9 @@ bool dc_validate_boot_timing(const struct dc *dc, · 1800 unmodified lines | |||
| 1801 | return false; | 1801 | return false; |
| 1802 | } | 1802 | } |
| 1803 | 1803 | ||
| 1804 | if (link->dpcd_caps.channel_coding_cap.bits.DP_128b_132b_SUPPORTED) | ||
| 1805 | return false; | ||
| 1806 | |||
| 1804 | if (dc->link_srv->edp_is_ilr_optimization_required(link, crtc_timing)) { | 1807 | if (dc->link_srv->edp_is_ilr_optimization_required(link, crtc_timing)) { |
| 1805 | DC_LOG_EVENT_LINK_TRAINING("Seamless boot disabled to optimize eDP link rate\n"); | 1808 | DC_LOG_EVENT_LINK_TRAINING("Seamless boot disabled to optimize eDP link rate\n"); |
| 1806 | return false; | 1809 | return false; |
| @@ -395,6 +395,12 @@ void dcn31_hpo_dp_link_enc_set_throttled_vcp_size( · 394 unmodified lines | |||
| 395 | x), | 395 | x), |
| 396 | 25)); | 396 | 25)); |
| 397 | 397 | ||
| 398 | // If y rounds up to integer, carry it over to x. | ||
| 399 | if (y >> 25) { | ||
| 400 | x += 1; | ||
| 401 | y = 0; | ||
| 402 | } | ||
| 403 | |||
| 398 | switch (stream_encoder_inst) { | 404 | switch (stream_encoder_inst) { |
| 399 | case 0: | 405 | case 0: |
| 400 | REG_SET_2(DP_DPHY_SYM32_VC_RATE_CNTL0, 0, | 406 | REG_SET_2(DP_DPHY_SYM32_VC_RATE_CNTL0, 0, |
| @@ -291,6 +291,7 @@ static struct _vcs_dpi_soc_bounding_box_st dcn3_15_soc = { · 290 unmodified lines | |||
| 291 | .do_urgent_latency_adjustment = false, | 291 | .do_urgent_latency_adjustment = false, |
| 292 | .urgent_latency_adjustment_fabric_clock_component_us = 0, | 292 | .urgent_latency_adjustment_fabric_clock_component_us = 0, |
| 293 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, | 293 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, |
| 294 | .dispclk_dppclk_vco_speed_mhz = 2400.0, | ||
| 294 | .num_chans = 4, | 295 | .num_chans = 4, |
| 295 | .dummy_pstate_latency_us = 10.0 | 296 | .dummy_pstate_latency_us = 10.0 |
| 296 | }; | 297 | }; |
| @@ -438,6 +439,7 @@ static struct _vcs_dpi_soc_bounding_box_st dcn3_16_soc = { · 141 unmodified lines | |||
| 438 | .do_urgent_latency_adjustment = false, | 439 | .do_urgent_latency_adjustment = false, |
| 439 | .urgent_latency_adjustment_fabric_clock_component_us = 0, | 440 | .urgent_latency_adjustment_fabric_clock_component_us = 0, |
| 440 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, | 441 | .urgent_latency_adjustment_fabric_clock_reference_mhz = 0, |
| 442 | .dispclk_dppclk_vco_speed_mhz = 2500.0, | ||
| 441 | }; | 443 | }; |
| 442 | 444 | ||
| 443 | void dcn31_zero_pipe_dcc_fraction(display_e2e_pipe_params_st *pipes, | 445 | void dcn31_zero_pipe_dcc_fraction(display_e2e_pipe_params_st *pipes, |
| @@ -270,7 +270,7 @@ static void set_usb4_req_bw_req(struct dc_link *link, int req_bw) · 269 unmodified lines | |||
| 270 | 270 | ||
| 271 | /* Error check whether requested and allocated are equal */ | 271 | /* Error check whether requested and allocated are equal */ |
| 272 | req_bw = requested_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); | 272 | req_bw = requested_bw * (Kbps_TO_Gbps / link->dpia_bw_alloc_config.bw_granularity); |
| 273 | if (req_bw == link->dpia_bw_alloc_config.allocated_bw) { | 273 | if (req_bw && (req_bw == link->dpia_bw_alloc_config.allocated_bw)) { |
| 274 | DC_LOG_ERROR("%s: Request bw equals to allocated bw for link(%d)\n", | 274 | DC_LOG_ERROR("%s: Request bw equals to allocated bw for link(%d)\n", |
| 275 | __func__, link->link_index); | 275 | __func__, link->link_index); |
| 276 | } | 276 | } |
| @@ -341,6 +341,14 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link) · 64 unmodified lines | |||
| 341 | ret = true; | 341 | ret = true; |
| 342 | init_usb4_bw_struct(link); | 342 | init_usb4_bw_struct(link); |
| 343 | link->dpia_bw_alloc_config.bw_alloc_enabled = true; | 343 | link->dpia_bw_alloc_config.bw_alloc_enabled = true; |
| 344 | |||
| 345 | /* | ||
| 346 | * During DP tunnel creation, CM preallocates BW and reduces estimated BW of other | ||
| 347 | * DPIA. CM release preallocation only when allocation is complete. Do zero alloc | ||
| 348 | * to make the CM to release preallocation and update estimated BW correctly for | ||
| 349 | * all DPIAs per host router | ||
| 350 | */ | ||
| 351 | link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, 0); | ||
| 344 | } | 352 | } |
| 345 | } | 353 | } |
| 346 | 354 | ||
| @@ -2449,6 +2449,7 @@ static bool dcn20_resource_construct( · 2448 unmodified lines | |||
| 2449 | dc->caps.post_blend_color_processing = true; | 2449 | dc->caps.post_blend_color_processing = true; |
| 2450 | dc->caps.force_dp_tps4_for_cp2520 = true; | 2450 | dc->caps.force_dp_tps4_for_cp2520 = true; |
| 2451 | dc->caps.extended_aux_timeout_support = true; | 2451 | dc->caps.extended_aux_timeout_support = true; |
| 2452 | dc->caps.dmcub_support = true; | ||
| 2452 | 2453 | ||
| 2453 | /* Color pipeline capabilities */ | 2454 | /* Color pipeline capabilities */ |
| 2454 | dc->caps.color.dpp.dcn_arch = 1; | 2455 | dc->caps.color.dpp.dcn_arch = 1; |