Skip to content

Commit b5a6660

Browse files
committed
Merge tag 'drm-fixes-2024-05-03' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Dave Airlie: "Weekly fixes, mostly made up from amdgpu and some panel changes. Otherwise xe, nouveau, vmwgfx and a couple of others, all seems pretty on track. 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 xe: - Fix UAF on rebind worker - Fix ADL-N display integration imagination: - fix page-count macro nouveau: - avoid page-table allocation failures - fix firmware memory allocation panel: - ili9341: avoid OF for device properties; respect deferred probe; fix usage of errno codes ttm: - fix status output vmwgfx: - fix legacy display unit - fix read length in fence signalling" * tag 'drm-fixes-2024-05-03' of https://gitlab.freedesktop.org/drm/kernel: (25 commits) drm/xe/display: Fix ADL-N detection drm/panel: ili9341: Use predefined error codes drm/panel: ili9341: Respect deferred probe drm/panel: ili9341: Correct use of device property APIs drm/xe/vm: prevent UAF in rebind_work_func() drm/amd/display: Disable panel replay by default for now drm/amdgpu: fix doorbell regression drm/amdkfd: Flush the process wq before creating a kfd_process drm/amd/display: Disable seamless boot on 128b/132b encoding drm/amd/display: Fix DC mode screen flickering on DCN321 drm/amd/display: Add VCO speed parameter for DCN31 FPU drm/amdgpu: once more fix the call oder in amdgpu_ttm_move() v2 drm/amd/display: Allocate zero bw after bw alloc enable drm/amd/display: Fix incorrect DSC instance for MST drm/amd/display: Atom Integrated System Info v2_2 for DCN35 drm/amd/display: Add dtbclk access to dcn315 drm/amd/display: Ensure that dmcub support flag is set for DCN20 drm/amd/display: Handle Y carry-over in VCP X.Y calculation drm/amdgpu: Fix VRAM memory accounting drm/vmwgfx: Fix invalid reads in fence signaled events ...
2 parents 9fbc8bd + 09e1049 commit b5a6660

File tree

26 files changed

+223
-101
lines changed

26 files changed

+223
-101
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
220220
(kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
221221
kfd_mem_limit.max_ttm_mem_limit) ||
222222
(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))) {
224224
ret = -ENOMEM;
225225
goto release;
226226
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,14 +1243,18 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
12431243
* amdgpu_bo_move_notify - notification about a memory move
12441244
* @bo: pointer to a buffer object
12451245
* @evict: if this move is evicting the buffer from the graphics address space
1246+
* @new_mem: new resource for backing the BO
12461247
*
12471248
* Marks the corresponding &amdgpu_bo buffer object as invalid, also performs
12481249
* bookkeeping.
12491250
* TTM driver callback which is called when ttm moves a buffer.
12501251
*/
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)
12521255
{
12531256
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
1257+
struct ttm_resource *old_mem = bo->resource;
12541258
struct amdgpu_bo *abo;
12551259

12561260
if (!amdgpu_bo_is_amdgpu_bo(bo))
@@ -1262,12 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict)
12621266
amdgpu_bo_kunmap(abo);
12631267

12641268
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)
12661270
dma_buf_move_notify(abo->tbo.base.dma_buf);
12671271

1268-
/* remember the eviction */
1269-
if (evict)
1270-
atomic64_inc(&adev->num_evictions);
1272+
/* move_notify is called before move happens */
1273+
trace_amdgpu_bo_move(abo, new_mem ? new_mem->mem_type : -1,
1274+
old_mem ? old_mem->mem_type : -1);
12711275
}
12721276

12731277
void amdgpu_bo_get_memory(struct amdgpu_bo *bo,

drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
328328
int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
329329
size_t buffer_size, uint32_t *metadata_size,
330330
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);
332334
void amdgpu_bo_release_notify(struct ttm_buffer_object *bo);
333335
vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
334336
void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,

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

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ bool amdgpu_res_cpu_visible(struct amdgpu_device *adev,
419419
return false;
420420

421421
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)
423423
return true;
424424

425425
if (res->mem_type != TTM_PL_VRAM)
@@ -481,14 +481,16 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
481481

