All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@oss.qualcomm.com>
Cc: vkoul@kernel.org, olteanv@gmail.com, media-ci@linuxtv.org,
	linux-phy@lists.infradead.org, conor+dt@kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH v21 09/14] media: qcom: camss: vfe: Add support for VFE 1080
Date: Mon, 12 Oct 2026 07:00:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-167764@kernel.org> (raw)
In-Reply-To: <20261011-kaanapali-camss-v21-9-04fd28d815c6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: camss: hardcoded AUP_UPDATE count violates hardware constraint
- [High] media: camss: data race on csid->aup_update and rup_update
--

commit bab5581422e8c33728a37abe32648420503fc60c
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: vfe: Add support for VFE 1080

Add support for the VFE (Video Front End) 1080 found on Kaanapali SoC.

> Kaanapali requires REG_UPDATE and AUP_UPDATE to be issued only after all
> CSID configuration has completed. In addition, the number of AUP_UPDATE
> requests must match the number of buffers queued to the write master
> while it is being enabled.

[Severity: High]
Does the current implementation actually enforce this requirement?

If userspace queues 1 buffer via V4L2 and calls STREAMON, the vb2_queue
lacks a min_queued_buffers limit in msm_video_register(). Consequently,
vfe_enable_output_v2() dynamically queues only 1 buffer to the hardware,
but csid_configure_stream() in camss-csid-1080.c unconditionally issues
CAMSS_INIT_BUF_COUNT (2) AUP_UPDATE commands.

Can this mismatch lead to write master state corruption or IOMMU faults
due to hardware desynchronization?

> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-1080.c b/drivers/media/platform/qcom/camss/camss-vfe-1080.c
> new file mode 100644
> index 0000000000000..016857cd10251
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-1080.c
[ ... ]
> +static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_reg_update(vfe->camss, vfe->id, port_id, false);
> +}

[Severity: High]
Does this introduce a data race on csid->aup_update and rup_update?

This call reaches __csid_aup_update() in process context. While local
interrupts are disabled via vfe->output_lock, there is no cross-CPU
synchronization.

Concurrently, csid_isr() fires in hardirq context (potentially on another CPU)
and calls __csid_aup_rup_clear(), which performs a bitwise clear on the same
state variables without holding a shared lock:

    csid->aup_update &= ~CSID_RUP_AUP_RDI(port_id);
    csid->rup_update &= ~CSID_RUP_AUP_RDI(port_id);

Can these concurrent non-atomic bitwise operations cause lost updates
and corrupt the CSID_AUP_CMD and CSID_RUP_CMD register states, leading
to stream stalls or hardware misconfiguration?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-kaanapali-camss-v21-0-04fd28d815c6@oss.qualcomm.com?part=9

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@oss.qualcomm.com>
Cc: vkoul@kernel.org, olteanv@gmail.com, media-ci@linuxtv.org,
	linux-phy@lists.infradead.org, conor+dt@kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org,
	neil.armstrong@linaro.org
Subject: Re: [PATCH v21 09/14] media: qcom: camss: vfe: Add support for VFE 1080
Date: Mon, 12 Oct 2026 07:00:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-167764@kernel.org> (raw)
In-Reply-To: <20261011-kaanapali-camss-v21-9-04fd28d815c6@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: camss: hardcoded AUP_UPDATE count violates hardware constraint
- [High] media: camss: data race on csid->aup_update and rup_update
--

commit bab5581422e8c33728a37abe32648420503fc60c
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>

media: qcom: camss: vfe: Add support for VFE 1080

Add support for the VFE (Video Front End) 1080 found on Kaanapali SoC.

> Kaanapali requires REG_UPDATE and AUP_UPDATE to be issued only after all
> CSID configuration has completed. In addition, the number of AUP_UPDATE
> requests must match the number of buffers queued to the write master
> while it is being enabled.

[Severity: High]
Does the current implementation actually enforce this requirement?

