diff options
author | Dave Airlie <airlied@redhat.com> | 2024-01-05 10:31:29 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2024-01-05 10:31:54 +1000 |
commit | 3c064aea46d071ccf95a142be5532768a7fa6f02 (patch) | |
tree | e7245d247824842632cfbdb11636b8b22e8da0ae /drivers | |
parent | cff601b45723f9a1415a6599fc24e073a7295cef (diff) | |
parent | eee706839333ec0643f1b4898a37588025bf4cb5 (diff) |
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
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_framebuffer.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_plane.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/imagination/pvr_device.h | 46 | ||||
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 12 |
4 files changed, 34 insertions, 30 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 3cc0ffc28e86..888aadb6a4ac 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -461,6 +461,7 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id, INIT_WORK_ONSTACK(&arg.work, drm_mode_rmfb_work_fn); INIT_LIST_HEAD(&arg.fbs); + drm_WARN_ON(dev, !list_empty(&fb->filp_head)); list_add_tail(&fb->filp_head, &arg.fbs); schedule_work(&arg.work); @@ -827,6 +828,8 @@ void drm_framebuffer_free(struct kref *kref) container_of(kref, struct drm_framebuffer, base.refcount); struct drm_device *dev = fb->dev; + drm_WARN_ON(dev, !list_empty(&fb->filp_head)); + /* * The lookup idr holds a weak reference, which has not necessarily been * removed at this point. Check for that. @@ -1119,7 +1122,7 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb) dev = fb->dev; - WARN_ON(!list_empty(&fb->filp_head)); + drm_WARN_ON(dev, !list_empty(&fb->filp_head)); /* * drm ABI mandates that we remove any deleted framebuffers from active diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 9e8e4c60983d..672c655c7a8e 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -1503,6 +1503,7 @@ retry: out: if (fb) drm_framebuffer_put(fb); + fb = NULL; if (plane->old_fb) drm_framebuffer_put(plane->old_fb); plane->old_fb = NULL; diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/imagination/pvr_device.h index 2ca7e535799f..ecdd5767d8ef 100644 --- a/drivers/gpu/drm/imagination/pvr_device.h +++ b/drivers/gpu/drm/imagination/pvr_device.h @@ -193,13 +193,14 @@ struct pvr_device { * @queues: Queue-related fields. */ struct { - /** @active: Active queue list. */ + /** @queues.active: Active queue list. */ struct list_head active; - /** @idle: Idle queue list. */ + /** @queues.idle: Idle queue list. */ struct list_head idle; - /** @lock: Lock protecting access to the active/idle lists. */ + /** @queues.lock: Lock protecting access to the active/idle + * lists. */ struct mutex lock; } queues; @@ -207,18 +208,18 @@ struct pvr_device { * @watchdog: Watchdog for communications with firmware. */ struct { - /** @work: Work item for watchdog callback. */ + /** @watchdog.work: Work item for watchdog callback. */ struct delayed_work work; /** - * @old_kccb_cmds_executed: KCCB command execution count at last - * watchdog poll. + * @watchdog.old_kccb_cmds_executed: KCCB command execution + * count at last watchdog poll. */ u32 old_kccb_cmds_executed; /** - * @kccb_stall_count: Number of watchdog polls KCCB has been - * stalled for. + * @watchdog.kccb_stall_count: Number of watchdog polls + * KCCB has been stalled for. */ u32 kccb_stall_count; } watchdog; @@ -227,43 +228,46 @@ struct pvr_device { * @kccb: Circular buffer for communications with firmware. */ struct { - /** @ccb: Kernel CCB. */ + /** @kccb.ccb: Kernel CCB. */ struct pvr_ccb ccb; - /** @rtn_q: Waitqueue for KCCB command return waiters. */ + /** @kccb.rtn_q: Waitqueue for KCCB command return waiters. */ wait_queue_head_t rtn_q; - /** @rtn_obj: Object representing KCCB return slots. */ + /** @kccb.rtn_obj: Object representing KCCB return slots. */ struct pvr_fw_object *rtn_obj; /** - * @rtn: Pointer to CPU mapping of KCCB return slots. Must be - * accessed by READ_ONCE()/WRITE_ONCE(). + * @kccb.rtn: Pointer to CPU mapping of KCCB return slots. + * Must be accessed by READ_ONCE()/WRITE_ONCE(). */ u32 *rtn; - /** @slot_count: Total number of KCCB slots available. */ + /** @kccb.slot_count: Total number of KCCB slots available. */ u32 slot_count; - /** @reserved_count: Number of KCCB slots reserved for future use. */ + /** @kccb.reserved_count: Number of KCCB slots reserved for + * future use. */ u32 reserved_count; /** - * @waiters: List of KCCB slot waiters. + * @kccb.waiters: List of KCCB slot waiters. */ struct list_head waiters; - /** @fence_ctx: KCCB fence context. */ + /** @kccb.fence_ctx: KCCB fence context. */ struct { - /** @id: KCCB fence context ID allocated with dma_fence_context_alloc(). */ + /** @kccb.fence_ctx.id: KCCB fence context ID + * allocated with dma_fence_context_alloc(). */ u64 id; - /** @seqno: Sequence number incremented each time a fence is created. */ + /** @kccb.fence_ctx.seqno: Sequence number incremented + * each time a fence is created. */ atomic_t seqno; /** - * @lock: Lock used to synchronize access to fences allocated by this - * context. + * @kccb.fence_ctx.lock: Lock used to synchronize + * access to fences allocated by this context. */ spinlock_t lock; } fence_ctx; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 44508c2dd614..574103fc79f9 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -959,12 +959,6 @@ static void vop2_enable(struct vop2 *vop2) return; } - ret = regmap_reinit_cache(vop2->map, &vop2_regmap_config); - if (ret) { - drm_err(vop2->drm, "failed to reinit cache: %d\n", ret); - return; - } - if (vop2->data->soc_id == 3566) vop2_writel(vop2, RK3568_OTP_WIN_EN, 1); @@ -996,6 +990,8 @@ static void vop2_disable(struct vop2 *vop2) pm_runtime_put_sync(vop2->dev); + regcache_drop_region(vop2->map, 0, vop2_regmap_config.max_register); + clk_disable_unprepare(vop2->pclk); clk_disable_unprepare(vop2->aclk); clk_disable_unprepare(vop2->hclk); @@ -1705,8 +1701,8 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id, * *if_pixclk_div = dclk_rate / if_pixclk_rate; * *if_dclk_div = dclk_rate / if_dclk_rate; */ - *if_pixclk_div = 2; - *if_dclk_div = 4; + *if_pixclk_div = 2; + *if_dclk_div = 4; } else if (vop2_output_if_is_edp(id)) { /* * edp_pixclk = edp_dclk > dclk_core |