From: sashiko-bot@kernel.org
To: "Nihal Kumar Gupta" <nihal.gupta@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v6 3/3] media: qcom: camss: Add support for Hawi
Date: Thu, 03 Dec 2026 08:50:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-247390@kernel.org> (raw)
In-Reply-To: <20261203-hawi-camss-v6-3-6a30cc09a064@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 10 potential
issues to consider:
- [High] media: qcom: camss: unconditional AUP strobes in
csid_configure_stream()
- [Medium] media: qcom: camss: unsynchronized RMW race on csid
addr_update/reg_update
- [Medium] media: camss: csid_configure_stream() skips
CSID_BUF_DONE_IRQ_MASK update
- [Medium] media: qcom: camss: camnoc_rt_axi rates in vfe_res_hawi
mismatch camcc-hawi
- [Medium] media: qcom: camss: hawi omits required gcc_axi_sf clock
- [Low] media: qcom: camss: camss-csid-1190.c duplicates
camss-csid-1080.c verbatim
- [Low] media: qcom: camss: unused-but-set lane_cnt in
__csid_configure_rdi_stream()
- [Low] media: qcom: camss: MSM_CSID_MAX_SRC_STREAMS_1190 captures local
variable
- [Low] media: qcom: camss: commit message contradicts hawi_resources
tables
- [Low] media: qcom: camss: qcom,glymur-camss not moved above
qcom,hawi-camss
--
commit 9ba484f0cc1b829c5b791460b883c113d8262ec0
Author: Hangxiang Ma <hangxiang.ma@oss.qualcomm.com>
media: qcom: camss: Add support for Hawi
This patch adds CAMSS support for the Hawi SoC by introducing CSID 1190
and VFE 1190 hardware operations along with the Hawi resource tables and
device tree match entry.
> Add CAMSS support for the Hawi SoC. The CSIPHY resource table is reused
> from Kaanapali and the TPG table from X1E80100.
>
> Hawi calls its front-end blocks TFEs (Thin Front Ends), but the VFE 1190
> driver keeps the VFE naming for consistency. The common CPAS clocks are
> managed as PM clocks of the CAMSS resources rather than per-VFE clocks.
[Severity: Low]
Does the commit message match hawi_resources and vfe_res_hawi?
hawi_resources sets .tpg_res to tpg_res_8775p rather than
tpg_res_x1e80100, and neither kaanapali_resources nor hawi_resources
defines a CSIPHY resource table (both leave .csiphy_res NULL for
standalone PHYs). Also, while hawi_resources.pm_clks holds cpas_fast_ahb
and cpas_ahb, vfe_res_hawi still lists the shared cpas_mnoc_hf and
cpas_mnoc_sf clocks in every per-VFE entry.
> diff --git a/drivers/media/platform/qcom/camss/camss-csid-1190.c b/drivers/media/platform/qcom/camss/camss-csid-1190.c
> new file mode 100644
> index 0000000000000..e3eb17b8ec5d3
> --- /dev/null
> +++ b/drivers/media/platform/qcom/camss/camss-csid-1190.c
[ ... ]
> +#define MSM_CSID_MAX_SRC_STREAMS_1190 (csid_is_lite(csid) ? 4 : 5)
[Severity: Low]
This isn't a bug, but MSM_CSID_MAX_SRC_STREAMS_1190 implicitly relies on a
local variable named csid in every caller scope. Passing csid as a macro
argument or using an inline helper avoids hidden variable capture.
[ ... ]
> +static void __csid_aup_rup_trigger(struct csid_device *csid)
> +{
> + /* trigger SET in combined register */
> + writel(RUP_SET, csid->base + CSID_RUP_AUP_CMD);
> +}
> +
> +static void __csid_addr_update(struct csid_device *csid, int port_id)
> +{
> + csid->addr_update |= CSID_RUP_AUP_RDI(port_id);
> + writel(csid->addr_update, csid->base + CSID_AUP_CMD);
> +
> + __csid_aup_rup_trigger(csid);
> +}
> +
> +static void __csid_addr_update_clear(struct csid_device *csid, int port_id)
> +{
> + /* Hardware clears the registers upon consuming the settings */
> + csid->addr_update &= ~CSID_RUP_AUP_RDI(port_id);
> +}
> +
> +static void __csid_reg_update(struct csid_device *csid, int port_id)
> +{
> + csid->reg_update |= CSID_RUP_AUP_RDI(port_id);
> + writel(csid->reg_update, csid->base + CSID_RUP_CMD);
> +
> + __csid_aup_rup_trigger(csid);
> +}
> +
> +static void __csid_reg_update_clear(struct csid_device *csid, int port_id)
> +{
> + /* Hardware clears the registers upon consuming the settings */
> + csid->reg_update &= ~CSID_RUP_AUP_RDI(port_id);
> +}
[Severity: Medium]
Can concurrent updates to csid->addr_update and csid->reg_update race
between process context and csid_isr()?
vfe_queue_buffer_v2() calls ops->addr_update() and ops->reg_update() while
holding only vfe->output_lock, csid_configure_stream() calls them with no
lock and IRQs enabled, and csid_isr() clears bits on INFO_RUP_DONE without
holding any lock:
CPU0 (vfe_queue_buffer_v2) CPU1 (csid_isr)
read csid->addr_update
csid->addr_update &= ~BIT(i)
csid->addr_update |= BIT(j) <-- resurrects cleared BIT(i)
writel(addr_update, CSID_AUP_CMD)
writel(RUP_SET, CSID_RUP_AUP_CMD)
A lost bit set can stall capture, while a resurrected bit can spuriously
re-trigger AUP/RUP for an already-consumed port. Protecting these fields
and the AUP/RUP/SET register writes with an IRQ-safe spinlock on struct
csid_device would close the race.
[ ... ]
> +static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8 port, u8 vc)
> +{
> + u32 val;
> + u8 lane_cnt = csid->phy.lane_cnt;
> +
> + /* 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);
> +
> + if (!lane_cnt)
> + lane_cnt = 4;
[Severity: Low]
Is lane_cnt used anywhere in __csid_configure_rdi_stream()? It is
initialized and conditionally assigned, but never read, which triggers a
-Wunused-but-set-variable warning under W=1 builds.
[ ... ]
> +static void csid_configure_stream(struct csid_device *csid, u8 enable)
> +{
> + u8 i, k;
> +
> + __csid_configure_rx(csid, &csid->phy);
> +
> + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS_1190; i++) {
> + if (csid->phy.en_vc & BIT(i)) {
> + __csid_configure_rdi_stream(csid, enable, i, 0);
> + __csid_configure_rx_vc(csid, 0);
> +
> + for (k = 0; k < CAMSS_INIT_BUF_COUNT; k++)
> + __csid_addr_update(csid, i);
> +
> + __csid_reg_update(csid, i);
> +
> + __csid_ctrl_rdi(csid, enable, i);
> + }
> + }
> +}
[Severity: High]
Can this loop latch uninitialized or stale DMA addresses into the VFE
write master when VIDIOC_STREAMON is called with fewer than
CAMSS_INIT_BUF_COUNT buffers queued?
msm_video_register() leaves vb2_queue.min_queued_buffers at 0, so
userspace can call VIDIOC_STREAMON with 0 or 1 buffers queued.
vfe_enable_output_v2() then programs VFE_BUS_WM_IMAGE_ADDR() only for the
available pending buffers, but csid_configure_stream() unconditionally
fires CAMSS_INIT_BUF_COUNT AUP strobes and a RUP strobe for every
link-enabled RDI port (even when enable is 0 or a linked port is not
streaming).
That mismatch latches uninitialized, stale, or duplicate addresses into
hardware, risking SMMU faults or DMA overwrites, and desynchronizes
software buffer accounting once subsequent VIDIOC_QBUF calls trigger
additional addr_update() strobes in vfe_queue_buffer_v2().
[ ... ]
> + val = 0;
> + for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS_1190; i++) {
> + if (csid->phy.en_vc & BIT(i)) {
> + /*
> + * Only need to clear buf done IRQ status here,
> + * RUP done IRQ status will be cleared once isr
> + * strobe generated by CSID_RST_CMD
> + */
> + val |= BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i);
> + }
> + }
> + writel(val, csid->base + CSID_BUF_DONE_IRQ_CLEAR);
> + writel(val, csid->base + CSID_BUF_DONE_IRQ_MASK);
[Severity: Medium]
Can a newly linked RDI stream start with its buffer-done interrupt left
masked in CSID_BUF_DONE_IRQ_MASK?
csid_reset() is the only place that writes CSID_BUF_DONE_IRQ_MASK, and it
only runs when csid->subdev.entity.use_count transitions from 0 to 1.
During VIDIOC_STREAMON, video_prepare_streaming() powers on CSID and
releases mdev->graph_mutex before video_start_streaming() marks CSID pads
as streaming:
CPU0 (VIDIOC_STREAMON) CPU1 (MEDIA_IOC_SETUP_LINK)
video_prepare_streaming()
v4l2_pipeline_pm_get()
csid_reset() /* masks BIT(0) */
/* drops mdev->graph_mutex */
__media_entity_setup_link()
csid_link_setup()
csid->phy.en_vc |= BIT(1)
video_start_streaming()
csid_configure_stream() <-- starts RDI1 with IRQ masked
Because csid_configure_stream() never updates CSID_BUF_DONE_IRQ_MASK,
camss_buf_done() is never delivered for the second stream and frame
completion stalls. Updating CSID_BUF_DONE_IRQ_MASK in
csid_configure_stream() (or unmasking all RDI bits in csid_reset()) avoids
this.
[ ... ]
> +const struct csid_hw_ops csid_ops_1190 = {
> + .configure_stream = csid_configure_stream,
> + .configure_testgen_pattern = csid_configure_testgen_pattern,
> + .hw_version = csid_hw_version,
> + .isr = csid_isr,
> + .reset = csid_reset,
> + .src_pad_code = csid_src_pad_code,
> + .subdev_init = csid_subdev_init,
> + .reg_update = csid_subdev_reg_update,
> + .addr_update = csid_subdev_addr_update,
> +};
[Severity: Low]
Can csid_res_hawi reuse csid_ops_1080 directly instead of adding
camss-csid-1190.c?
Every register offset, bitmask, stream count, and function implementation
in camss-csid-1190.c is functionally identical to camss-csid-1080.c,
differing only in symbol renames and comments. Likewise, camss-vfe-1190.c
duplicates all VFE helper functions and ops from camss-vfe-1080.c,
differing only in the bus register offset macros.
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 0404f95a35fe6..4ac5a2b4f1232 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
[ ... ]
> +static const struct camss_subdev_resources vfe_res_hawi[] = {
> + /* VFE0 - TFE Full */
> + {
> + .clock = { "vfe0_fast_ahb", "vfe0", "cpas_vfe0",
> + "camnoc_rt_axi", "camnoc_nrt_axi", "qdss_debug_xo",
> + "cpas_mnoc_hf", "cpas_mnoc_sf" },
> + .clock_rate = { { 0 },
> + { 238200000, 397000000, 440000000, 480000000,
> + 630000000, 750000000, 833000000 },
> + { 0 },
> + { 171428571, 240000000, 300000000, 400000000,
> + 480000000, 600000000 },
[Severity: Medium]
Do the camnoc_rt_axi rates across vfe_res_hawi match the Hawi CAMCC
frequency table?
In drivers/clk/qcom/camcc-hawi.c, ftbl_cam_cc_camnoc_rt_axi_clk_src
defines 120, 160, 240, 320, and 480 MHz (maximum 480 MHz), and even
ftbl_cam_cc_camnoc_rt_axi_clk_src_maili starts at 200 MHz with no
171428571 Hz step. Because cam_cc_camnoc_rt_axi_clk_src uses CEIL
rounding, requesting 171428571 Hz skips the 120 and 160 MHz OPPs (both
while streaming and in vfe_release_clock_rates()), 400 MHz skips 320 MHz,
and 600 MHz installs an unsatisfiable consumer min_rate above Hawi's
480 MHz ceiling in vfe_set_clock_rates().
[ ... ]
> +static const struct camss_resources hawi_resources = {
> + .version = CAMSS_HAWI,
> + .pd_name = "top",
> + .pm_clks = { "cpas_fast_ahb", "cpas_ahb", "gcc_axi_hf" },
[Severity: Medium]
Should gcc_axi_sf be included in hawi_resources.pm_clks (or vfe_res_hawi)?
All five VFE entries in vfe_res_hawi enable cpas_mnoc_sf
(cam_cc_titan_mnoc_sf_clk), which uses BRANCH_HALT with no hwcg_reg, and
the Hawi DT binding requires gcc_axi_sf alongside gcc_axi_hf. Because
gcc_camera_sf_axi_clk in drivers/clk/qcom/gcc-hawi.c is not marked
critical or ignore-unused, clk_disable_unused() gates it, and enabling
cpas_mnoc_sf during vfe_get() can fail with -EBUSY and a branch-halt
warning in clk_branch_wait() unless firmware forces it on.
[ ... ]
> static const struct of_device_id camss_dt_match[] = {
> + { .compatible = "qcom,hawi-camss", .data = &hawi_resources },
> { .compatible = "qcom,kaanapali-camss", .data = &kaanapali_resources },
[Severity: Low]
As reported by Bryan O'Donoghue on v3 [1], qcom,glymur-camss at the bottom
of camss_dt_match[] still needs to be moved to the top above
qcom,hawi-camss to keep the match table in alphabetical order.
[1] https://lore.kernel.org/r/23845ad3-dedd-4e24-803b-5abf3b030c4a@kernel.org
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-hawi-camss-v6-0-6a30cc09a064@oss.qualcomm.com?part=3
prev parent reply other threads:[~2026-12-03 8:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:17 [PATCH v6 0/3] Add CAMSS support for Qualcomm Hawi and Maili Nihal Kumar Gupta
2026-12-03 8:17 ` [PATCH v6 1/3] dt-bindings: media: Add CAMSS device for " Nihal Kumar Gupta
2026-12-03 8:32 ` sashiko-bot
2026-12-03 8:17 ` [PATCH v6 2/3] media: qcom: camss: csid: Scale the clocks with the CSI-2 link rate Nihal Kumar Gupta
2026-12-03 8:39 ` sashiko-bot
2026-12-03 8:17 ` [PATCH v6 3/3] media: qcom: camss: Add support for Hawi Nihal Kumar Gupta
2026-12-03 8:50 ` sashiko-bot [this message]
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-247390@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=nihal.gupta@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@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