482482
if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM &&
483483
bo->ttm == NULL)) {
484+
amdgpu_bo_move_notify(bo, evict, new_mem);
484485
ttm_bo_move_null(bo, new_mem);
485-
goto out;
486+
return 0;
486487
}
487488
if (old_mem->mem_type == TTM_PL_SYSTEM &&
488489
(new_mem->mem_type == TTM_PL_TT ||
489490
new_mem->mem_type == AMDGPU_PL_PREEMPT)) {
491+
amdgpu_bo_move_notify(bo, evict, new_mem);
490492
ttm_bo_move_null(bo, new_mem);
491-
goto out;
493+
return 0;
492494
}
493495
if ((old_mem->mem_type == TTM_PL_TT ||
494496
old_mem->mem_type == AMDGPU_PL_PREEMPT) &&
@@ -498,9 +500,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
498500
return r;
499501

500502
amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
503+
amdgpu_bo_move_notify(bo, evict, new_mem);
501504
ttm_resource_free(bo, &bo->resource);
502505
ttm_bo_assign_mem(bo, new_mem);
503-
goto out;
506+
return 0;
504507
}
505508

506509
if (old_mem->mem_type == AMDGPU_PL_GDS ||
@@ -512,8 +515,9 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
512515
new_mem->mem_type == AMDGPU_PL_OA ||
513516
new_mem->mem_type == AMDGPU_PL_DOORBELL) {
514517
/* Nothing to save here */
518+
amdgpu_bo_move_notify(bo, evict, new_mem);
515519
ttm_bo_move_null(bo, new_mem);
516-
goto out;
520+
return 0;
517521
}
518522

519523
if (bo->type == ttm_bo_type_device &&
@@ -525,22 +529,23 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
525529
abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
526530
}
527531

528-
if (adev->mman.buffer_funcs_enabled) {
529-
if (((old_mem->mem_type == TTM_PL_SYSTEM &&
530-
new_mem->mem_type == TTM_PL_VRAM) ||
531-
(old_mem->mem_type == TTM_PL_VRAM &&
532-
new_mem->mem_type == TTM_PL_SYSTEM))) {
533-
hop->fpfn = 0;
534-
hop->lpfn = 0;
535-
hop->mem_type = TTM_PL_TT;
536-
hop->flags = TTM_PL_FLAG_TEMPORARY;
537-
return -EMULTIHOP;
538-
}
532+
if (adev->mman.buffer_funcs_enabled &&
533+
((old_mem->mem_type == TTM_PL_SYSTEM &&
534+
new_mem->mem_type == TTM_PL_VRAM) ||
535+
(old_mem->mem_type == TTM_PL_VRAM &&
536+
new_mem->mem_type == TTM_PL_SYSTEM))) {
537+
hop->fpfn = 0;
538+
hop->lpfn = 0;
539+
hop->mem_type = TTM_PL_TT;
540+
hop->flags = TTM_PL_FLAG_TEMPORARY;
541+
return -EMULTIHOP;
542+
}
539543

544+
amdgpu_bo_move_notify(bo, evict, new_mem);
545+
if (adev->mman.buffer_funcs_enabled)
540546
r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
541-
} else {
547+
else
542548
r = -ENODEV;
543-
}
544549

545550
if (r) {
546551
/* Check that all memory is CPU accessible */
@@ -555,11 +560,10 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
555560
return r;
556561
}
557562

558-
trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
559-
out:
560-
/* update statistics */
563+
/* update statistics after the move */
564+
if (evict)
565+
atomic64_inc(&adev->num_evictions);
561566
atomic64_add(bo->base.size, &adev->num_bytes_moved);
562-
amdgpu_bo_move_notify(bo, evict);
563567
return 0;
564568
}
565569

@@ -1559,7 +1563,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
15591563
static void
15601564
amdgpu_bo_delete_mem_notify(struct ttm_buffer_object *bo)
15611565
{
1562-
amdgpu_bo_move_notify(bo, false);
1566+
amdgpu_bo_move_notify(bo, false, NULL);
15631567
}
15641568

