All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@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 v25 10/15] media: qcom: camss: vfe: Add support for VFE 1080
Date: Fri, 13 Nov 2026 05:52:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-212259@kernel.org> (raw)
In-Reply-To: <20261112-kaanapali-camss-v25-10-1d709f57f370@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: qcom: camss: unsynchronized CSID RUP/AUP updates in
  vfe_ops_1080
- [Medium] media: qcom: camss: AUP_UPDATE count mismatch in
  vfe_enable_output_v2()
--

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

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

This commit adds hardware ops and resource definitions to support VFE
(TFE) 1080 on the Qualcomm Kaanapali SoC.

> 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..68798f13fbea8
> --- /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);
> +}
> +
> +static void vfe_reg_update_clear(struct vfe_device *vfe,
> +				 enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_reg_update(vfe->camss, vfe->id, port_id, true);
> +}
> +
> +static void vfe_addr_update(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_addr_update(vfe->camss, vfe->id, port_id, false);
> +}
> +
> +static void vfe_addr_update_clear(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_addr_update(vfe->camss, vfe->id, port_id, true);
> +}

[Severity: High]
Can vfe_addr_update() and vfe_reg_update() race with csid_isr() on
csid->addr_update and csid->reg_update?

vfe_queue_buffer_v2() calls ops->addr_update() and ops->reg_update() under
vfe->output_lock, which forward to __csid_addr_update() and
__csid_reg_update().  Meanwhile, in camss-csid-1080.c, csid_isr() clears
bits in csid->addr_update and csid->reg_update before calling
camss_buf_done() (where vfe->output_lock is acquired):

CPU0                                  CPU1 (<hardirq>)
vfe_queue_buffer_v2()                 csid_isr()
  spin_lock_irqsave(&vfe->output_lock)
  vfe_addr_update()
    ...
      csid->addr_update |= BIT(...)
                                        if (val & INFO_RUP_DONE)
                                          __csid_addr_update_clear()
                                            csid->addr_update &= ~BIT(...)
      writel(csid->addr_update,
             csid->base + CSID_AUP_CMD)  <-- writes 0, losing update
      __csid_aup_rup_trigger(csid)

Because csid_reset() only unmasks INFO_RST_DONE | BUF_DONE_IRQ_STATUS in
CSID_TOP_IRQ_MASK, INFO_RUP_DONE stays latched until csid_isr() runs on
BUF_DONE_IRQ_STATUS at the end of the frame.  If userspace queues a buffer
when output->gen2.active_num == 1, the lost CSID_AUP_CMD or CSID_RUP_CMD
write leaves the hardware without the queued buffer address and stalls
capture.  Multiple active RDI lines on the same CSID can also clobber each
other's csid->addr_update and csid->reg_update bits.

[ ... ]

> +const struct vfe_hw_ops vfe_ops_1080 = {
> +	.addr_update = vfe_addr_update,
> +	.addr_update_clear = vfe_addr_update_clear,

[Severity: Medium]
Can starting a stream with fewer than two queued buffers mismatch the
number of AUP_UPDATE requests against the buffers written to the write
master?

In camss-video.c, msm_video_register() leaves q->min_queued_buffers at 0,
so VIDIOC_STREAMON can run vfe_enable_output_v2() with 0 or 1 buffer
pending:

drivers/media/platform/qcom/camss/camss-vfe.c:vfe_enable_output_v2() {
    ...
	for (i = 0; i < CAMSS_INIT_BUF_COUNT; i++) {
		output->buf[i] = vfe_buf_get_pending(output);
		if (!output->buf[i])
			break;
		output->gen2.active_num++;
		ops->vfe_wm_update(vfe, output->wm_idx[0],
				   output->buf[i]->addr[0], line);
		if (!ops->addr_update)
			ops->reg_update(vfe, line->id);
	}
    ...
}

csid_configure_stream() in camss-csid-1080.c then unconditionally issues
CAMSS_INIT_BUF_COUNT (2) __csid_addr_update() calls even if 0 or 1 buffer
address was programmed into VFE_BUS_WM_IMAGE_ADDR.  When userspace later
queues buffers while output->gen2.active_num < 2, vfe_queue_buffer_v2()
calls ops->addr_update() again for each buffer, issuing 3 or 4 AUP_UPDATE
requests for the first two buffers and violating the requirement that
AUP_UPDATE requests match the number of buffers queued to the write
master.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-kaanapali-camss-v25-0-1d709f57f370@oss.qualcomm.com?part=10

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Hangxiang Ma" <hangxiang.ma@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 v25 10/15] media: qcom: camss: vfe: Add support for VFE 1080
Date: Fri, 13 Nov 2026 05:52:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-212259@kernel.org> (raw)
In-Reply-To: <20261112-kaanapali-camss-v25-10-1d709f57f370@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] media: qcom: camss: unsynchronized CSID RUP/AUP updates in
  vfe_ops_1080
- [Medium] media: qcom: camss: AUP_UPDATE count mismatch in
  vfe_enable_output_v2()
--

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

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

This commit adds hardware ops and resource definitions to support VFE
(TFE) 1080 on the Qualcomm Kaanapali SoC.

> 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..68798f13fbea8
> --- /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);
> +}
> +
> +static void vfe_reg_update_clear(struct vfe_device *vfe,
> +				 enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_reg_update(vfe->camss, vfe->id, port_id, true);
> +}
> +
> +static void vfe_addr_update(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_addr_update(vfe->camss, vfe->id, port_id, false);
> +}
> +
> +static void vfe_addr_update_clear(struct vfe_device *vfe, enum vfe_line_id line_id)
> +{
> +	int port_id = line_id;
> +
> +	camss_addr_update(vfe->camss, vfe->id, port_id, true);
> +}

