From: sashiko-bot@kernel.org
To: "Qianhui Xu" <xiaqinghuan@mail.ustc.edu.cn>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v2 8/9] media: camss: vfe: add the gen4 block and SM8750 camera subsystem
Date: Wed, 28 Oct 2026 09:53:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-187701@kernel.org> (raw)
In-Reply-To: <20261028093003.722745-9-xiaqinghuan@mail.ustc.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] media: camss: race on csid reg_update state between vfe_reg_update() and csid_isr()
--
commit 5ba0f2cd4903e9301f9d8d170289c6e55be33cde
Author: Qianhui Xu <xiaqinghuan@mail.ustc.edu.cn>
media: camss: vfe: add the gen4 block and SM8750 camera subsystem
This commit adds VFE gen4 hardware support where buffer done, register update
completion, and frame start interrupts are handled by the CSID, and requires
256-byte alignment for DMA addresses and frame sizes. It also adds the
SM8750 camera subsystem resource definitions and compatible string.
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen4.c b/drivers/media/platform/qcom/camss/camss-vfe-gen4.c
> new file mode 100644
> index 0000000000000..2ee82898f37dc
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen4.c
> @@ -0,0 +1,212 @@
[ ... ]
> +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 inline 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);
> +}
[Severity: Medium]
Can vfe_reg_update() and vfe_reg_update_clear() in
drivers/media/platform/qcom/camss/camss-vfe-gen4.c race with csid_isr() in
drivers/media/platform/qcom/camss/camss-csid-980.c when updating the CSID
register update state?
On SM8750, vfe_res_8750 (using vfe_ops_gen4) is paired with csid_res_8750
(using csid_ops_980). When userspace queues a buffer via VIDIOC_QBUF while
output->gen2.active_num is below 2, vfe_queue_buffer_v2() acquires
vfe->output_lock and calls:
vfe_reg_update()
-> camss_reg_update(vfe->camss, vfe->id, port_id, false)
-> csid_subdev_reg_update(csid, port_id, false)
-> __csid_aup_update(csid, port_id)
In drivers/media/platform/qcom/camss/camss-csid-980.c, __csid_aup_update()
performs a non-atomic read-modify-write on csid->reg_update or
csid->aup_update and writes it to hardware:
if (csid_is_lite(csid)) {
csid->reg_update |= CSID_LITE_AUP_RDI(port_id);
writel(csid->reg_update, csid->base + CSID_LITE_RUP_AUP_CMD);
} else {
csid->aup_update |= CSID_RUP_AUP_RDI(port_id);
writel(csid->aup_update, csid->base + CSID_AUP_CMD);
__csid_full_aup_rup_trigger(csid);
}
Concurrently on another CPU, the CSID interrupt handler csid_isr() in
drivers/media/platform/qcom/camss/camss-csid-980.c handles INFO_RUP_DONE
without holding vfe->output_lock or any CSID lock:
if (val & INFO_RUP_DONE)
csid_subdev_reg_update(csid, i, true);
which calls __csid_aup_rup_clear():
if (csid_is_lite(csid)) {
csid->reg_update &= ~CSID_LITE_RUP_RDI(port_id);
csid->reg_update &= ~CSID_LITE_AUP_RDI(port_id);
} else {
csid->aup_update &= ~CSID_RUP_AUP_RDI(port_id);
csid->rup_update &= ~CSID_RUP_AUP_RDI(port_id);
}
A similar race can also happen when multiple RDI ports stream on the same
CSID and vfe_enable_output_v2(), csid_configure_stream(), or
vfe_queue_buffer_v2() run concurrently with csid_isr().
Could this unsynchronized read-modify-write lose a pending address update
(AUP) bit or re-write a stale RUP/AUP bit to CSID_AUP_CMD or
CSID_LITE_RUP_AUP_CMD, causing dropped buffer updates or stalled frame
capture?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261028093003.722745-1-xiaqinghuan@mail.ustc.edu.cn?part=8
next prev parent reply other threads:[~2026-10-28 9:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 9:29 [PATCH v2 0/9] media: camss: add SM8750 support Qianhui Xu
2026-10-28 9:29 ` [PATCH v2 1/9] dt-bindings: media: add the Qualcomm SM8750 camera subsystem Qianhui Xu
2026-10-28 12:53 ` Krzysztof Kozlowski
2026-10-28 9:29 ` [PATCH v2 2/9] media: camss: csiphy: add CSIPHY 2.4.0 lane settings for SM8750 Qianhui Xu
2026-10-28 9:37 ` sashiko-bot
2026-10-28 9:29 ` [PATCH v2 3/9] media: camss: csid: unwind the power-on path through a single error label Qianhui Xu
2026-10-28 9:29 ` [PATCH v2 4/9] media: camss: csid: add the 980 generation Qianhui Xu
2026-10-28 9:52 ` sashiko-bot
2026-10-28 9:29 ` [PATCH v2 5/9] media: camss: csid: report frame starts from CSID Qianhui Xu
2026-10-28 12:30 ` Bryan O'Donoghue
2026-10-28 9:30 ` [PATCH v2 6/9] media: camss: video: check that a buffer is DMA contiguous and add a prepare hook Qianhui Xu
2026-10-28 12:32 ` Bryan O'Donoghue
2026-10-28 9:30 ` [PATCH v2 7/9] media: camss: video: stop the subdevices already started when a start fails Qianhui Xu
2026-10-28 9:30 ` [PATCH v2 8/9] media: camss: vfe: add the gen4 block and SM8750 camera subsystem Qianhui Xu
2026-10-28 9:53 ` sashiko-bot [this message]
2026-10-28 9:30 ` [PATCH v2 9/9] arm64: dts: qcom: sm8750: add the " Qianhui Xu
2026-10-28 10:10 ` [PATCH v2 0/9] media: camss: add SM8750 support Vladimir Zapolskiy
2026-10-28 12:09 ` Qianhui Xu
2026-10-28 10:42 ` Hangxiang Ma
2026-10-28 12:09 ` Qianhui Xu
2026-10-28 12:17 ` Bryan O'Donoghue
2026-10-29 6:59 ` Qianhui Xu
2026-10-29 7:07 ` Krzysztof Kozlowski
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-187701@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiaqinghuan@mail.ustc.edu.cn \
/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.