Skip to content

Commit fd979ca

Browse files
committed
Merge tag 'drm-fixes-2022-11-11' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Weekly pull request for graphics, mostly amdgpu and i915, with a couple of fixes for vc4 and panfrost, panel quirks and a kconfig change for rcar-du. Nothing seems to be too strange at this stage. amdgpu: - Fix s/r in amdgpu_vram_mgr_new - SMU 13.0.4 update - GPUVM TLB race fix - DCN 3.1.4 fixes - DCN 3.2.x fixes - Vega10 fan fix - BACO fix for Beige Goby board - PSR fix - GPU VM PT locking fixes amdkfd: - CRIU fixes vc4: - HDMI fixes to vc4. panfrost: - Make panfrost's uapi header compile with C++. - Handle 1 gb boundary correctly in panfrost mmu code. panel: - Add rotation quirks for 2 panels. rcar-du: - DSI Kconfig fix i915: - Fix sg_table handling in map_dma_buf - Send PSR update also on invalidate - Do not set cache_dirty for DGFX - Restore userptr probe_range behaviour" * tag 'drm-fixes-2022-11-11' of git://anongit.freedesktop.org/drm/drm: (29 commits) drm/amd/display: only fill dirty rectangles when PSR is enabled drm/amdgpu: disable BACO on special BEIGE_GOBY card drm/amdgpu: Drop eviction lock when allocating PT BO drm/amdgpu: Unlock bo_list_mutex after error handling Revert "drm/amdgpu: Revert "drm/amdgpu: getting fan speed pwm for vega10 properly"" drm/amd/display: Enforce minimum prefetch time for low memclk on DCN32 drm/amd/display: Fix gpio port mapping issue drm/amd/display: Fix reg timeout in enc314_enable_fifo drm/amd/display: Fix FCLK deviation and tool compile issues drm/amd/display: Zeromem mypipe heap struct before using it drm/amd/display: Update SR watermarks for DCN314 drm/amdgpu: workaround for TLB seq race drm/amdkfd: Fix error handling in criu_checkpoint drm/amdkfd: Fix error handling in kfd_criu_restore_events drm/amd/pm: update SMU IP v13.0.4 msg interface header drm: rcar-du: Fix Kconfig dependency between RCAR_DU and RCAR_MIPI_DSI drm/panfrost: Split io-pgtable requests properly drm/amdgpu: Fix the lpfn checking condition in drm buddy drm: panel-orientation-quirks: Add quirk for Acer Switch V 10 (SW5-017) drm: panel-orientation-quirks: Add quirk for Nanote UMPC-01 ...
2 parents 4bbf342 + b7ffd9d commit fd979ca

37 files changed

+258
-129
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
992992
kvfree(e->user_pages);
993993
e->user_pages = NULL;
994994
}
995+
mutex_unlock(&p->bo_list->bo_list_mutex);
995996
return r;
996997
}
997998

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -143,32 +143,6 @@ int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
143143
return 0;
144144
}
145145

146-
/*
147-
* vm eviction_lock can be taken in MMU notifiers. Make sure no reclaim-FS
148-
* happens while holding this lock anywhere to prevent deadlocks when
149-
* an MMU notifier runs in reclaim-FS context.
150-
*/
151-
static inline void amdgpu_vm_eviction_lock(struct amdgpu_vm *vm)
152-
{
153-
mutex_lock(&vm->eviction_lock);
154-
vm->saved_flags = memalloc_noreclaim_save();
155-
}
156-
157-
static inline int amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm)
158-
{
159-
if (mutex_trylock(&vm->eviction_lock)) {
160-
vm->saved_flags = memalloc_noreclaim_save();
161-
return 1;
162-
}
163-
return 0;
164-
}
165-
166-
static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm)
167-
{
168-
memalloc_noreclaim_restore(vm->saved_flags);
169-
mutex_unlock(&vm->eviction_lock);
170-
}
171-
172146
/**
173147
* amdgpu_vm_bo_evicted - vm_bo is evicted
174148
*

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,48 @@ void amdgpu_debugfs_vm_bo_info(struct amdgpu_vm *vm, struct seq_file *m);
492492
*/
493493
static inline uint64_t amdgpu_vm_tlb_seq(struct amdgpu_vm *vm)
494494
{
495+
unsigned long flags;
496+
spinlock_t *lock;
497+
498+
/*
499+
* Workaround to stop racing between the fence signaling and handling
500+
* the cb. The lock is static after initially setting it up, just make
501+
* sure that the dma_fence structure isn't freed up.
502+
*/
503+
rcu_read_lock();
504+
lock = vm->last_tlb_flush->lock;
505+
rcu_read_unlock();
506+
507+
spin_lock_irqsave(lock, flags);
508+
spin_unlock_irqrestore(lock, flags);
509+
495510
return atomic64_read(&vm->tlb_seq);
496511
}
497512

