Skip to content

Commit 5d97dde

Browse files
committed
Merge tag 'drm-fixes-2024-10-18' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Dave Airlie: "Weekly fixes, msm and xe are the two main ones, with a bunch of scattered fixes including a largish revert in mgag200, then amdgpu, vmwgfx and scattering of other minor ones. All seems pretty regular. msm: - Display: - move CRTC resource assignment to atomic_check otherwise to make consecutive calls to atomic_check() consistent - fix rounding / sign-extension issues with pclk calculation in case of DSC - cleanups to drop incorrect null checks in dpu snapshots - fix to use kvzalloc in dpu snapshot to avoid allocation issues in heavily loaded system cases - Fix to not program merge_3d block if dual LM is not being used - Fix to not flush merge_3d block if its not enabled otherwise this leads to false timeouts - GPU: - a7xx: add a fence wait before SMMU table update xe: - New workaround to Xe2 (Aradhya) - Fix unbalanced rpm put (Matthew Auld) - Remove fragile lock optimization (Matthew Brost) - Fix job release, delegating it to the drm scheduler (Matthew Brost) - Fix timestamp bit width for Xe2 (Lucas) - Fix external BO's dma-resv usag (Matthew Brost) - Fix returning success for timeout in wait_token (Nirmoy) - Initialize fence to avoid it being detected as signaled (Matthew Auld) - Improve cache flush for BMG (Matthew Auld) - Don't allow hflip for tile4 framebuffer on Xe2 (Juha-Pekka) amdgpu: - SR-IOV fix - CS chunk handling fix - MES fixes - SMU13 fixes amdkfd: - VRAM usage reporting fix radeon: - Fix possible_clones handling i915: - Two DP bandwidth related MST fixes ast: - Clear EDID on unplugged connectors host1x: - Fix boot on Tegra186 - Set DMA parameters mgag200: - Revert VBLANK support panel: - himax-hx83192: Adjust power and gamma qaic: - Sgtable loop fixes vmwgfx: - Limit display layout allocatino size - Handle allocation errors in connector checks - Clean up KMS code for 2d-only setup - Report surface-check errors correctly - Remove NULL test around kvfree()" * tag 'drm-fixes-2024-10-18' of https://gitlab.freedesktop.org/drm/kernel: (45 commits) drm/ast: vga: Clear EDID if no display is connected drm/ast: sil164: Clear EDID if no display is connected Revert "drm/mgag200: Add vblank support" drm/amdgpu/swsmu: default to fullscreen 3D profile for dGPUs drm/i915/display: Don't allow tile4 framebuffer to do hflip on display20 or greater drm/xe/bmg: improve cache flushing behaviour drm/xe/xe_sync: initialise ufence.signalled drm/xe/ufence: ufence can be signaled right after wait_woken drm/xe: Use bookkeep slots for external BO's in exec IOCTL drm/xe/query: Increase timestamp width drm/xe: Don't free job in TDR drm/xe: Take job list lock in xe_sched_add_pending_job drm/xe: fix unbalanced rpm put() with declare_wedged() drm/xe: fix unbalanced rpm put() with fence_fini() drm/xe/xe2lpg: Extend Wa_15016589081 for xe2lpg drm/i915/dp_mst: Don't require DSC hblank quirk for a non-DSC compatible mode drm/i915/dp_mst: Handle error during DSC BW overhead/slice calculation drm/msm/a6xx+: Insert a fence wait before SMMU table update drm/msm/dpu: don't always program merge_3d block drm/msm/dpu: Don't always set merge_3d pending flush ...
2 parents b1b4675 + 83f0007 commit 5d97dde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+291
-388
lines changed

