Skip to content

Commit 2879b48

Browse files
committed
Merge tag 'drm-misc-fixes-2024-07-04' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
drm-misc-fixes for v6.10-rc7: - Add panel quirks. - Firmware sysfb refcount fix. - Another null pointer mode deref fix for nouveau. - Panthor sync and uobj fixes. - Fix fbdev regression since v6.7. - Delay free imported bo in ttm to fix lockdep splat. Signed-off-by: Daniel Vetter <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents cfbce3b + d99fbd9 commit 2879b48

File tree

8 files changed

+63
-20
lines changed

8 files changed

+63
-20
lines changed

drivers/firmware/sysfb.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ static __init struct device *sysfb_parent_dev(const struct screen_info *si)
101101
if (IS_ERR(pdev)) {
102102
return ERR_CAST(pdev);
103103
} else if (pdev) {
104-
if (!sysfb_pci_dev_is_enabled(pdev))
104+
if (!sysfb_pci_dev_is_enabled(pdev)) {
105+
pci_dev_put(pdev);
105106
return ERR_PTR(-ENODEV);
107+
}
106108
return &pdev->dev;
107109
}
108110

@@ -137,7 +139,7 @@ static __init int sysfb_init(void)
137139
if (compatible) {
138140
pd = sysfb_create_simplefb(si, &mode, parent);
139141
if (!IS_ERR(pd))
140-
goto unlock_mutex;
142+
goto put_device;
141143
}
142144

143145
/* if the FB is incompatible, create a legacy framebuffer device */
@@ -155,7 +157,7 @@ static __init int sysfb_init(void)
155157
pd = platform_device_alloc(name, 0);
156158
if (!pd) {
157159
ret = -ENOMEM;
158-
goto unlock_mutex;
160+
goto put_device;
159161
}
160162

161163
pd->dev.parent = parent;
@@ -170,9 +172,11 @@ static __init int sysfb_init(void)
170172
if (ret)
171173
goto err;
172174

173-
goto unlock_mutex;
175+
goto put_device;
174176
err:
175177
platform_device_put(pd);
178+
put_device:
179+
put_device(parent);
176180
unlock_mutex:
177181
mutex_unlock(&disable_lock);
178182
return ret;

drivers/gpu/drm/drm_fbdev_generic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
8484
sizes->surface_width, sizes->surface_height,
8585
sizes->surface_bpp);
8686

87-
format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
87+
format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
88+
sizes->surface_depth);
8889
buffer = drm_client_framebuffer_create(client, sizes->surface_width,
8990
sizes->surface_height, format);
9091
if (IS_ERR(buffer))

drivers/gpu/drm/drm_panel_orientation_quirks.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,20 @@ static const struct dmi_system_id orientation_data[] = {
420420
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"),
421421
},
422422
.driver_data = (void *)&lcd1280x1920_rightside_up,
423-
}, { /* Valve Steam Deck */
423+
}, { /* Valve Steam Deck (Jupiter) */
424424
.matches = {
425425
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
426426
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
427427
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
428428
},
429429
.driver_data = (void *)&lcd800x1280_rightside_up,
430+
}, { /* Valve Steam Deck (Galileo) */
431+
.matches = {
432+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
433+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
434+
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
435+
},
436+
.driver_data = (void *)&lcd800x1280_rightside_up,
430437
}, { /* VIOS LTH17 */
431438
.matches = {
432439
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ nouveau_connector_get_modes(struct drm_connector *connector)
10011001
struct drm_display_mode *mode;
10021002

10031003
mode = drm_mode_duplicate(dev, nv_connector->native_mode);
1004+
if (!mode)
1005+
return 0;
1006+
10041007
drm_mode_probed_add(connector, mode);
10051008
ret = 1;
10061009
}

drivers/gpu/drm/panthor/panthor_drv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ panthor_get_uobj_array(const struct drm_panthor_obj_array *in, u32 min_stride,
8686
int ret = 0;
8787
void *out_alloc;
8888

89+
if (!in->count)
90+
return NULL;
91+
8992
/* User stride must be at least the minimum object size, otherwise it might
9093
* lack useful information.
9194
*/
9295
if (in->stride < min_stride)
9396
return ERR_PTR(-EINVAL);
9497

95-
if (!in->count)
96-
return NULL;
97-
9898
out_alloc = kvmalloc_array(in->count, obj_size, GFP_KERNEL);
9999
if (!out_alloc)
100100
return ERR_PTR(-ENOMEM);

drivers/gpu/drm/panthor/panthor_sched.c

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,16 @@ struct panthor_queue {
458458
/** @seqno: Sequence number of the last initialized fence. */
459459
atomic64_t seqno;
460460

461+
/**
462+
* @last_fence: Fence of the last submitted job.
463+
*
464+
* We return this fence when we get an empty command stream.
465+
* This way, we are guaranteed that all earlier jobs have completed
466+
* when drm_sched_job::s_fence::finished without having to feed
467+
* the CS ring buffer with a dummy job that only signals the fence.
468+
*/
469+
struct dma_fence *last_fence;
470+
461471
/**
462472
* @in_flight_jobs: List containing all in-flight jobs.
463473
*
@@ -829,6 +839,9 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue *
829839
panthor_kernel_bo_destroy(queue->ringbuf);
830840
panthor_kernel_bo_destroy(queue->iface.mem);
831841

842+
/* Release the last_fence we were holding, if any. */
843+
dma_fence_put(queue->fence_ctx.last_fence);
844+
832845
kfree(queue);
833846
}
834847

@@ -2784,9 +2797,6 @@ static void group_sync_upd_work(struct work_struct *work)
27842797

27852798
spin_lock(&queue->fence_ctx.lock);
27862799
list_for_each_entry_safe(job, job_tmp, &queue->fence_ctx.in_flight_jobs, node) {
2787-
if (!job->call_info.size)
2788-
continue;
2789-
27902800
if (syncobj->seqno < job->done_fence->seqno)
27912801
break;
27922802

@@ -2865,11 +2875,14 @@ queue_run_job(struct drm_sched_job *sched_job)
28652875
static_assert(sizeof(call_instrs) % 64 == 0,
28662876
"call_instrs is not aligned on a cacheline");
28672877

2868-
/* Stream size is zero, nothing to do => return a NULL fence and let
2869-
* drm_sched signal the parent.
2878+
/* Stream size is zero, nothing to do except making sure all previously
2879+
* submitted jobs are done before we signal the
2880+
* drm_sched_job::s_fence::finished fence.
28702881
*/
2871-
if (!job->call_info.size)
2872-
return NULL;
2882+
if (!job->call_info.size) {
2883+
job->done_fence = dma_fence_get(queue->fence_ctx.last_fence);
2884+
return dma_fence_get(job->done_fence);
2885+
}
28732886

28742887
ret = pm_runtime_resume_and_get(ptdev->base.dev);
28752888
if (drm_WARN_ON(&ptdev->base, ret))
@@ -2928,6 +2941,10 @@ queue_run_job(struct drm_sched_job *sched_job)
29282941
}
29292942
}
29302943

2944+
/* Update the last fence. */
2945+
dma_fence_put(queue->fence_ctx.last_fence);
2946+
queue->fence_ctx.last_fence = dma_fence_get(job->done_fence);
2947+
29312948
done_fence = dma_fence_get(job->done_fence);
29322949

29332950
out_unlock:
@@ -3378,10 +3395,15 @@ panthor_job_create(struct panthor_file *pfile,
33783395
goto err_put_job;
33793396
}
33803397

3381-
job->done_fence = kzalloc(sizeof(*job->done_fence), GFP_KERNEL);
3382-
if (!job->done_fence) {
3383-
ret = -ENOMEM;
3384-
goto err_put_job;
3398+
/* Empty command streams don't need a fence, they'll pick the one from
3399+
* the previously submitted job.
3400+
*/
3401+
if (job->call_info.size) {
3402+
job->done_fence = kzalloc(sizeof(*job->done_fence), GFP_KERNEL);
3403+
if (!job->done_fence) {
3404+
ret = -ENOMEM;
3405+
goto err_put_job;
3406+
}
33853407
}
33863408

33873409
ret = drm_sched_job_init(&job->base,

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ static void ttm_bo_release(struct kref *kref)
346346
if (!dma_resv_test_signaled(bo->base.resv,
347347
DMA_RESV_USAGE_BOOKKEEP) ||
348348
(want_init_on_free() && (bo->ttm != NULL)) ||
349+
bo->type == ttm_bo_type_sg ||
349350
!dma_resv_trylock(bo->base.resv)) {
350351
/* The BO is not idle, resurrect it for delayed destroy */
351352
ttm_bo_flush_all_fences(bo);

include/uapi/drm/panthor_drm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,9 @@ struct drm_panthor_queue_submit {
802802
* Must be 64-bit/8-byte aligned (the size of a CS instruction)
803803
*
804804
* Can be zero if stream_addr is zero too.
805+
*
806+
* When the stream size is zero, the queue submit serves as a
807+
* synchronization point.
805808
*/
806809
__u32 stream_size;
807810

@@ -822,6 +825,8 @@ struct drm_panthor_queue_submit {
822825
* ensure the GPU doesn't get garbage when reading the indirect command
823826
* stream buffers. If you want the cache flush to happen
824827
* unconditionally, pass a zero here.
828+
*
829+
* Ignored when stream_size is zero.
825830
*/
826831
__u32 latest_flush;
827832

0 commit comments

Comments
 (0)