513+
/*
514+
* vm eviction_lock can be taken in MMU notifiers. Make sure no reclaim-FS
515+
* happens while holding this lock anywhere to prevent deadlocks when
516+
* an MMU notifier runs in reclaim-FS context.
517+
*/
518+
static inline void amdgpu_vm_eviction_lock(struct amdgpu_vm *vm)
519+
{
520+
mutex_lock(&vm->eviction_lock);
521+
vm->saved_flags = memalloc_noreclaim_save();
522+
}
523+
524+
static inline bool amdgpu_vm_eviction_trylock(struct amdgpu_vm *vm)
525+
{
526+
if (mutex_trylock(&vm->eviction_lock)) {
527+
vm->saved_flags = memalloc_noreclaim_save();
528+
return true;
529+
}
530+
return false;
531+
}
532+
533+
static inline void amdgpu_vm_eviction_unlock(struct amdgpu_vm *vm)
534+
{
535+
memalloc_noreclaim_restore(vm->saved_flags);
536+
mutex_unlock(&vm->eviction_lock);
537+
}
538+
498539
#endif

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ static int amdgpu_vm_pt_alloc(struct amdgpu_device *adev,
597597
if (entry->bo)
598598
return 0;
599599

600+
amdgpu_vm_eviction_unlock(vm);
600601
r = amdgpu_vm_pt_create(adev, vm, cursor->level, immediate, &pt);
602+
amdgpu_vm_eviction_lock(vm);
601603
if (r)
602604
return r;
603605

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
435435
if (place->flags & TTM_PL_FLAG_TOPDOWN)
436436
vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
437437

438-
if (fpfn || lpfn != man->size)
438+
if (fpfn || lpfn != mgr->mm.size)
439439
/* Allocate blocks in desired range */
440440
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
441441

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

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ static int criu_checkpoint(struct file *filep,
19501950
{
19511951
int ret;
19521952
uint32_t num_devices, num_bos, num_objects;
1953-
uint64_t priv_size, priv_offset = 0;
1953+
uint64_t priv_size, priv_offset = 0, bo_priv_offset;
19541954

19551955
if (!args->devices || !args->bos || !args->priv_data)
19561956
return -EINVAL;
@@ -1994,38 +1994,34 @@ static int criu_checkpoint(struct file *filep,
19941994
if (ret)
19951995
goto exit_unlock;
19961996

1997-
ret = criu_checkpoint_bos(p, num_bos, (uint8_t __user *)args->bos,
1998-
(uint8_t __user *)args->priv_data, &priv_offset);
1999-
if (ret)
2000-
goto exit_unlock;
1997+
/* Leave room for BOs in the private data. They need to be restored
1998+
* before events, but we checkpoint them last to simplify the error
1999+
* handling.
2000+
*/
2001+
bo_priv_offset = priv_offset;
2002+
priv_offset += num_bos * sizeof(struct kfd_criu_bo_priv_data);
20012003

20022004
if (num_objects) {
20032005
ret = kfd_criu_checkpoint_queues(p, (uint8_t __user *)args->priv_data,
20042006
&priv_offset);
20052007
if (ret)
2006-
goto close_bo_fds;
2008+
goto exit_unlock;
20072009

20082010
ret = kfd_criu_checkpoint_events(p, (uint8_t __user *)args->priv_data,
20092011
&priv_offset);
20102012
if (ret)
2011-
goto close_bo_fds;
2013+
goto exit_unlock;
20122014

20132015
ret = kfd_criu_checkpoint_svm(p, (uint8_t __user *)args->priv_data, &priv_offset);
20142016
if (ret)
2015-
goto close_bo_fds;
2017+
goto exit_unlock;
20162018
}
20172019

2018-
close_bo_fds:
2019-
if (ret) {
2020-
/* If IOCTL returns err, user assumes all FDs opened in criu_dump_bos are closed */
2021-
uint32_t i;
2022-
struct kfd_criu_bo_bucket *bo_buckets = (struct kfd_criu_bo_bucket *) args->bos;
2023-
2024-
for (i = 0; i < num_bos; i++) {
2025-
if (bo_buckets[i].alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM)
2026-
close_fd(bo_buckets[i].dmabuf_fd);
2027-
}
2028-
}
2020+
/* This must be the last thing in this function that can fail.
2021+
* Otherwise we leak dmabuf file descriptors.
2022+
*/
2023+
ret = criu_checkpoint_bos(p, num_bos, (uint8_t __user *)args->bos,
2024+
(uint8_t __user *)args->priv_data, &bo_priv_offset);
20292025

20302026
exit_unlock:
20312027
mutex_unlock(&p->mutex);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,15 +506,14 @@ int kfd_criu_restore_event(struct file *devkfd,
506506
ret = create_other_event(p, ev, &ev_priv->event_id);
507507
break;
508508
}
509+
mutex_unlock(&p->event_mutex);
509510

510511
exit:
511512
if (ret)
512513
kfree(ev);
513514

514515
kfree(ev_priv);
515516

516-
mutex_unlock(&p->event_mutex);
517-
518517
return ret;
519518
}
520519

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7622,9 +7622,10 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
76227622
bundle->surface_updates[planes_count].plane_info =
76237623
&bundle->plane_infos[planes_count];
76247624

7625-
fill_dc_dirty_rects(plane, old_plane_state, new_plane_state,
7626-
new_crtc_state,
7627-
&bundle->flip_addrs[planes_count]);
7625+
if (acrtc_state->stream->link->psr_settings.psr_feature_enabled)
7626+
fill_dc_dirty_rects(plane, old_plane_state,
7627+
new_plane_state, new_crtc_state,
7628+
&bundle->flip_addrs[planes_count]);
76287629

76297630
/*
76307631
* Only allow immediate flips for fast updates that don't

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -363,32 +363,32 @@ static struct wm_table ddr5_wm_table = {
363363
.wm_inst = WM_A,
364364
.wm_type = WM_TYPE_PSTATE_CHG,
365365
.pstate_latency_us = 11.72,
366-
.sr_exit_time_us = 9,
367-
.sr_enter_plus_exit_time_us = 11,
366+
.sr_exit_time_us = 12.5,
367+
.sr_enter_plus_exit_time_us = 14.5,
368368
.valid = true,
369369
},
370370
{
371371
.wm_inst = WM_B,
372372
.wm_type = WM_TYPE_PSTATE_CHG,
373373
.pstate_latency_us = 11.72,
374-
.sr_exit_time_us = 9,
375-
.sr_enter_plus_exit_time_us = 11,
374+
.sr_exit_time_us = 12.5,
375+
.sr_enter_plus_exit_time_us = 14.5,
376376
.valid = true,
377377
},
378378
{
379379
.wm_inst = WM_C,
380380
.wm_type = WM_TYPE_PSTATE_CHG,
381381
.pstate_latency_us = 11.72,
382-
.sr_exit_time_us = 9,
383-
.sr_enter_plus_exit_time_us = 11,
382+
.sr_exit_time_us = 12.5,
383+
.sr_enter_plus_exit_time_us = 14.5,
384384
.valid = true,
385385
},
386386
{
387387
.wm_inst = WM_D,
388388
.wm_type = WM_TYPE_PSTATE_CHG,
389389
.pstate_latency_us = 11.72,
390-
.sr_exit_time_us = 9,
391-
.sr_enter_plus_exit_time_us = 11,
390+
.sr_exit_time_us = 12.5,
391+
.sr_enter_plus_exit_time_us = 14.5,
392392
.valid = true,
393393
},
394394
}
@@ -400,32 +400,32 @@ static struct wm_table lpddr5_wm_table = {
400400
.wm_inst = WM_A,
401401
.wm_type = WM_TYPE_PSTATE_CHG,
402402
.pstate_latency_us = 11.65333,
403-
.sr_exit_time_us = 11.5,
404-
.sr_enter_plus_exit_time_us = 14.5,
403+
.sr_exit_time_us = 16.5,
404+
.sr_enter_plus_exit_time_us = 18.5,
405405
.valid = true,
406406
},
407407
{
408408
.wm_inst = WM_B,
409409
.wm_type = WM_TYPE_PSTATE_CHG,
410410
.pstate_latency_us = 11.65333,
411-
.sr_exit_time_us = 11.5,
412-
.sr_enter_plus_exit_time_us = 14.5,
411+
.sr_exit_time_us = 16.5,
412+
.sr_enter_plus_exit_time_us = 18.5,
413413
.valid = true,
414414
},
415415
{
416416
.wm_inst = WM_C,
417417
.wm_type = WM_TYPE_PSTATE_CHG,
418418
.pstate_latency_us = 11.65333,
419-
.sr_exit_time_us = 11.5,
420-
.sr_enter_plus_exit_time_us = 14.5,
419+
.sr_exit_time_us = 16.5,
420+
.sr_enter_plus_exit_time_us = 18.5,
421421
.valid = true,
422422
},
423423
{
424424
.wm_inst = WM_D,
425425
.wm_type = WM_TYPE_PSTATE_CHG,
426426
.pstate_latency_us = 11.65333,
427-
.sr_exit_time_us = 11.5,
428-
.sr_enter_plus_exit_time_us = 14.5,
427+
.sr_exit_time_us = 16.5,
428+
.sr_enter_plus_exit_time_us = 18.5,
429429
.valid = true,
430430
},
431431
}

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ struct dc_debug_options {
853853
bool enable_dp_dig_pixel_rate_div_policy;
854854
enum lttpr_mode lttpr_mode_override;
855855
unsigned int dsc_delay_factor_wa_x1000;
856+
unsigned int min_prefetch_in_strobe_ns;
856857
};
857858

858859
struct gpu_info_soc_bounding_box_v1_0;

0 commit comments

Comments
 (0)