[Severity: High]
Can vfe_addr_update() and vfe_reg_update() race with csid_isr() on
csid->addr_update and csid->reg_update?

vfe_queue_buffer_v2() calls ops->addr_update() and ops->reg_update() under
vfe->output_lock, which forward to __csid_addr_update() and
__csid_reg_update().  Meanwhile, in camss-csid-1080.c, csid_isr() clears
bits in csid->addr_update and csid->reg_update before calling
camss_buf_done() (where vfe->output_lock is acquired):

CPU0                                  CPU1 (<hardirq>)
vfe_queue_buffer_v2()                 csid_isr()
  spin_lock_irqsave(&vfe->output_lock)
  vfe_addr_update()
    ...
      csid->addr_update |= BIT(...)
                                        if (val & INFO_RUP_DONE)
                                          __csid_addr_update_clear()
                                            csid->addr_update &= ~BIT(...)
      writel(csid->addr_update,
             csid->base + CSID_AUP_CMD)  <-- writes 0, losing update
      __csid_aup_rup_trigger(csid)

Because csid_reset() only unmasks INFO_RST_DONE | BUF_DONE_IRQ_STATUS in
CSID_TOP_IRQ_MASK, INFO_RUP_DONE stays latched until csid_isr() runs on
BUF_DONE_IRQ_STATUS at the end of the frame.  If userspace queues a buffer
when output->gen2.active_num == 1, the lost CSID_AUP_CMD or CSID_RUP_CMD
write leaves the hardware without the queued buffer address and stalls
capture.  Multiple active RDI lines on the same CSID can also clobber each
other's csid->addr_update and csid->reg_update bits.

[ ... ]

> +const struct vfe_hw_ops vfe_ops_1080 = {
> +	.addr_update = vfe_addr_update,
> +	.addr_update_clear = vfe_addr_update_clear,

[Severity: Medium]
Can starting a stream with fewer than two queued buffers mismatch the
number of AUP_UPDATE requests against the buffers written to the write
master?

In camss-video.c, msm_video_register() leaves q->min_queued_buffers at 0,
so VIDIOC_STREAMON can run vfe_enable_output_v2() with 0 or 1 buffer
pending:

drivers/media/platform/qcom/camss/camss-vfe.c:vfe_enable_output_v2() {
    ...
	for (i = 0; i < CAMSS_INIT_BUF_COUNT; i++) {
		output->buf[i] = vfe_buf_get_pending(output);
		if (!output->buf[i])
			break;
		output->gen2.active_num++;
		ops->vfe_wm_update(vfe, output->wm_idx[0],
				   output->buf[i]->addr[0], line);
		if (!ops->addr_update)
			ops->reg_update(vfe, line->id);
	}
    ...
}

csid_configure_stream() in camss-csid-1080.c then unconditionally issues
CAMSS_INIT_BUF_COUNT (2) __csid_addr_update() calls even if 0 or 1 buffer
address was programmed into VFE_BUS_WM_IMAGE_ADDR.  When userspace later
queues buffers while output->gen2.active_num < 2, vfe_queue_buffer_v2()
calls ops->addr_update() again for each buffer, issuing 3 or 4 AUP_UPDATE
requests for the first two buffers and violating the requirement that
AUP_UPDATE requests match the number of buffers queued to the write
master.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-kaanapali-camss-v25-0-1d709f57f370@oss.qualcomm.com?part=10

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

  reply	other threads:[~2026-11-13  5:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  5:33 [PATCH v25 00/15] media: qcom: camss: Add Kaanapali support Hangxiang Ma
2026-11-13  5:33 ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 01/15] dt-bindings: phy: qcom,x1e80100-csi2-phy: Add Kaanapali CSI2 PHY Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 02/15] phy: qcom-mipi-csi2: Parametrise the common status register offset Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 03/15] phy: qcom-mipi-csi2: Add Kaanapali support Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 04/15] media: qcom: camss: Add addr_update hooks and guard CSID reg_update Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 05/15] media: dt-bindings: Add CAMSS device for Kaanapali Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 06/15] media: qcom: camss: Add Kaanapali compatible Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 07/15] media: qcom: camss: Add PM clock definitions for Kaanapali Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 08/15] media: qcom: camss: Allow CSI2 PHY devices without CSIPHY resources Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 09/15] media: qcom: camss: csid: Add support for CSID 1080 Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  6:04   ` sashiko-bot
2026-11-13  6:04     ` sashiko-bot
2026-11-13  5:33 ` [PATCH v25 10/15] media: qcom: camss: vfe: Add support for VFE 1080 Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:52   ` sashiko-bot [this message]
2026-11-13  5:52     ` sashiko-bot
2026-11-13  5:33 ` [PATCH v25 11/15] media: qcom: camss: tpg: Add support for v2.4.0 TPG Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 12/15] arm64: dts: qcom: kaanapali: Add CAMSS and CSIPHY block definitions Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:57   ` sashiko-bot
2026-11-13  5:57     ` sashiko-bot
2026-11-13  5:33 ` [PATCH v25 13/15] arm64: dts: qcom: kaanapali: Add CCI controller nodes Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 14/15] arm64: dts: qcom: kaanapali: Add camera MCLK pinctrl Hangxiang Ma
2026-11-13  5:33   ` Hangxiang Ma
2026-11-13  5:33 ` [PATCH v25 15/15] arm64: dts: qcom: kaanapali-mtp-camera-s5kjn5: Add DT overlay Hangxiang Ma
2026-11-13  5:33   ` 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-212259@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.