[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250529-vsp1_dl_list_count-v1-2-40c6d0e20592@ideasonboard.com>
Date: Thu, 29 May 2025 18:36:31 +0200
From: Jacopo Mondi <jacopo.mondi+renesas@...asonboard.com>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jacopo Mondi <jacopo.mondi+renesas@...asonboard.com>
Subject: [PATCH 2/2] media: vsp1: vsp1_dl: Count display lists
To detect invalid usage patterns of the display list helpers, store
in the display list manager the number of available display lists
when the manager is created and verify that when the display manager
is reset the same number of lists is available.
Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@...asonboard.com>
---
drivers/media/platform/renesas/vsp1/vsp1_dl.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/media/platform/renesas/vsp1/vsp1_dl.c b/drivers/media/platform/renesas/vsp1/vsp1_dl.c
index 8a3c0274a163..5c4eeb65216f 100644
--- a/drivers/media/platform/renesas/vsp1/vsp1_dl.c
+++ b/drivers/media/platform/renesas/vsp1/vsp1_dl.c
@@ -214,6 +214,7 @@ struct vsp1_dl_list {
* @pending: list waiting to be queued to the hardware
* @pool: body pool for the display list bodies
* @cmdpool: commands pool for extended display list
+ * @list_count: display list counter
*/
struct vsp1_dl_manager {
unsigned int index;
@@ -228,6 +229,8 @@ struct vsp1_dl_manager {
struct vsp1_dl_body_pool *pool;
struct vsp1_dl_cmd_pool *cmdpool;
+
+ size_t list_count;
};
/* -----------------------------------------------------------------------------
@@ -1073,7 +1076,9 @@ void vsp1_dlm_setup(struct vsp1_device *vsp1)
void vsp1_dlm_reset(struct vsp1_dl_manager *dlm)
{
+ size_t dlm_list_count;
unsigned long flags;
+ size_t list_count;
spin_lock_irqsave(&dlm->lock, flags);
@@ -1081,8 +1086,13 @@ void vsp1_dlm_reset(struct vsp1_dl_manager *dlm)
__vsp1_dl_list_put(dlm->queued);
__vsp1_dl_list_put(dlm->pending);
+ list_count = list_count_nodes(&dlm->free);
+ dlm_list_count = dlm->list_count;
+
spin_unlock_irqrestore(&dlm->lock, flags);
+ WARN_ON_ONCE(list_count != dlm_list_count);
+
dlm->active = NULL;
dlm->queued = NULL;
dlm->pending = NULL;
@@ -1150,6 +1160,7 @@ struct vsp1_dl_manager *vsp1_dlm_create(struct vsp1_device *vsp1,
+ sizeof(*dl->header);
list_add_tail(&dl->list, &dlm->free);
+ dlm->list_count = list_count_nodes(&dlm->free);
}
if (vsp1_feature(vsp1, VSP1_HAS_EXT_DL)) {
--
2.49.0
Powered by blists - more mailing lists