If userspace queues 1 buffer via V4L2 and calls STREAMON, the vb2_queue
lacks a min_queued_buffers limit in msm_video_register(). Consequently,
vfe_enable_output_v2() dynamically queues only 1 buffer to the hardware,
but csid_configure_stream() in camss-csid-1080.c unconditionally issues
CAMSS_INIT_BUF_COUNT (2) AUP_UPDATE commands.

Can this mismatch lead to write master state corruption or IOMMU faults
due to hardware desynchronization?

> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-1080.c b/drivers/media/platform/qcom/camss/camss-vfe-1080.c
> new file mode 100644
> index 0000000000000..016857cd10251
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-1080.c
[ ... ]
> +static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_reg_update(vfe->camss, vfe->id, port_id, false);
> +}

[Severity: High]
Does this introduce a data race on csid->aup_update and rup_update?

This call reaches __csid_aup_update() in process context. While local
interrupts are disabled via vfe->output_lock, there is no cross-CPU
synchronization.

Concurrently, csid_isr() fires in hardirq context (potentially on another CPU)
and calls __csid_aup_rup_clear(), which performs a bitwise clear on the same
state variables without holding a shared lock:

    csid->aup_update &= ~CSID_RUP_AUP_RDI(port_id);
    csid->rup_update &= ~CSID_RUP_AUP_RDI(port_id);

Can these concurrent non-atomic bitwise operations cause lost updates
and corrupt the CSID_AUP_CMD and CSID_RUP_CMD register states, leading
to stream stalls or hardware misconfiguration?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261011-kaanapali-camss-v21-0-04fd28d815c6@oss.qualcomm.com?part=9

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-10-12  7:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  6:45 [PATCH v21 00/14] media: qcom: camss: Add Kaanapali support Hangxiang Ma
2026-10-12  6:45 ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 01/14] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Kaanapali CSI2 PHY Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 02/14] phy: qcom-mipi-csi2: Parametrise the common status register offset Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 03/14] phy: qcom-mipi-csi2: Add Kaanapali support Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 04/14] media: qcom: camss: Issue stream-on REG_UPDATE from CSID Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:01   ` sashiko-bot
2026-10-12  7:01     ` sashiko-bot
2026-10-12  7:20     ` Hangxiang Ma
2026-10-12  7:20       ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 05/14] media: dt-bindings: Add CAMSS device for Kaanapali Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 06/14] media: qcom: camss: Add Kaanapali compatible Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:00   ` sashiko-bot
2026-10-12  7:00     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 07/14] media: qcom: camss: csiphy: Add support for v2.4.0 two-phase CSIPHY Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:07   ` sashiko-bot
2026-10-12  7:07     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 08/14] media: qcom: camss: csid: Add support for CSID 1080 Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:59   ` sashiko-bot
2026-10-12  6:59     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 09/14] media: qcom: camss: vfe: Add support for VFE 1080 Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:00   ` sashiko-bot [this message]
2026-10-12  7:00     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 10/14] media: qcom: camss: tpg: Add support for v2.4.0 TPG Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  7:01   ` sashiko-bot
2026-10-12  7:01     ` sashiko-bot
2026-10-12  6:45 ` [PATCH v21 11/14] arm64: dts: qcom: kaanapali: Add CAMSS and CSIPHY block definitions Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 12/14] arm64: dts: qcom: kaanapali: Add CCI controller nodes Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 13/14] arm64: dts: qcom: kaanapali: Add camera MCLK pinctrl Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:45 ` [PATCH v21 14/14] arm64: dts: qcom: kaanapali-mtp-camera-s5kjn5: Add DT overlay Hangxiang Ma
2026-10-12  6:45   ` Hangxiang Ma
2026-10-12  6:57   ` sashiko-bot
2026-10-12  6:57     ` sashiko-bot
2026-10-12  6:59     ` Hangxiang Ma
2026-10-12  6:59       ` Hangxiang Ma

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-167764@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hangxiang.ma@oss.qualcomm.com \
    --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 \
    /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.