* [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first()
@ 2025-02-05 17:29 Martin Kepplinger-Novaković
2025-02-06 8:49 ` Martin Kepplinger
0 siblings, 1 reply; 5+ messages in thread
From: Martin Kepplinger-Novaković @ 2025-02-05 17:29 UTC (permalink / raw)
To: laurent.pinchart, mchehab, shawnguo, s.hauer, kernel, festevam
Cc: linux-media, imx, linux-arm-kernel, linux-kernel,
Martin Kepplinger-Novaković
media_pad_remote_pad_first() return NULL if "no enabled link has been found".
Check for that.
backstory
=========
While trying to get a (Y10 grey) sensor working on imx8mp (v6.12.12 now and
I know the hardware works on an ancient nxp-kernel),
I tried to enable the sensor link, set formats and stream:
media-ctl -d 1 --links "'vc-mipi-cam 3-001a':0->'csis-32e50000.csi':0[1]"
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"vc-mipi-cam 3-001a":0[fmt:Y10_1X10/2592x1944 field:none]'
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"csis-32e50000.csi":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"crossbar":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"mxc_isi.0":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
v4l2-ctl -d /dev/video1 --set-fmt-video=width=2592,height=1944,pixelformat="Y10 "
v4l2-ctl --verbose --device /dev/video1 --stream-mmap
and what I got was the NULL pointer deref, I append below. With this patch I
at least get a nice "VIDIOC_STREAMON returned -1 (Broken pipe)".
[ 29.936640] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
[ 29.947993] Mem abort info:
[ 29.950791] ESR = 0x0000000096000006
[ 29.954544] EC = 0x25: DABT (current EL), IL = 32 bits
[ 29.959861] SET = 0, FnV = 0
[ 29.962935] EA = 0, S1PTW = 0
[ 29.966084] FSC = 0x06: level 2 translation fault
[ 29.970977] Data abort info:
[ 29.973860] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000
[ 29.979358] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 29.984414] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 29.989740] user pgtable: 4k pages, 48-bit VAs, pgdp=000000004536d000
[ 29.996186] [0000000000000020] pgd=08000000452ec003, p4d=08000000452ec003, pud=080000004361a003, pmd=0000000000000000
[ 30.006820] Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
[ 30.013087] Modules linked in:
[ 30.016143] CPU: 3 UID: 0 PID: 433 Comm: v4l2-ctl Not tainted 6.12.12-ge-24.09+-gd7393141dd76 #104
[ 30.025102] Hardware name: MMI4.0 i.MX8MPlus (DT)
[ 30.029804] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 30.036766] pc : mxc_isi_crossbar_xlate_streams+0xb0/0x10c
[ 30.042258] lr : mxc_isi_crossbar_xlate_streams+0xac/0x10c
[ 30.047745] sp : ffff800083db3930
[ 30.051058] x29: ffff800083db3930 x28: ffff800083db39e8 x27: ffff800083db39f0
[ 30.058200] x26: ffff800083db39ec x25: ffff000002eff0a8 x24: 0000000000000000
[ 30.065339] x23: 0000000000000001 x22: 0000000000000001 x21: 0000000000000001
[ 30.072478] x20: 0000000000000003 x19: ffff000003e3c4b8 x18: 0000000000000000
[ 30.079616] x17: 0000000000000000 x16: ffff800080000000 x15: 000000000099e000
[ 30.086756] x14: 0000000000000002 x13: 0000000000036754 x12: 0000000000000010
[ 30.093894] x11: 0000000000000001 x10: 0000000000000064 x9 : 0000000000000004
[ 30.101032] x8 : ffff00000348332c x7 : ffff000003483200 x6 : ffff800083db39ec
[ 30.108172] x5 : ffff000003483000 x4 : 000000000fffffff x3 : ffff000002eff110
[ 30.115312] x2 : ffff0000048a5270 x1 : 0000000000000000 x0 : 0000000000000000
[ 30.122453] Call trace:
[ 30.124898] mxc_isi_crossbar_xlate_streams+0xb0/0x10c
[ 30.130038] mxc_isi_crossbar_enable_streams+0x44/0x16c
[ 30.135263] v4l2_subdev_enable_streams.part.0+0x130/0x2ac
[ 30.140750] v4l2_subdev_enable_streams+0x48/0x68
[ 30.145454] mxc_isi_pipe_enable+0x1d4/0x24c
ed 0 (Success)
[V I D3I0O.C149725] mxc_isi_vb2_start_streaming+0xa0/0xe4
[ 30.156596] vb2_start_streaming+0x6c/0x180
[ 30.160782] vb2_core_streamon+0x100/0x1c4
[ 30.164880] vb2_streamon+0x18/0x64
[ 30.168369] mxc_isi_video_streamon+0x284/0x2f4
[ 30.172901] v4l_streamon+0x24/0x30
[ 30.176391] __video_do_ioctl+0x15c/0x3c0
[ 30.180402] video_usercopy+0x1a4/0x67c
[ 30.184240] video_ioctl2+0x18/0x24
[ 30.187732] v4l2_ioctl+0x40/0x60
[ 30.191047] __arm64_sys_ioctl+0xac/0xf0
[ 30.194972] invoke_syscall+0x48/0x110
[ 30.198726] el0_svc_common.constprop.0+0x40/0xe0
[ 30.203431] do_el0_svc+0x1c/0x28
[ 30.206747] el0_svc+0x30/0xd0
[ 30.209806] el0t_64_sync_handler+0x100/0x12c
[ 30.214164] el0t_64_sync+0x190/0x194
[ 30.217830] Code: 937a7f00 8b000020 97fec7a3 aa0003e1 (f9401000)
[ 30.223923] ---[ end trace 0000000000000000 ]---
_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
Signed-off-by: Martin Kepplinger-Novaković <martink@posteo.de>
---
the real problem
================
Obviously "broken pipe" for "stream on" is still not what I want :)
The "no enabled link has been found" seems to happen during "VIDIOC_QBUF".
Does anything come to mind what goes wrong here for me?
thanks a lot for having a look,
martin
drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
index 93a55c97cd173..e53a8e01c8be1 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
@@ -160,6 +160,11 @@ mxc_isi_crossbar_xlate_streams(struct mxc_isi_crossbar *xbar,
}
pad = media_pad_remote_pad_first(&xbar->pads[sink_pad]);
+ if (!pad) {
+ dev_warn(xbar->isi->dev, "no enabled link has been found.\n");
+ return ERR_PTR(-EPIPE);
+ }
+
sd = media_entity_to_v4l2_subdev(pad->entity);
if (!sd) {
dev_dbg(xbar->isi->dev,
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first()
2025-02-05 17:29 [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first() Martin Kepplinger-Novaković
@ 2025-02-06 8:49 ` Martin Kepplinger
2025-08-20 14:01 ` Laurent Pinchart
0 siblings, 1 reply; 5+ messages in thread
From: Martin Kepplinger @ 2025-02-06 8:49 UTC (permalink / raw)
To: laurent.pinchart, mchehab, shawnguo, s.hauer, kernel, festevam
Cc: linux-media, imx, linux-arm-kernel, linux-kernel
Am Mittwoch, dem 05.02.2025 um 17:29 +0000 schrieb Martin Kepplinger-
Novaković:
> media_pad_remote_pad_first() return NULL if "no enabled link has been
> found".
> Check for that.
>
> backstory
> =========
> While trying to get a (Y10 grey) sensor working on imx8mp (v6.12.12
> now and
> I know the hardware works on an ancient nxp-kernel),
> I tried to enable the sensor link, set formats and stream:
>
btw, that's roughly the
driver: https://github.com/VC-MIPI-modules/vc_mipi_nxp/tree/master/src
that might need additions to with recent mainline kernels. Will the
sensor be the reason for the link not being found here?
martin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first()
2025-02-06 8:49 ` Martin Kepplinger
@ 2025-08-20 14:01 ` Laurent Pinchart
2025-08-20 14:54 ` Martin Kepplinger-Novakovic
0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-20 14:01 UTC (permalink / raw)
To: Martin Kepplinger
Cc: mchehab, shawnguo, s.hauer, kernel, festevam, linux-media, imx,
linux-arm-kernel, linux-kernel
Hi Martin,
On Thu, Feb 06, 2025 at 08:49:37AM +0000, Martin Kepplinger wrote:
> Am Mittwoch, dem 05.02.2025 um 17:29 +0000 schrieb Martin Kepplinger-
> Novaković:
> > media_pad_remote_pad_first() return NULL if "no enabled link has been
> > found".
> > Check for that.
> >
> > backstory
> > =========
> > While trying to get a (Y10 grey) sensor working on imx8mp (v6.12.12
> > now and
> > I know the hardware works on an ancient nxp-kernel),
> > I tried to enable the sensor link, set formats and stream:
>
> btw, that's roughly the
> driver: https://github.com/VC-MIPI-modules/vc_mipi_nxp/tree/master/src
> that might need additions to with recent mainline kernels. Will the
> sensor be the reason for the link not being found here?
I've submitted
https://lore.kernel.org/linux-media/20250820140021.8026-1-laurent.pinchart@ideasonboard.com,
which should fix this issue in a more generic way.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first()
2025-08-20 14:01 ` Laurent Pinchart
@ 2025-08-20 14:54 ` Martin Kepplinger-Novakovic
2025-08-20 19:25 ` Laurent Pinchart
0 siblings, 1 reply; 5+ messages in thread
From: Martin Kepplinger-Novakovic @ 2025-08-20 14:54 UTC (permalink / raw)
To: Laurent Pinchart
Cc: mchehab, shawnguo, s.hauer, kernel, festevam, linux-media, imx,
linux-arm-kernel, linux-kernel
Am Mittwoch, dem 20.08.2025 um 17:01 +0300 schrieb Laurent Pinchart:
> Hi Martin,
>
> On Thu, Feb 06, 2025 at 08:49:37AM +0000, Martin Kepplinger wrote:
> > Am Mittwoch, dem 05.02.2025 um 17:29 +0000 schrieb Martin
> > Kepplinger-
> > Novaković:
> > > media_pad_remote_pad_first() return NULL if "no enabled link has
> > > been
> > > found".
> > > Check for that.
> > >
> > > backstory
> > > =========
> > > While trying to get a (Y10 grey) sensor working on imx8mp
> > > (v6.12.12
> > > now and
> > > I know the hardware works on an ancient nxp-kernel),
> > > I tried to enable the sensor link, set formats and stream:
> >
> > btw, that's roughly the
> > driver:
> > https://github.com/VC-MIPI-modules/vc_mipi_nxp/tree/master/src
> > that might need additions to with recent mainline kernels. Will the
> > sensor be the reason for the link not being found here?
>
> I've submitted
> https://lore.kernel.org/linux-media/20250820140021.8026-1-laurent.pinchart@ideasonboard.com
> ,
> which should fix this issue in a more generic way.
>
Hi, thank you. As posted over there, this indeed fixes the crash
itself.
P.S.:
Not that you should care :) But as for my specific "vision components"
sensor I want to use here, where this rpi-driver exists:
https://github.com/VC-MIPI-modules/vc_mipi_raspi/blob/main/src/vc_mipi_camera/vc_mipi_camera.c
a script like
media-ctl -d 1 --links "'vc_mipi_camera 3-001a':0->'csis-
32e50000.csi':0[1]"
# format settings for mipi rx and ISI
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"vc_mipi_camera 3-
001a":0[fmt:Y10_1X10/2592x1944 field:none]'
media-ctl -d "platform:32e00000.isi" --set-v4l2 '"csis-
32e50000.csi":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
media-ctl -d "platform:32e00000.isi" --set-v4l2
'"crossbar":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
media-ctl -d "platform:32e00000.isi" --set-v4l2
'"mxc_isi.0":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
v4l2-ctl -d /dev/video2 --set-fmt-
video=width=2592,height=1944,pixelformat='Y10 '
v4l2-ctl --verbose --device=/dev/video2 --stream-mmap --stream-count=10
still fails with
[ 34.642252] vc_mipi_camera 3-001a: vc_core_set_format(): Set format:
0x200a (Y10_1X10)
[ 34.650227] vc_mipi_camera 3-001a: vc_core_try_format(): Try format
0x200a (Y10_1X10, format: 0x2b)
[ 34.659284] vc_mipi_camera 3-001a: vc_core_try_format(): Checking
mode 0 (format: 0x2b)
[ 34.667295] vc_mipi_camera 3-001a: vc_core_calculate_max_exposure():
period_1H_ns: 7407, vmax.max: 1048575, vmax.min: 9
[ 34.678083] vc_mipi_camera 3-001a: vc_core_get_optimized_vmax():
vmax_def: 4500, v_factor: 0, height: 1944/1944
[ 34.688178] vc_mipi_camera 3-001a:
vc_core_calculate_max_frame_rate(): period_1H_ns: 7407, vmax:
4500/4500, max_frame_rate: 30002
[ 34.699833] vc_mipi_camera 3-001a: vc_core_update_controls():
num_lanes: 2, format 43, exposure.max: 7766728 us, framerate.max: 30002
mHz
[ 34.712184] vc_mipi_camera 3-001a: vc_core_set_frame(): Set frame
(left: 0, top: 0, width: 2592, height: 1944)
[ 34.722208] vc_mipi_camera 3-001a: vc_core_calculate_max_exposure():
period_1H_ns: 7407, vmax.max: 1048575, vmax.min: 9
[ 34.733000] vc_mipi_camera 3-001a: vc_core_get_optimized_vmax():
vmax_def: 4500, v_factor: 0, height: 1944/1944
[ 34.743112] vc_mipi_camera 3-001a:
vc_core_calculate_max_frame_rate(): period_1H_ns: 7407, vmax:
4500/4500, max_frame_rate: 30002
[ 34.754768] vc_mipi_camera 3-001a: vc_core_update_controls():
num_lanes: 2, format 43, exposure.max: 7766728 us, framerate.max: 30002
mHz
VIDIOC_QUERYCAP: ok
VIDIOC_REQBUFS returned 0 (Success)
VIDIOC_CREATE_BUFS returned 0 (Success)
VIDIOC_QUERYBUF returned 0 (Success)
VIDIOC_QUERYBUF returned 0 (Success)
VIDIOC_QUERYBUF returned 0 (Success)
VIDIOC_QUERYBUF returned 0 (Success)
VIDIOC_G_FMT returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_QBUF returned 0 (Success)
VIDIOC_STREAMON returned -1 (Broken pipe)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first()
2025-08-20 14:54 ` Martin Kepplinger-Novakovic
@ 2025-08-20 19:25 ` Laurent Pinchart
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2025-08-20 19:25 UTC (permalink / raw)
To: Martin Kepplinger-Novakovic
Cc: mchehab, shawnguo, s.hauer, kernel, festevam, linux-media, imx,
linux-arm-kernel, linux-kernel
On Wed, Aug 20, 2025 at 02:54:35PM +0000, Martin Kepplinger-Novakovic wrote:
> Am Mittwoch, dem 20.08.2025 um 17:01 +0300 schrieb Laurent Pinchart:
> > On Thu, Feb 06, 2025 at 08:49:37AM +0000, Martin Kepplinger wrote:
> > > Am Mittwoch, dem 05.02.2025 um 17:29 +0000 schrieb Martin Kepplinger-Novaković:
> > > > media_pad_remote_pad_first() return NULL if "no enabled link has been found".
> > > > Check for that.
> > > >
> > > > backstory
> > > > =========
> > > > While trying to get a (Y10 grey) sensor working on imx8mp (v6.12.12 now and
> > > > I know the hardware works on an ancient nxp-kernel),
> > > > I tried to enable the sensor link, set formats and stream:
> > >
> > > btw, that's roughly the
> > > driver:
> > > https://github.com/VC-MIPI-modules/vc_mipi_nxp/tree/master/src
> > > that might need additions to with recent mainline kernels. Will the
> > > sensor be the reason for the link not being found here?
> >
> > I've submitted
> > https://lore.kernel.org/linux-media/20250820140021.8026-1-laurent.pinchart@ideasonboard.com,
> > which should fix this issue in a more generic way.
>
> Hi, thank you. As posted over there, this indeed fixes the crash
> itself.
>
> P.S.:
> Not that you should care :) But as for my specific "vision components"
> sensor I want to use here, where this rpi-driver exists:
> https://github.com/VC-MIPI-modules/vc_mipi_raspi/blob/main/src/vc_mipi_camera/vc_mipi_camera.c
> a script like
>
> media-ctl -d 1 --links "'vc_mipi_camera 3-001a':0->'csis-
> 32e50000.csi':0[1]"
>
> # format settings for mipi rx and ISI
> media-ctl -d "platform:32e00000.isi" --set-v4l2 '"vc_mipi_camera 3-001a":0[fmt:Y10_1X10/2592x1944 field:none]'
> media-ctl -d "platform:32e00000.isi" --set-v4l2 '"csis-32e50000.csi":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
> media-ctl -d "platform:32e00000.isi" --set-v4l2 '"crossbar":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
> media-ctl -d "platform:32e00000.isi" --set-v4l2 '"mxc_isi.0":0[fmt:Y10_1X10/2592x1944 field:none colorspace:srgb]'
>
> v4l2-ctl -d /dev/video2 --set-fmt-video=width=2592,height=1944,pixelformat='Y10 '
> v4l2-ctl --verbose --device=/dev/video2 --stream-mmap --stream-count=10
>
>
> still fails with
>
>
> [ 34.642252] vc_mipi_camera 3-001a: vc_core_set_format(): Set format: 0x200a (Y10_1X10)
> [ 34.650227] vc_mipi_camera 3-001a: vc_core_try_format(): Try format 0x200a (Y10_1X10, format: 0x2b)
> [ 34.659284] vc_mipi_camera 3-001a: vc_core_try_format(): Checking mode 0 (format: 0x2b)
> [ 34.667295] vc_mipi_camera 3-001a: vc_core_calculate_max_exposure(): period_1H_ns: 7407, vmax.max: 1048575, vmax.min: 9
> [ 34.678083] vc_mipi_camera 3-001a: vc_core_get_optimized_vmax(): vmax_def: 4500, v_factor: 0, height: 1944/1944
> [ 34.688178] vc_mipi_camera 3-001a: vc_core_calculate_max_frame_rate(): period_1H_ns: 7407, vmax: 4500/4500, max_frame_rate: 30002
> [ 34.699833] vc_mipi_camera 3-001a: vc_core_update_controls(): num_lanes: 2, format 43, exposure.max: 7766728 us, framerate.max: 30002 mHz
> [ 34.712184] vc_mipi_camera 3-001a: vc_core_set_frame(): Set frame (left: 0, top: 0, width: 2592, height: 1944)
> [ 34.722208] vc_mipi_camera 3-001a: vc_core_calculate_max_exposure(): period_1H_ns: 7407, vmax.max: 1048575, vmax.min: 9
> [ 34.733000] vc_mipi_camera 3-001a: vc_core_get_optimized_vmax(): vmax_def: 4500, v_factor: 0, height: 1944/1944
> [ 34.743112] vc_mipi_camera 3-001a: vc_core_calculate_max_frame_rate(): period_1H_ns: 7407, vmax: 4500/4500, max_frame_rate: 30002
> [ 34.754768] vc_mipi_camera 3-001a: vc_core_update_controls(): num_lanes: 2, format 43, exposure.max: 7766728 us, framerate.max: 30002 mHz
> VIDIOC_QUERYCAP: ok
> VIDIOC_REQBUFS returned 0 (Success)
> VIDIOC_CREATE_BUFS returned 0 (Success)
> VIDIOC_QUERYBUF returned 0 (Success)
> VIDIOC_QUERYBUF returned 0 (Success)
> VIDIOC_QUERYBUF returned 0 (Success)
> VIDIOC_QUERYBUF returned 0 (Success)
> VIDIOC_G_FMT returned 0 (Success)
> VIDIOC_QBUF returned 0 (Success)
> VIDIOC_QBUF returned 0 (Success)
> VIDIOC_QBUF returned 0 (Success)
> VIDIOC_QBUF returned 0 (Success)
> VIDIOC_STREAMON returned -1 (Broken pipe)
The pipeline validation code at stream start time contains extensive
debugging messages, in particular in v4l2_subdev_link_validate_default()
and v4l2_subdev_link_validate_locked(). Enabling those should help you
figure out why your pipeline fails.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-20 19:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05 17:29 [PATCH] media: nxp: imx8-isi: check return value of media_pad_remote_pad_first() Martin Kepplinger-Novaković
2025-02-06 8:49 ` Martin Kepplinger
2025-08-20 14:01 ` Laurent Pinchart
2025-08-20 14:54 ` Martin Kepplinger-Novakovic
2025-08-20 19:25 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox