From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org,
vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v8 09/23] media: qcom: camss: csid: Add support for CSID 980
Date: Wed, 02 Dec 2026 10:22:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-245440@kernel.org> (raw)
In-Reply-To: <20261202-add-support-for-camss-on-sm8750-v8-9-a07210023c55@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: qcom: camss: wrong dt_id calculation in
__csid_configure_rdi_stream()
- [Medium] media: qcom: camss: race on reg_update and addr_update in
csid_isr()
--
commit d1226f7193af8f57eddb4c47ad863bf85fd1129c
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>
media: qcom: camss: csid: Add support for CSID 980
This commit adds the CSID 980 hardware operations driver and SM8750 CSID
resource definitions for stream configuration, reset, and BUF_DONE IRQ
handling.
> diff --git a/drivers/media/platform/qcom/camss/camss-csid-980.c b/drivers/media/platform/qcom/camss/camss-csid-980.c
> new file mode 100644
> index 0000000000000..d7e1c72ff41ca
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-csid-980.c
[ ... ]
> +static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8 port, u8 vc)
> +{
> + u32 val;
> +
> + /* Source pads matching RDI channels on hardware.
> + * E.g. Pad 1 -> RDI0, Pad 2 -> RDI1, etc.
> + */
> + struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + port];
> + const struct csid_format_info *format = csid_get_fmt_entry(csid->res->formats->formats,
> + csid->res->formats->nformats,
> + input_format->code);
> +
> + /*
> + * DT_ID is a two bit bitfield that is concatenated with
> + * the four least significant bits of the five bit VC
> + * bitfield to generate an internal CID value.
> + *
> + * CSID_RDI_CFG0(vc)
> + * DT_ID : 28:27
> + * VC : 26:22
> + * DT : 21:16
> + *
> + * CID : VC 3:0 << 2 | DT_ID 1:0
> + */
> + u8 dt_id = vc & 0x03;
> + u32 rdi_cfg0_offset = CSID_RDI_CFG0(port);
> + u32 rdi_cfg1_offset = CSID_RDI_CFG1(port);
> + u32 rdi_ctrl_offset = CSID_RDI_CTRL(port);
> +
> + val = RDI_CFG0_TIMESTAMP_EN;
> + val |= RDI_CFG0_TIMESTAMP_STB_SEL;
> + val |= RDI_CFG0_RETIME_BS;
> +
> + /* note: for non-RDI path, this should be format->decode_format */
> + val |= DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT;
> + val |= vc << RDI_CFG0_VC;
> + val |= format->data_type << RDI_CFG0_DT;
> + val |= dt_id << RDI_CFG0_DT_ID;
> + writel(val, csid->base + rdi_cfg0_offset);
[Severity: High]
Should dt_id be computed from port & 0x03 instead of vc & 0x03?
csid_configure_stream() always passes vc = 0 to
__csid_configure_rdi_stream(), so every RDI port gets dt_id = 0 and the
same internal CID value, breaking capture on RDI1, RDI2, and RDI3 (as
fixed in sibling CSID drivers, e.g. 93ea81d16570 ("media: qcom: camss: Fix
RDI streaming for CSID 680")).
[ ... ]
> +static irqreturn_t csid_isr(int irq, void *dev)
> +{
> + struct csid_device *csid = dev;
> + u32 val, buf_done_val;
> + u8 reset_done;
> + int i;
> +
> + val = readl(csid->base + CSID_TOP_IRQ_STATUS);
> + writel(val, csid->base + CSID_TOP_IRQ_CLEAR);
> +
> + reset_done = val & INFO_RST_DONE;
> +
> + buf_done_val = readl(csid->base + CSID_BUF_DONE_IRQ_STATUS);
> + writel(buf_done_val, csid->base + CSID_BUF_DONE_IRQ_CLEAR);
> +
> + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS_980; i++) {
> + if (csid->phy.en_vc & BIT(i)) {
> + val = readl(csid->base + CSID_CSI2_RDIN_IRQ_STATUS(i));
> + writel(val, csid->base + CSID_CSI2_RDIN_IRQ_CLEAR(i));
> +
> + if (val & INFO_RUP_DONE) {
> + __csid_addr_update_clear(csid, i);
> + __csid_reg_update_clear(csid, i);
> + }
> +
> + if (buf_done_val & BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i))
> + camss_buf_done(csid->camss, csid_index(csid), i);
> + }
> + }
[Severity: Medium]
Can __csid_addr_update_clear() and __csid_reg_update_clear() in csid_isr()
race with concurrent updates to csid->reg_update and csid->addr_update?
The VFE callbacks (such as vfe_queue_buffer_v2() when active_num < 2) hold
vfe->output_lock while calling into __csid_addr_update() and
__csid_reg_update(), whereas csid_isr() clears the bits in
csid->addr_update and csid->reg_update without any lock before
camss_buf_done() acquires vfe->output_lock:
CPU0 CPU1 (<hardirq>)
vfe_queue_buffer_v2()
spin_lock_irqsave(&vfe->output_lock)
...
__csid_addr_update(csid, i)
csid->reg_update |= CSID_LITE_AUP_RDI(i)
writel(csid->reg_update,
... + CSID_LITE_RUP_AUP_CMD)
csid_isr()
__csid_addr_update_clear(csid, i)
csid->reg_update &=
~CSID_LITE_AUP_RDI(i)
__csid_reg_update(csid, i)
csid->reg_update |= CSID_LITE_RUP_RDI(i)
writel(csid->reg_update,
... + CSID_LITE_RUP_AUP_CMD) <-- overwrites AUP bit as 0
Because the read-modify-write operations on csid->reg_update and
csid->addr_update are not serialized, RUP/AUP bits across RDI ports can be
lost or retained, and on CSID Lite __csid_reg_update() can overwrite
CSID_LITE_RUP_AUP_CMD with CSID_LITE_AUP_RDI cleared before hardware
consumes the newly queued buffer address.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-add-support-for-camss-on-sm8750-v8-0-a07210023c55@oss.qualcomm.com?part=9
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Wenmeng Liu" <wenmeng.liu@oss.qualcomm.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org,
vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com
Subject: Re: [PATCH v8 09/23] media: qcom: camss: csid: Add support for CSID 980
Date: Wed, 02 Dec 2026 10:22:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-245440@kernel.org> (raw)
In-Reply-To: <20261202-add-support-for-camss-on-sm8750-v8-9-a07210023c55@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: qcom: camss: wrong dt_id calculation in
__csid_configure_rdi_stream()
- [Medium] media: qcom: camss: race on reg_update and addr_update in
csid_isr()
--
commit d1226f7193af8f57eddb4c47ad863bf85fd1129c
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>
media: qcom: camss: csid: Add support for CSID 980
This commit adds the CSID 980 hardware operations driver and SM8750 CSID
resource definitions for stream configuration, reset, and BUF_DONE IRQ
handling.
> diff --git a/drivers/media/platform/qcom/camss/camss-csid-980.c b/drivers/media/platform/qcom/camss/camss-csid-980.c
> new file mode 100644
> index 0000000000000..d7e1c72ff41ca
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-csid-980.c
[ ... ]
> +static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8 port, u8 vc)
> +{
> + u32 val;
> +
> + /* Source pads matching RDI channels on hardware.
> + * E.g. Pad 1 -> RDI0, Pad 2 -> RDI1, etc.
> + */
> + struct v4l2_mbus_framefmt *input_format = &csid->fmt[MSM_CSID_PAD_FIRST_SRC + port];
> + const struct csid_format_info *format = csid_get_fmt_entry(csid->res->formats->formats,
> + csid->res->formats->nformats,
> + input_format->code);
> +
> + /*
> + * DT_ID is a two bit bitfield that is concatenated with
> + * the four least significant bits of the five bit VC
> + * bitfield to generate an internal CID value.
> + *
> + * CSID_RDI_CFG0(vc)
> + * DT_ID : 28:27
> + * VC : 26:22
> + * DT : 21:16
> + *
> + * CID : VC 3:0 << 2 | DT_ID 1:0
> + */
> + u8 dt_id = vc & 0x03;
> + u32 rdi_cfg0_offset = CSID_RDI_CFG0(port);
> + u32 rdi_cfg1_offset = CSID_RDI_CFG1(port);
> + u32 rdi_ctrl_offset = CSID_RDI_CTRL(port);
> +
> + val = RDI_CFG0_TIMESTAMP_EN;
> + val |= RDI_CFG0_TIMESTAMP_STB_SEL;
> + val |= RDI_CFG0_RETIME_BS;
> +
> + /* note: for non-RDI path, this should be format->decode_format */
> + val |= DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT;
> + val |= vc << RDI_CFG0_VC;
> + val |= format->data_type << RDI_CFG0_DT;
> + val |= dt_id << RDI_CFG0_DT_ID;
> + writel(val, csid->base + rdi_cfg0_offset);
[Severity: High]
Should dt_id be computed from port & 0x03 instead of vc & 0x03?
csid_configure_stream() always passes vc = 0 to
__csid_configure_rdi_stream(), so every RDI port gets dt_id = 0 and the
same internal CID value, breaking capture on RDI1, RDI2, and RDI3 (as
fixed in sibling CSID drivers, e.g. 93ea81d16570 ("media: qcom: camss: Fix
RDI streaming for CSID 680")).
[ ... ]
> +static irqreturn_t csid_isr(int irq, void *dev)
> +{
> + struct csid_device *csid = dev;
> + u32 val, buf_done_val;
> + u8 reset_done;
> + int i;
> +
> + val = readl(csid->base + CSID_TOP_IRQ_STATUS);
> + writel(val, csid->base + CSID_TOP_IRQ_CLEAR);
> +
> + reset_done = val & INFO_RST_DONE;
> +
> + buf_done_val = readl(csid->base + CSID_BUF_DONE_IRQ_STATUS);
> + writel(buf_done_val, csid->base + CSID_BUF_DONE_IRQ_CLEAR);
> +
> + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS_980; i++) {
> + if (csid->phy.en_vc & BIT(i)) {
> + val = readl(csid->base + CSID_CSI2_RDIN_IRQ_STATUS(i));
> + writel(val, csid->base + CSID_CSI2_RDIN_IRQ_CLEAR(i));
> +
> + if (val & INFO_RUP_DONE) {
> + __csid_addr_update_clear(csid, i);
> + __csid_reg_update_clear(csid, i);
> + }
> +
> + if (buf_done_val & BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i))
> + camss_buf_done(csid->camss, csid_index(csid), i);
> + }
> + }
[Severity: Medium]
Can __csid_addr_update_clear() and __csid_reg_update_clear() in csid_isr()
race with concurrent updates to csid->reg_update and csid->addr_update?
The VFE callbacks (such as vfe_queue_buffer_v2() when active_num < 2) hold
vfe->output_lock while calling into __csid_addr_update() and
__csid_reg_update(), whereas csid_isr() clears the bits in
csid->addr_update and csid->reg_update without any lock before
camss_buf_done() acquires vfe->output_lock:
CPU0 CPU1 (<hardirq>)
vfe_queue_buffer_v2()
spin_lock_irqsave(&vfe->output_lock)
...
__csid_addr_update(csid, i)
csid->reg_update |= CSID_LITE_AUP_RDI(i)
writel(csid->reg_update,
... + CSID_LITE_RUP_AUP_CMD)
csid_isr()
__csid_addr_update_clear(csid, i)
csid->reg_update &=
~CSID_LITE_AUP_RDI(i)
__csid_reg_update(csid, i)
csid->reg_update |= CSID_LITE_RUP_RDI(i)
writel(csid->reg_update,
... + CSID_LITE_RUP_AUP_CMD) <-- overwrites AUP bit as 0
Because the read-modify-write operations on csid->reg_update and
csid->addr_update are not serialized, RUP/AUP bits across RDI ports can be
lost or retained, and on CSID Lite __csid_reg_update() can overwrite
CSID_LITE_RUP_AUP_CMD with CSID_LITE_AUP_RDI cleared before hardware
consumes the newly queued buffer address.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-add-support-for-camss-on-sm8750-v8-0-a07210023c55@oss.qualcomm.com?part=9
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-12-02 10:22 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:59 [PATCH v8 00/23] Add CAMSS support for SM8750 and Eliza Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 01/23] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add SM8750 CSI2 PHY Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 02/23] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Eliza " Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 03/23] dt-bindings: media: qcom,sm8750-camss: Add SM8750 CAMSS Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 04/23] dt-bindings: media: qcom,eliza-camss: Add Eliza CAMSS Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 05/23] dt-bindings: i2c: qcom-cci: Document Eliza compatible Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 06/23] media: qcom: camss: Add SM8750 compatible Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 10:46 ` Loic Poulain
2026-12-02 10:46 ` Loic Poulain
2026-12-02 9:59 ` [PATCH v8 07/23] media: qcom: camss: Add PM clock definitions for SM8750 Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 08/23] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 10:29 ` sashiko-bot
2026-12-02 10:29 ` sashiko-bot
2026-12-02 9:59 ` [PATCH v8 09/23] media: qcom: camss: csid: Add support for CSID 980 Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 10:22 ` sashiko-bot [this message]
2026-12-02 10:22 ` sashiko-bot
2026-12-02 9:59 ` [PATCH v8 10/23] media: qcom: camss: vfe: Add support for VFE 980 Wenmeng Liu
2026-12-02 10:14 ` sashiko-bot
2026-12-02 10:14 ` sashiko-bot
2026-12-02 9:59 ` [PATCH v8 11/23] media: qcom: camss: Add TPG support for SM8750 Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 12/23] media: qcom: camss: Add Eliza compatible Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 13/23] arm64: dts: qcom: sm8750: Add CAMSS and CSIPHY block definitions Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 14/23] arm64: dts: qcom: sm8750: Add CCI definitions Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 15/23] arm64: dts: qcom: sm8750: Add camera MCLK pinctrl Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 16/23] arm64: dts: qcom: sm8750-qrd: Enable S5KJN1 camera sensor Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 17/23] arm64: dts: qcom: sm8750-mtp: " Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 18/23] arm64: dts: qcom: eliza: Add CAMSS and CSIPHY block definitions Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 19/23] arm64: dts: qcom: eliza: Add CCI definitions Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 20/23] arm64: dts: qcom: eliza: Add camera MCLK pinctrl Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 21/23] arm64: dts: qcom: eliza-mtp: Add PM8010 PMICs Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 22/23] arm64: dts: qcom: eliza-mtp: Enable rear camera Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
2026-12-02 9:59 ` [PATCH v8 23/23] arm64: dts: qcom: eliza-evk-imx577-camera: Add DT overlay Wenmeng Liu
2026-12-02 9:59 ` Wenmeng Liu
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=sashiko-outbox-245440@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=media-ci@linuxtv.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=wenmeng.liu@oss.qualcomm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.