Skip to content

Commit 3c064ae

Browse files
committed
Merge tag 'drm-misc-next-fixes-2024-01-04' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
One fix for drm/plane to avoid a use-after-free and some additional warnings to prevent more of these occurences, a lock inversion dependency fix and an indentation fix for drm/rockchip, and some doc warning fixes for imagination and gpuvm. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/enhl33v2oeihktta2yfyc4exvezdvm3eexcuwxkethc5ommrjo@lkidkv2kwakq
2 parents cff601b + eee7068 commit 3c064ae

File tree

5 files changed

+79
-65
lines changed

5 files changed

+79
-65
lines changed

drivers/gpu/drm/drm_framebuffer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
461461

462462
INIT_WORK_ONSTACK(&arg.work, drm_mode_rmfb_work_fn);
463463
INIT_LIST_HEAD(&arg.fbs);
464+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
464465
list_add_tail(&fb->filp_head, &arg.fbs);
465466

466467
schedule_work(&arg.work);
@@ -827,6 +828,8 @@ void drm_framebuffer_free(struct kref *kref)
827828
container_of(kref, struct drm_framebuffer, base.refcount);
828829
struct drm_device *dev = fb->dev;
829830

831+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
832+
830833
/*
831834
* The lookup idr holds a weak reference, which has not necessarily been
832835
* removed at this point. Check for that.
@@ -1119,7 +1122,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
11191122

11201123
dev = fb->dev;
11211124

1122-
WARN_ON(!list_empty(&fb->filp_head));
1125+
drm_WARN_ON(dev, !list_empty(&fb->filp_head));
11231126

11241127
/*
11251128
* drm ABI mandates that we remove any deleted framebuffers from active

drivers/gpu/drm/drm_plane.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
15031503
out:
15041504
if (fb)
15051505
drm_framebuffer_put(fb);
1506+
fb = NULL;
15061507
if (plane->old_fb)
15071508
drm_framebuffer_put(plane->old_fb);
15081509
plane->old_fb = NULL;

drivers/gpu/drm/imagination/pvr_device.h

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -193,32 +193,33 @@ struct pvr_device {
193193
* @queues: Queue-related fields.
194194
*/
195195
struct {
196-
/** @active: Active queue list. */
196+
/** @queues.active: Active queue list. */
197197
struct list_head active;
198198

199-
/** @idle: Idle queue list. */
199+
/** @queues.idle: Idle queue list. */
200200
struct list_head idle;
201201

202-
/** @lock: Lock protecting access to the active/idle lists. */
202+
/** @queues.lock: Lock protecting access to the active/idle
203+
* lists. */
203204
struct mutex lock;
204205
} queues;
205206

206207
/**
207208
* @watchdog: Watchdog for communications with firmware.
208209
*/
209210
struct {
210-
/** @work: Work item for watchdog callback. */
211+
/** @watchdog.work: Work item for watchdog callback. */
211212
struct delayed_work work;
212213

213214
/**
214-
* @old_kccb_cmds_executed: KCCB command execution count at last
215-
* watchdog poll.
215+
* @watchdog.old_kccb_cmds_executed: KCCB command execution
216+
* count at last watchdog poll.
216217
*/
217218
u32 old_kccb_cmds_executed;
218219

219220
/**
220-
* @kccb_stall_count: Number of watchdog polls KCCB has been
221-
* stalled for.
221+
* @watchdog.kccb_stall_count: Number of watchdog polls
222+
* KCCB has been stalled for.
222223
*/
223224
u32 kccb_stall_count;
224225
} watchdog;
@@ -227,43 +228,46 @@ struct pvr_device {
227228
* @kccb: Circular buffer for communications with firmware.
228229
*/
229230
struct {
230-
/** @ccb: Kernel CCB. */
231+
/** @kccb.ccb: Kernel CCB. */
231232
struct pvr_ccb ccb;
232233

233-
/** @rtn_q: Waitqueue for KCCB command return waiters. */
234+
/** @kccb.rtn_q: Waitqueue for KCCB command return waiters. */
234235
wait_queue_head_t rtn_q;
235236

236-
/** @rtn_obj: Object representing KCCB return slots. */
237+
/** @kccb.rtn_obj: Object representing KCCB return slots. */
237238
struct pvr_fw_object *rtn_obj;
238239

239240
/**
240-
* @rtn: Pointer to CPU mapping of KCCB return slots. Must be
241-
* accessed by READ_ONCE()/WRITE_ONCE().
241+
* @kccb.rtn: Pointer to CPU mapping of KCCB return slots.
242+
* Must be accessed by READ_ONCE()/WRITE_ONCE().
242243
*/
243244
u32 *rtn;
244245

245-
/** @slot_count: Total number of KCCB slots available. */
246+
/** @kccb.slot_count: Total number of KCCB slots available. */
246247
u32 slot_count;
247248

248-
/** @reserved_count: Number of KCCB slots reserved for future use. */
249+
/** @kccb.reserved_count: Number of KCCB slots reserved for
250+
* future use. */
249251
u32 reserved_count;
250252

251253
/**
252-
* @waiters: List of KCCB slot waiters.
254+
* @kccb.waiters: List of KCCB slot waiters.
253255
*/
254256
struct list_head waiters;
255257

256-
/** @fence_ctx: KCCB fence context. */
258+
/** @kccb.fence_ctx: KCCB fence context. */
257259
struct {
258-
/** @id: KCCB fence context ID allocated with dma_fence_context_alloc(). */
260+
/** @kccb.fence_ctx.id: KCCB fence context ID
261+
* allocated with dma_fence_context_alloc(). */
259262
u64 id;
260263

261-
/** @seqno: Sequence number incremented each time a fence is created. */
264+
/** @kccb.fence_ctx.seqno: Sequence number incremented
265+
* each time a fence is created. */
262266
atomic_t seqno;
263267

264268
/**
265-
* @lock: Lock used to synchronize access to fences allocated by this
266-
* context.
269+
* @kccb.fence_ctx.lock: Lock used to synchronize
270+
* access to fences allocated by this context.
267271
*/
268272
spinlock_t lock;
269273
} fence_ctx;

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -959,12 +959,6 @@ static void vop2_enable(struct vop2 *vop2)
959959
return;
960960
}
961961

962-
ret = regmap_reinit_cache(vop2->map, &vop2_regmap_config);
963-
if (ret) {
964-
drm_err(vop2->drm, "failed to reinit cache: %d\n", ret);
965-
return;
966-
}
967-
968962
if (vop2->data->soc_id == 3566)
969963
vop2_writel(vop2, RK3568_OTP_WIN_EN, 1);
970964

@@ -996,6 +990,8 @@ static void vop2_disable(struct vop2 *vop2)
996990

997991
pm_runtime_put_sync(vop2->dev);
998992

993+
regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register);
994+
999995
clk_disable_unprepare(vop2->pclk);
1000996
clk_disable_unprepare(vop2->aclk);
1001997
clk_disable_unprepare(vop2->hclk);
@@ -1705,8 +1701,8 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
17051701
* *if_pixclk_div = dclk_rate / if_pixclk_rate;
17061702
* *if_dclk_div = dclk_rate / if_dclk_rate;
17071703
*/
1708-
*if_pixclk_div = 2;
1709-
*if_dclk_div = 4;
1704+
*if_pixclk_div = 2;
1705+
*if_dclk_div = 4;
17101706
} else if (vop2_output_if_is_edp(id)) {
17111707
/*
17121708
* edp_pixclk = edp_dclk > dclk_core

0 commit comments

Comments
 (0)