From nobody Mon Feb 9 04:04:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D715352FA3; Thu, 22 Jan 2026 14:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093106; cv=none; b=J6glM1fBWJeCtrgjmas6LxHEdgySiUHnEyRnPce6pqfIhzXYgZyd8krWHoSwkqttpfKbMhfQ3c2SWjtiz4hFpeHc1l2OI3s7VAjm3b81pH1SAAV5GADe+suiql+ZWTyTbIm87J00pU2c2zM5njXirVc5YjiWcraGZBjYyg2mlns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093106; c=relaxed/simple; bh=5oJ7muIlKrTCE7hk0LsBSqCNpuuKQGVs3p7fy03ndGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oHtToa4qpYSVqgzi3g/NznTeWigRkCEwHh+FanaptGN1KVLnKrC5eKjqdiyV3NyZ+r2dLWtZ1VETlxHjryP0loSEB2/VakSyNLwnZfUu2nQIvL8gNfW7V+lnGvvINLx1IsrQ4Hv32+zKVQ13nX+3kDevqPAuG3mta84pWrCpaqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=eWjoHduc; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eWjoHduc" Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bc8e:214:d514:699a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id F0A7463B; Thu, 22 Jan 2026 15:44:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1769093069; bh=5oJ7muIlKrTCE7hk0LsBSqCNpuuKQGVs3p7fy03ndGc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eWjoHducJ2w2NbYgQw6+sssoC7fkK5beMcxI7NqQIVktPg9dgxNwZ+LCLmsbhq2Qt FX9IJ+Lc76nl6mMLM5bEhDXv0Ds+ls6PnpZQJ+s+KKyxVLPV6f/cS4VJwxxoTRF4Zj y/sMNCuwQqtjqExrlRSnz5QaYuEujw65vywyNu2o= From: Stefan Klug Date: Thu, 22 Jan 2026 15:44:56 +0100 Subject: [PATCH v2 1/3] media: dw100: Implement V4L2 requests support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-1-ea1e29f18cf1@ideasonboard.com> References: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> In-Reply-To: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> To: Xavier Roumegue , Mauro Carvalho Chehab , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Nicolas Dufresne , Stefan Klug X-Mailer: b4 0.14.2 The dw100 dewarper hardware present on the NXP i.MX8MP allows very flexible dewarping using a freely configurable vertex map. Aside from lens dewarping the vertex map can be used to implement things like arbitrary zoom, pan and rotation. The current driver supports setting that vertex map before calling VIDIOC_STREAMON. To control above mentioned features during streaming it is necessary to update the vertex map dynamically. To do that in a race free manner V4L2 requests support is required. This patch adds V4L2 requests support to prepare for dynamic vertex map updates. Signed-off-by: Stefan Klug --- Changes in v2: - Use v4l2_m2m_buf_done_and_job_finish() to mark the buffers as done in the correct order. Changes in v1: - Moved v4l2_ctrl_request_complete into dw100_device_run --- drivers/media/platform/nxp/dw100/dw100.c | 49 +++++++++++++++++++++++++---= ---- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index 4aaf9c3fff5397f0441944ee926f2c8ba6fc864a..1cb895da9912371a2b23ca62412= c572d9cb75c00 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -459,6 +459,15 @@ static int dw100_queue_setup(struct vb2_queue *vq, return 0; } =20 +static int dw100_buf_out_validate(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer(vb); + + vbuf->field =3D V4L2_FIELD_NONE; + + return 0; +} + static int dw100_buf_prepare(struct vb2_buffer *vb) { unsigned int i; @@ -500,6 +509,13 @@ static void dw100_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); } =20 +static void dw100_buf_request_complete(struct vb2_buffer *vb) +{ + struct dw100_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); + + v4l2_ctrl_request_complete(vb->req_obj.req, &ctx->hdl); +} + static void dw100_return_all_buffers(struct vb2_queue *q, enum vb2_buffer_state state) { @@ -553,11 +569,13 @@ static void dw100_stop_streaming(struct vb2_queue *q) } =20 static const struct vb2_ops dw100_qops =3D { - .queue_setup =3D dw100_queue_setup, - .buf_prepare =3D dw100_buf_prepare, - .buf_queue =3D dw100_buf_queue, - .start_streaming =3D dw100_start_streaming, - .stop_streaming =3D dw100_stop_streaming, + .queue_setup =3D dw100_queue_setup, + .buf_out_validate =3D dw100_buf_out_validate, + .buf_prepare =3D dw100_buf_prepare, + .buf_queue =3D dw100_buf_queue, + .start_streaming =3D dw100_start_streaming, + .stop_streaming =3D dw100_stop_streaming, + .buf_request_complete =3D dw100_buf_request_complete, }; =20 static int dw100_m2m_queue_init(void *priv, struct vb2_queue *src_vq, @@ -575,6 +593,7 @@ static int dw100_m2m_queue_init(void *priv, struct vb2_= queue *src_vq, src_vq->timestamp_flags =3D V4L2_BUF_FLAG_TIMESTAMP_COPY; src_vq->lock =3D &ctx->vq_mutex; src_vq->dev =3D ctx->dw_dev->v4l2_dev.dev; + src_vq->supports_requests =3D true; =20 ret =3D vb2_queue_init(src_vq); if (ret) @@ -1058,7 +1077,6 @@ static const struct v4l2_ioctl_ops dw100_ioctl_ops = =3D { static void dw100_job_finish(struct dw100_device *dw_dev, bool with_error) { struct dw100_ctx *curr_ctx; - struct vb2_v4l2_buffer *src_vb, *dst_vb; enum vb2_buffer_state buf_state; =20 curr_ctx =3D v4l2_m2m_get_curr_priv(dw_dev->m2m_dev); @@ -1069,16 +1087,13 @@ static void dw100_job_finish(struct dw100_device *d= w_dev, bool with_error) return; } =20 - src_vb =3D v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx); - dst_vb =3D v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx); - if (likely(!with_error)) buf_state =3D VB2_BUF_STATE_DONE; else buf_state =3D VB2_BUF_STATE_ERROR; =20 - v4l2_m2m_buf_done(src_vb, buf_state); - v4l2_m2m_buf_done(dst_vb, buf_state); + v4l2_m2m_buf_done_and_job_finish(dw_dev->m2m_dev, curr_ctx->fh.m2m_ctx, + buf_state); =20 dev_dbg(&dw_dev->pdev->dev, "Finishing transaction with%s error(s)\n", with_error ? "" : "out"); @@ -1460,6 +1475,12 @@ static void dw100_device_run(void *priv) src_buf =3D v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf =3D v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); =20 + v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, + &ctx->hdl); + + v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, + &ctx->hdl); + dw100_start(ctx, src_buf, dst_buf); } =20 @@ -1467,6 +1488,11 @@ static const struct v4l2_m2m_ops dw100_m2m_ops =3D { .device_run =3D dw100_device_run, }; =20 +static const struct media_device_ops dw100_m2m_media_ops =3D { + .req_validate =3D vb2_request_validate, + .req_queue =3D v4l2_m2m_request_queue, +}; + static struct video_device *dw100_init_video_device(struct dw100_device *d= w_dev) { struct video_device *vfd =3D &dw_dev->vfd; @@ -1578,6 +1604,7 @@ static int dw100_probe(struct platform_device *pdev) dw_dev->mdev.dev =3D &pdev->dev; strscpy(dw_dev->mdev.model, "dw100", sizeof(dw_dev->mdev.model)); media_device_init(&dw_dev->mdev); + dw_dev->mdev.ops =3D &dw100_m2m_media_ops; dw_dev->v4l2_dev.mdev =3D &dw_dev->mdev; =20 ret =3D video_register_device(vfd, VFL_TYPE_VIDEO, -1); --=20 2.51.0 From nobody Mon Feb 9 04:04:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40B7E35B138; Thu, 22 Jan 2026 14:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093108; cv=none; b=A/xVpL3s1LqXSu4JYIHs4FP6vEs1uvJlRRbIf6gbVn1h4JmWO/5It2c1lmirL/nD8XnBGQ6ea3/OBS7xGB1+bsNUAYX/PAwSWa3QPAqyN3Qltl2nIxJkCYzCqwJVk1Xj1Z8SHLYuie70Q8KiOPawu6Hgj43UQFT5d6ofSSnAfCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093108; c=relaxed/simple; bh=RhUZ81l7yNwwNw6VQzmc+HcVsUJ4nb05ME1YwQaDjNA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e/xwKWBGQTmmupi354PYBLBPoalOScFn5UZoFjXQDeq4eIYVB3pUF358XqQPJe/NGGgu5mqf1rlRkYoNwOzW3saZHwRlmWZkTVY3oW13NQFy98mcMD3t7bB2Vz2fEvlAldAiCNQzr3XFiTjStFHneIFIYhKOY5nrWady5GtD80M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=g4/8OIb+; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="g4/8OIb+" Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bc8e:214:d514:699a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 5BB7DA06; Thu, 22 Jan 2026 15:44:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1769093072; bh=RhUZ81l7yNwwNw6VQzmc+HcVsUJ4nb05ME1YwQaDjNA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g4/8OIb+JnhNHC48BsbAeU/zM5QpU2uDbP3wESJSmYEWSVVRBVAt1qZZgFa7y3cJx oe3Rc9mLiHLasEfZauiVUqe0UEhrEhBvfmNnbYKwOU4eW+aRRpfl8qMDKbsgAJ1Gid TvCSKL3kbjQUtdZ05tweOj8Emvw9G1SnHj2Uhsio= From: Stefan Klug Date: Thu, 22 Jan 2026 15:44:57 +0100 Subject: [PATCH v2 2/3] media: dw100: Implement dynamic vertex map update Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-2-ea1e29f18cf1@ideasonboard.com> References: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> In-Reply-To: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> To: Xavier Roumegue , Mauro Carvalho Chehab , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Nicolas Dufresne , Stefan Klug X-Mailer: b4 0.14.2 Implement dynamic vertex map updates by handling the V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP control during streaming. This allows to implement features like dynamic zoom, pan, rotate and dewarp. To stay compatible with the old version, updates of V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP are ignored during streaming when requests are not used. Print a corresponding warning once. Signed-off-by: Stefan Klug --- Changes in v2: - Replaced the manual warn once by dev_warn_once(). This changes the frequency from once per context to once per boot which was agreed to be enough. - Renamed user_map_needs_update to user_map_is_dirty as it is more expressive and fits to user_map_is_set - Fixed indentation issue found by Media CI --- drivers/media/platform/nxp/dw100/dw100.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index 1cb895da9912371a2b23ca62412c572d9cb75c00..d2b1c62b52db47ea1d2242caaf3= 34fff30c6f366 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -98,6 +98,7 @@ struct dw100_ctx { unsigned int map_width; unsigned int map_height; bool user_map_is_set; + bool user_map_is_dirty; =20 /* Source and destination queue data */ struct dw100_q_data q_data[2]; @@ -293,11 +294,15 @@ static u32 dw100_map_format_coordinates(u16 xq, u16 y= q) return (u32)((yq << 16) | xq); } =20 -static u32 *dw100_get_user_map(struct dw100_ctx *ctx) +static void dw100_update_mapping(struct dw100_ctx *ctx) { struct v4l2_ctrl *ctrl =3D ctx->ctrls[DW100_CTRL_DEWARPING_MAP]; =20 - return ctrl->p_cur.p_u32; + if (!ctx->user_map_is_dirty) + return; + + memcpy(ctx->map, ctrl->p_cur.p_u32, ctx->map_size); + ctx->user_map_is_dirty =3D false; } =20 /* @@ -306,8 +311,6 @@ static u32 *dw100_get_user_map(struct dw100_ctx *ctx) */ static int dw100_create_mapping(struct dw100_ctx *ctx) { - u32 *user_map; - if (ctx->map) dma_free_coherent(&ctx->dw_dev->pdev->dev, ctx->map_size, ctx->map, ctx->map_dma); @@ -318,8 +321,8 @@ static int dw100_create_mapping(struct dw100_ctx *ctx) if (!ctx->map) return -ENOMEM; =20 - user_map =3D dw100_get_user_map(ctx); - memcpy(ctx->map, user_map, ctx->map_size); + ctx->user_map_is_dirty =3D true; + dw100_update_mapping(ctx); =20 dev_dbg(&ctx->dw_dev->pdev->dev, "%ux%u %s mapping created (d:%pad-c:%p) for stream %ux%u->%ux%u\n", @@ -351,6 +354,7 @@ static int dw100_s_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP: ctx->user_map_is_set =3D true; + ctx->user_map_is_dirty =3D true; break; } =20 @@ -405,6 +409,7 @@ static void dw100_ctrl_dewarping_map_init(const struct = v4l2_ctrl *ctrl, } =20 ctx->user_map_is_set =3D false; + ctx->user_map_is_dirty =3D true; } =20 static const struct v4l2_ctrl_type_ops dw100_ctrl_type_ops =3D { @@ -1478,6 +1483,13 @@ static void dw100_device_run(void *priv) v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, &ctx->hdl); =20 + if (src_buf->vb2_buf.req_obj.req) + dw100_update_mapping(ctx); + else if (ctx->user_map_is_dirty) + dev_warn_once(&ctx->dw_dev->pdev->dev, + "V4L2 requests are required to update the vertex map dynamically" + ); + v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, &ctx->hdl); =20 --=20 2.51.0 From nobody Mon Feb 9 04:04:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15E2D357A38; Thu, 22 Jan 2026 14:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093112; cv=none; b=ezWNqZiDcER+/BCuB5qorM21jDFikfuEHBW+oAbU//r5m+QcG14+N8dzjjdYI0iAinCf6r18bte/gxWe7+lnDfXAJclKWS3pOsIfdO04ozqnaqSwDbgVxF9lxLfKJ1YmS20Ckf1Spngg6Zm2O4on6WQnYmmO2yM5in6IM5Kd/8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769093112; c=relaxed/simple; bh=y6/khB2UNCiHfdNdPN2LvHiuyaNgpFQi7MthW3acgkE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Um8INPgXXy51LxCpKD5QtMX96q8OxwQ/51PM5ZIqFK+CxjJBUcqaUzwi1d+mAPCR/Juk2oIe7Fk6pJeVGxmoclKPemlooQegu5fYk3/6gkfbAtgS2WFkyExM9zug1CBgmcvgPYnBeORCzafevdlJujy0kaK8k4vg7aIQG0ZiB3s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=BgmzWz4u; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BgmzWz4u" Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:bc8e:214:d514:699a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 4D3101AEE; Thu, 22 Jan 2026 15:44:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1769093075; bh=y6/khB2UNCiHfdNdPN2LvHiuyaNgpFQi7MthW3acgkE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BgmzWz4uJiV3DgO0OheZ8oZR2tZQIhPOQYcFgvFElJ9vg6/rMxRousG89pqrn1x0d 0DFiMTUf4o+XnN7hk0OQpEmwmr8E2IsfX8+6AJe9lUGeEIG8hegNPD/jhZMeKucg54 g3h9wHfRelC/yao9aw7MFxSubq0eHgnlXcnD2LqY= From: Stefan Klug Date: Thu, 22 Jan 2026 15:44:58 +0100 Subject: [PATCH v2 3/3] media: dw100: Fix kernel oops with PREEMPT_RT enabled Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-3-ea1e29f18cf1@ideasonboard.com> References: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> In-Reply-To: <20260122-sklug-v6-16-topic-dw100-v3-1-dev-v2-0-ea1e29f18cf1@ideasonboard.com> To: Xavier Roumegue , Mauro Carvalho Chehab , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Nicolas Dufresne , Stefan Klug X-Mailer: b4 0.14.2 On kernels with PREEMPT_RT enabled, a "BUG: scheduling while atomic" kernel oops occurs inside dw100_irq_handler -> vb2_buffer_done. This is because vb2_buffer_done takes a spinlock which is not allowed within interrupt context on PREEMPT_RT. Fix that by dropping the IRQF_ONESHOT flag. There was only a hard interrupt handler specified anyways, so IRQF_ONESHOT didn't have any effect on non PREEMPT_RT systems. On PREEMPT_RT systems the interrupt handler is automatically changed to threaded and the IRQF_ONESHOT flag get's set internally. There is one caveat though: During development regular "dw100 32e30000.dwe: Interrupt error: 0x1" errors occurred due to DW100_INTERRUPT_STATUS_INT_ERR_TIME_OUT being set. This only happened on non PREEMPT_RT setups when the interrupt handler was manually forced to be threaded. On PREEMPT_RT systems (where the interrupt handler is now implicitly threaded) this error was never seen. Signed-off-by: Stefan Klug Reviewed-by: Sebastian Andrzej Siewior --- Changes in v2: - Dropped the IRQF_ONESHOT instead of making the interrupt handler threaded to fix the issue. - I didn't keep the r-by tag from Nicolas as the solution is now a different one. --- drivers/media/platform/nxp/dw100/dw100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index d2b1c62b52db47ea1d2242caaf334fff30c6f366..4c8be66f87519b36b2273ecf3f3= 4eab03c5e6738 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -1593,7 +1593,7 @@ static int dw100_probe(struct platform_device *pdev) =20 pm_runtime_put_sync(&pdev->dev); =20 - ret =3D devm_request_irq(&pdev->dev, irq, dw100_irq_handler, IRQF_ONESHOT, + ret =3D devm_request_irq(&pdev->dev, irq, dw100_irq_handler, 0, dev_name(&pdev->dev), dw_dev); if (ret < 0) { dev_err(&pdev->dev, "Failed to request irq: %d\n", ret); --=20 2.51.0