drivers/accel/qaic/qaic_control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ static int encode_addr_size_pairs(struct dma_xfer *xfer, struct wrapper_list *wr
496496
nents = sgt->nents;
497497
nents_dma = nents;
498498
*size = QAIC_MANAGE_EXT_MSG_LENGTH - msg_hdr_len - sizeof(**out_trans);
499-
for_each_sgtable_sg(sgt, sg, i) {
499+
for_each_sgtable_dma_sg(sgt, sg, i) {
500500
*size -= sizeof(*asp);
501501
/* Save 1K for possible follow-up transactions. */
502502
if (*size < SZ_1K) {

drivers/accel/qaic/qaic_data.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int clone_range_of_sgt_for_slice(struct qaic_device *qdev, struct sg_tabl
184184
nents = 0;
185185

186186
size = size ? size : PAGE_SIZE;
187-
for (sg = sgt_in->sgl; sg; sg = sg_next(sg)) {
187+
for_each_sgtable_dma_sg(sgt_in, sg, j) {
188188
len = sg_dma_len(sg);
189189

190190
if (!len)
@@ -221,7 +221,7 @@ static int clone_range_of_sgt_for_slice(struct qaic_device *qdev, struct sg_tabl
221221

222222
/* copy relevant sg node and fix page and length */
223223
sgn = sgf;
224-
for_each_sgtable_sg(sgt, sg, j) {
224+
for_each_sgtable_dma_sg(sgt, sg, j) {
225225
memcpy(sg, sgn, sizeof(*sg));
226226
if (sgn == sgf) {
227227
sg_dma_address(sg) += offf;
@@ -301,7 +301,7 @@ static int encode_reqs(struct qaic_device *qdev, struct bo_slice *slice,
301301
* fence.
302302
*/
303303
dev_addr = req->dev_addr;
304-
for_each_sgtable_sg(slice->sgt, sg, i) {
304+
for_each_sgtable_dma_sg(slice->sgt, sg, i) {
305305
slice->reqs[i].cmd = cmd;
306306
slice->reqs[i].src_addr = cpu_to_le64(slice->dir == DMA_TO_DEVICE ?
307307
sg_dma_address(sg) : dev_addr);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
265265

266266
/* Only a single BO list is allowed to simplify handling. */
267267
if (p->bo_list)
268-
ret = -EINVAL;
268+
goto free_partial_kdata;
269269

270270
ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
271271
if (ret)

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,11 +1635,9 @@ int amdgpu_gfx_sysfs_isolation_shader_init(struct amdgpu_device *adev)
16351635
{
16361636
int r;
16371637

1638-
if (!amdgpu_sriov_vf(adev)) {
1639-
r = device_create_file(adev->dev, &dev_attr_enforce_isolation);
1640-
if (r)
1641-
return r;
1642-
}
1638+
r = device_create_file(adev->dev, &dev_attr_enforce_isolation);
1639+
if (r)
1640+
return r;
16431641

16441642
r = device_create_file(adev->dev, &dev_attr_run_cleaner_shader);
16451643
if (r)
@@ -1650,8 +1648,7 @@ int amdgpu_gfx_sysfs_isolation_shader_init(struct amdgpu_device *adev)
16501648

16511649
void amdgpu_gfx_sysfs_isolation_shader_fini(struct amdgpu_device *adev)
16521650
{
1653-
if (!amdgpu_sriov_vf(adev))
1654-
device_remove_file(adev->dev, &dev_attr_enforce_isolation);
1651+
device_remove_file(adev->dev, &dev_attr_enforce_isolation);
16551652
device_remove_file(adev->dev, &dev_attr_run_cleaner_shader);
16561653
}
16571654

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,10 @@ int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
12031203

12041204
r = amdgpu_ring_init(adev, ring, 1024, NULL, 0,
12051205
AMDGPU_RING_PRIO_DEFAULT, NULL);
1206-
if (r)
1206+
if (r) {
1207+
amdgpu_mes_unlock(&adev->mes);
12071208
goto clean_up_memory;
1209+
}
12081210

12091211
amdgpu_mes_ring_to_queue_props(adev, ring, &qprops);
12101212

@@ -1237,7 +1239,6 @@ int amdgpu_mes_add_ring(struct amdgpu_device *adev, int gang_id,
12371239
amdgpu_ring_fini(ring);
12381240
clean_up_memory:
12391241
kfree(ring);
1240-
amdgpu_mes_unlock(&adev->mes);
12411242
return r;
12421243
}
12431244

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static int mes_v12_0_set_hw_resources(struct amdgpu_mes *mes, int pipe)
621621

622622
if (amdgpu_mes_log_enable) {
623623
mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;
624-
mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr;
624+
mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr + pipe * AMDGPU_MES_LOG_BUFFER_SIZE;
625625
}
626626

627627
return mes_v12_0_submit_pkt_and_poll_completion(mes, pipe,
@@ -1336,7 +1336,7 @@ static int mes_v12_0_sw_init(void *handle)
13361336
adev->mes.kiq_hw_fini = &mes_v12_0_kiq_hw_fini;
13371337
adev->mes.enable_legacy_queue_map = true;
13381338

1339-
adev->mes.event_log_size = AMDGPU_MES_LOG_BUFFER_SIZE;
1339+
adev->mes.event_log_size = adev->enable_uni_mes ? (AMDGPU_MAX_MES_PIPES * AMDGPU_MES_LOG_BUFFER_SIZE) : AMDGPU_MES_LOG_BUFFER_SIZE;
13401340

13411341
r = amdgpu_mes_init(adev);
13421342
if (r)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
11481148

11491149
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM)
11501150
size >>= 1;
1151-
WRITE_ONCE(pdd->vram_usage, pdd->vram_usage + PAGE_ALIGN(size));
1151+
atomic64_add(PAGE_ALIGN(size), &pdd->vram_usage);
11521152
}
11531153

11541154
mutex_unlock(&p->mutex);
@@ -1219,7 +1219,7 @@ static int kfd_ioctl_free_memory_of_gpu(struct file *filep,
12191219
kfd_process_device_remove_obj_handle(
12201220
pdd, GET_IDR_HANDLE(args->handle));
12211221

1222-
WRITE_ONCE(pdd->vram_usage, pdd->vram_usage - size);
1222+
atomic64_sub(size, &pdd->vram_usage);
12231223

12241224
err_unlock:
12251225
err_pdd:
@@ -2347,7 +2347,7 @@ static int criu_restore_memory_of_gpu(struct kfd_process_device *pdd,
23472347
} else if (bo_bucket->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
23482348
bo_bucket->restored_offset = offset;
23492349
/* Update the VRAM usage count */
2350-
WRITE_ONCE(pdd->vram_usage, pdd->vram_usage + bo_bucket->size);
2350+
atomic64_add(bo_bucket->size, &pdd->vram_usage);
23512351
}
23522352
return 0;
23532353
}

drivers/gpu/drm/amd/amdkfd/kfd_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ struct kfd_process_device {
775775
enum kfd_pdd_bound bound;
776776

777777
/* VRAM usage */
778-
uint64_t vram_usage;
778+
atomic64_t vram_usage;
779779
struct attribute attr_vram;
780780
char vram_filename[MAX_SYSFS_FILENAME_LEN];
781781

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static ssize_t kfd_procfs_show(struct kobject *kobj, struct attribute *attr,
332332
} else if (strncmp(attr->name, "vram_", 5) == 0) {
333333
struct kfd_process_device *pdd = container_of(attr, struct kfd_process_device,
334334
attr_vram);
335-
return snprintf(buffer, PAGE_SIZE, "%llu\n", READ_ONCE(pdd->vram_usage));
335+
return snprintf(buffer, PAGE_SIZE, "%llu\n", atomic64_read(&pdd->vram_usage));
336336
} else if (strncmp(attr->name, "sdma_", 5) == 0) {
337337
struct kfd_process_device *pdd = container_of(attr, struct kfd_process_device,
338338
attr_sdma);
@@ -1625,7 +1625,7 @@ struct kfd_process_device *kfd_create_process_device_data(struct kfd_node *dev,
16251625
pdd->bound = PDD_UNBOUND;
16261626
pdd->already_dequeued = false;
16271627
pdd->runtime_inuse = false;
1628-
pdd->vram_usage = 0;
1628+
atomic64_set(&pdd->vram_usage, 0);
16291629
pdd->sdma_past_activity_counter = 0;
16301630
pdd->user_gpu_id = dev->id;
16311631
atomic64_set(&pdd->evict_duration_counter, 0);

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,27 @@ static void svm_range_bo_release(struct kref *kref)
405405
spin_lock(&svm_bo->list_lock);
406406
}
407407
spin_unlock(&svm_bo->list_lock);
408+
409+
if (mmget_not_zero(svm_bo->eviction_fence->mm)) {
410+
struct kfd_process_device *pdd;
411+
struct kfd_process *p;
412+
struct mm_struct *mm;
413+
414+
mm = svm_bo->eviction_fence->mm;
415+
/*
416+
* The forked child process takes svm_bo device pages ref, svm_bo could be
417+
* released after parent process is gone.
418+
*/
419+
p = kfd_lookup_process_by_mm(mm);
420+
if (p) {
421+
pdd = kfd_get_process_device_data(svm_bo->node, p);
422+
if (pdd)
423+
atomic64_sub(amdgpu_bo_size(svm_bo->bo), &pdd->vram_usage);
424+
kfd_unref_process(p);
425+
}
426+
mmput(mm);
427+
}
428+
408429
if (!dma_fence_is_signaled(&svm_bo->eviction_fence->base))
409430
/* We're not in the eviction worker. Signal the fence. */
410431
dma_fence_signal(&svm_bo->eviction_fence->base);
@@ -532,6 +553,7 @@ int
532553
svm_range_vram_node_new(struct kfd_node *node, struct svm_range *prange,
533554
bool clear)
534555
{
556+
struct kfd_process_device *pdd;
535557
struct amdgpu_bo_param bp;
536558
struct svm_range_bo *svm_bo;
537559
struct amdgpu_bo_user *ubo;
@@ -623,6 +645,10 @@ svm_range_vram_node_new(struct kfd_node *node, struct svm_range *prange,
623645
list_add(&prange->svm_bo_list, &svm_bo->range_list);
624646
spin_unlock(&svm_bo->list_lock);
625647

648+
pdd = svm_range_get_pdd_by_node(prange, node);
649+
if (pdd)
650+
atomic64_add(amdgpu_bo_size(bo), &pdd->vram_usage);
651+
626652
return 0;
627653

628654
reserve_bo_failed:

0 commit comments

Comments
 (0)