15651569
static struct ttm_device_funcs amdgpu_bo_driver = {

drivers/gpu/drm/amd/amdkfd/kfd_process.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,14 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)
829829
if (process) {
830830
pr_debug("Process already found\n");
831831
} 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+
832840
process = create_process(thread);
833841
if (IS_ERR(process))
834842
goto out;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4537,15 +4537,18 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
45374537
/* Determine whether to enable Replay support by default. */
45384538
if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) {
45394539
switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
4540-
case IP_VERSION(3, 1, 4):
4541-
case IP_VERSION(3, 1, 5):
4542-
case IP_VERSION(3, 1, 6):
4543-
case IP_VERSION(3, 2, 0):
4544-
case IP_VERSION(3, 2, 1):
4545-
case IP_VERSION(3, 5, 0):
4546-
case IP_VERSION(3, 5, 1):
4547-
replay_feature_enabled = true;
4548-
break;
4540+
/*
4541+
* Disabled by default due to https://gitlab.freedesktop.org/drm/amd/-/issues/3344
4542+
* case IP_VERSION(3, 1, 4):
4543+
* case IP_VERSION(3, 1, 5):
4544+
* case IP_VERSION(3, 1, 6):
4545+
* case IP_VERSION(3, 2, 0):
4546+
* case IP_VERSION(3, 2, 1):
4547+
* case IP_VERSION(3, 5, 0):
4548+
* case IP_VERSION(3, 5, 1):
4549+
* replay_feature_enabled = true;
4550+
* break;
4551+
*/
45494552
default:
45504553
replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK;
45514554
break;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,9 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,
14951495
for (i = 0; i < MAX_PIPES; i++) {
14961496
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
14971497
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)
14991501
break;
15001502
}
15011503

@@ -1596,7 +1598,9 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf,
15961598
for (i = 0; i < MAX_PIPES; i++) {
15971599
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
15981600
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)
16001604
break;
16011605
}
16021606

@@ -1681,7 +1685,9 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,
16811685
for (i = 0; i < MAX_PIPES; i++) {
16821686
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
16831687
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)
16851691
break;
16861692
}
16871693

@@ -1780,7 +1786,9 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf,
17801786
for (i = 0; i < MAX_PIPES; i++) {
17811787
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
17821788
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)
17841792
break;
17851793
}
17861794

@@ -1865,7 +1873,9 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,
18651873
for (i = 0; i < MAX_PIPES; i++) {
18661874
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
18671875
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)
18691879
break;
18701880
}
18711881

@@ -1964,7 +1974,9 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf,
19641974
for (i = 0; i < MAX_PIPES; i++) {
19651975
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
19661976
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)
19681980
break;
19691981
}
19701982

@@ -2045,7 +2057,9 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,
20452057
for (i = 0; i < MAX_PIPES; i++) {
20462058
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
20472059
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)
20492063
break;
20502064
}
20512065

@@ -2141,7 +2155,9 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bu
21412155
for (i = 0; i < MAX_PIPES; i++) {
21422156
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
21432157
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)
21452161
break;
21462162
}
21472163

@@ -2220,7 +2236,9 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,
22202236
for (i = 0; i < MAX_PIPES; i++) {
22212237
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
22222238
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)
22242242
break;
22252243
}
22262244

@@ -2276,7 +2294,9 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,
22762294
for (i = 0; i < MAX_PIPES; i++) {
22772295
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
22782296
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)
22802300
break;
22812301
}
22822302

@@ -2347,7 +2367,9 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,
23472367
for (i = 0; i < MAX_PIPES; i++) {
23482368
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
23492369
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)
23512373
break;
23522374
}
23532375

@@ -2418,7 +2440,9 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,
24182440
for (i = 0; i < MAX_PIPES; i++) {
24192441
pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i];
24202442
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)
24222446
break;
24232447
}
24242448

drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,6 +2948,7 @@ static enum bp_result construct_integrated_info(
29482948
result = get_integrated_info_v2_1(bp, info);
29492949
break;
29502950
case 2:
2951+
case 3:
29512952
result = get_integrated_info_v2_2(bp, info);
29522953
break;
29532954
default:

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,
145145
*/
146146
clk_mgr_base->clks.zstate_support = new_clocks->zstate_support;
147147
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+
}
148152
/* check that we're not already in lower */
149153
if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_LOW_POWER) {
150154
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,
160164
}
161165
}
162166
} 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+
}
163171
/* check that we're not already in D0 */
164172
if (clk_mgr_base->clks.pwr_state != DCN_PWR_STATE_MISSION_MODE) {
165173
union display_idle_optimization_u idle_info = { 0 };

0 commit comments

Comments
 (0)