From: sashiko-bot@kernel.org
To: "Michael Riesch via B4 Relay"
<devnull+michael.riesch.collabora.com@kernel.org>
Cc: krzk+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v4 3/8] media: rockchip: rkcif: add support for rk3588 vicap mipi capture
Date: Fri, 08 May 2026 23:24:45 +0000 [thread overview]
Message-ID: <20260508232446.F3C46C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260508-rk3588-vicap-v4-3-6a6cd6f7c90b@collabora.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Unconditional overwrite of shared RKCIF_MIPI_CTRL register clears other bits and risks RK3568 regression.
- [High] Sleeping in atomic context due to mutex acquisition in the hardirq handler.
- [High] Incorrect read-modify-write on a Write-1-to-Clear (W1C) interrupt status register leads to lost interrupts.
- [High] Unhandled hardware power state causes an asynchronous external abort (SError) in the shared IRQ handler.
--
commit 8bafc9e50c3973309c417c259fe6059984848b43
Author: Michael Riesch <michael.riesch@collabora.com>
media: rockchip: rkcif: add support for rk3588 vicap mipi capture
The RK3588 Video Capture (VICAP) unit features a Digital Video Port (DVP)
and six MIPI CSI-2 capture interfaces. Add initial support for this variant
to the rkcif driver and enable the MIPI CSI-2 capture interfaces.
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
> index 9e67160a16e46..ad083dc9f5add 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-capture-mipi.c
[ ... ]
> @@ -481,6 +489,132 @@ const struct rkcif_mipi_match_data rkcif_rk3568_vicap_mipi_match_data = {
> },
> };
>
[ ... ]
> +const struct rkcif_mipi_match_data rkcif_rk3588_vicap_mipi_match_data = {
> + .mipi_num = 6,
This patch activates the MIPI capture code path for 6 new RK3588 interfaces,
but does this expose an existing locking issue in the interrupt handler?
The interrupt handler rkcif_mipi_isr() runs in hardirq context and iterates
over active streams. If stream->stopping is true, it calls
rkcif_mipi_stop_streaming().
Inside that function, it calls v4l2_subdev_lock_and_get_active_state(),
which internally acquires a mutex.
Will acquiring a mutex within a hardirq context cause a sleeping in atomic
context panic when stopping a stream?
> + .mipi_ctrl0 = rkcif_rk3588_mipi_ctrl0,
> + .regs = {
> + [RKCIF_MIPI_CTRL] = 0x20,
> + [RKCIF_MIPI_INTEN] = 0x74,
> + [RKCIF_MIPI_INTSTAT] = 0x78,
Since this patch adds support for the RK3588 MIPI INTSTAT registers, is it
safe to read them from the shared interrupt handler if the device is
suspended?
The driver requests its main interrupt line using IRQF_SHARED. If a shared
interrupt fires while the RKCIF device is runtime-suspended and its power
domains are disabled, the kernel will still invoke rkcif_mipi_isr().
The ISR then loops and reads the RKCIF_MIPI_INTSTAT registers across all
MIPI blocks.
Could reading from a power-gated or unclocked hardware block cause an
asynchronous external abort (SError) and a kernel panic? Should the ISR
verify the device's power state before accessing hardware registers?
Also related to these INTSTAT registers, does the current code handle
Write-1-to-Clear (W1C) bits correctly?
In rkcif_mipi_start_streaming(), the code attempts to clear stream-specific
interrupts using a read-modify-write sequence:
int_temp = rkcif_mipi_read(..., RKCIF_MIPI_INTSTAT);
int_temp &= ~int_mask;
rkcif_mipi_write(..., RKCIF_MIPI_INTSTAT, int_temp);
By reading the register, clearing its own mask, and writing back the
remaining 1s, does this inadvertently write 1s to the pending interrupt bits
of other active streams?
Could this clear other streams' pending interrupts before the ISR can handle
them, while simultaneously failing to clear its own interrupt bits since it
writes 0 to them?
[ ... ]
> @@ -631,6 +765,13 @@ static int rkcif_mipi_start_streaming(struct rkcif_stream *stream)
> rkcif_mipi_stream_write(stream, RKCIF_MIPI_CTRL1, ctrl1);
> rkcif_mipi_stream_write(stream, RKCIF_MIPI_CTRL0, ctrl0);
>
> + /*
> + * TODO: This bit has a different meaning on the RK3568, but it is
> + * set there by default anyway. While correct, this is not exactly
> + * nice and shall be reworked during the next refactoring.
> + */
> + rkcif_mipi_write(interface, RKCIF_MIPI_CTRL, RK3588_MIPI_CTRL_CAP_EN);
Could this unconditional write clear other configuration bits and cause a
regression on the RK3568?
Because rkcif_mipi_write() translates directly to writel(), this operation
blindly overwrites the entire 32-bit register with BIT(0). Since this code
path is shared with the RK3568 variant, does this destroy any default,
bootloader-initialized, or PHY-related configuration bits?
Additionally, RKCIF_MIPI_CTRL is an interface-level register shared across
up to 4 concurrent streams.
Would updating a single bit require a read-modify-write pattern to preserve
existing configurations from concurrently running streams?
Is this interface-level capture enable bit ever cleared in
rkcif_mipi_stop_streaming(), or does it leave the hardware perpetually
enabled?
> +
> ret = 0;
>
> out:
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260508-rk3588-vicap-v4-0-6a6cd6f7c90b@collabora.com?part=3
next prev parent reply other threads:[~2026-05-08 23:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 19:31 [PATCH v4 0/8] media: rockchip: rkcif: add support for rk3588 vicap Michael Riesch via B4 Relay
2026-05-08 19:31 ` [PATCH v4 1/8] Documentation: admin-guide: media: add " Michael Riesch via B4 Relay
2026-05-08 19:31 ` [PATCH v4 2/8] media: dt-bindings: add rockchip " Michael Riesch via B4 Relay
2026-05-08 22:58 ` sashiko-bot
2026-05-08 19:31 ` [PATCH v4 3/8] media: rockchip: rkcif: add support for rk3588 vicap mipi capture Michael Riesch via B4 Relay
2026-05-08 23:24 ` sashiko-bot [this message]
2026-05-08 19:31 ` [PATCH DONOTMERGE v4 4/8] arm64: dts: rockchip: add mipi csi-2 receiver nodes to rk3588 Michael Riesch via B4 Relay
2026-05-08 19:31 ` [PATCH v4 5/8] arm64: dts: rockchip: add vicap node " Michael Riesch via B4 Relay
2026-05-08 19:31 ` [PATCH v4 6/8] arm64: dts: rockchip: add radxa camera 4k on rock 5b+ cam0 Michael Riesch via B4 Relay
2026-05-09 0:01 ` sashiko-bot
2026-05-08 19:31 ` [PATCH v4 7/8] arm64: dts: rockchip: add radxa camera 4k on rock 5b+ cam1 Michael Riesch via B4 Relay
2026-05-09 0:09 ` sashiko-bot
2026-05-08 19:31 ` [PATCH v4 8/8] arm64: defconfig: enable designware mipi csi-2 receiver Michael Riesch via B4 Relay
2026-05-09 0:26 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260508232446.F3C46C2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+michael.riesch.collabora.com@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox