From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796287806; b=g9wb59GtKF5ZsVycwgX/RWu+0M3DWIyfQ+/d9iEIzMmQrmboB4xQ23T3qavsGWYeESM1 4Efywsz5TRfuZYuP50vK6inTHD6shqaxtsJBL6bb8jSGwD9TtUZCIJbfPm1AVzJOddoyi Az7FzeIx+xt3gob0Tie/xBM3mEUhajxjaSlgmv/iCslYCf06ZXDg0qpyjNGT5eBuqFQsO IP4Y9O/gNyhuQgZpolbtY5UziKp56fPnD0xycQakWTcOf6DONUabpx2vvzv5OvkEocQCx tmnXsyBTplykB2GvC1bvbnO/UQLsOOflFT+u7WB/7rlrrlLjeTj0X7GewigxMQdh9Gw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796287806; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Xq1Cnx6pJrGxlkykk4Co3K7QsGuSKcvEoOravw8gdik=; b=wCQ+etd3e520qQR0VQAo8KweOfFSSXGVuOp+6GHFSqNdlqI/hn+vsP0sCHCmOEtPH/dM b82+PlZPpfdsyZnkja2qJPJZ0BAj5MB31FdH4++K/vjmGGUcVfuXnWsFFU4fMF2RN1p3O 59E/upQng+fhz/gXrPvpu1PMS9SPC7MmyFByvEsV6Prb0Bs0VpxKmCE5aTmDYbgKyVqHJ q05Bxiwms2+iPNSm3PzxvIXALb5/8Gx3EPSmpeVg4LktyrektCpdrJQcf1cPn3jyIPGkV veRaUhfyTb1I19IcRXa9vmSNaaclKxNCju+jPoa8v2CMhgBl4LFJtX1VpNmBSoqXSkA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A2hyoiyo; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3726606A322 for ; Thu, 3 Dec 2026 08:50:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=A2hyoiyo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 260221F000C1; Thu, 3 Dec 2026 08:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796287806; bh=Xq1Cnx6pJrGxlkykk4Co3K7QsGuSKcvEoOravw8gdik=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=A2hyoiyoBvgn3ENai6P2vyo6khDSbuExPZnAAWO8cBhp6UCrsiIPdE/rpUlAdLETT p+C7jl1gEf/xLoxPC25dKJzoR5Mt4U6SfH6OFgMA82HELeFn7EWXkl8dtoLhGxZG4A HrngBMecet8drLgs1V5VpMPUOoXGq664VYWnF6cs8Pr/wMUM1wM11HCS7TtkV8YZWS /SK8wso4PaIJOeaJHg12PJ9Qsuv2sDqQF8uYOqPrqTOgJOHLfcdNesraKHtqYKJbBq pji7VhtcSrHgz/SwO6XvwCUrXp+KyiCF/ITGxtLhdkXYGjLMXAnH7K9Z+YznjnwNHf F+4PbETPQu4pQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v6 3/3] media: qcom: camss: Add support for Hawi Reply-To: sashiko-reviews@lists.linux.dev To: "Nihal Kumar Gupta" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261203-hawi-camss-v6-3-6a30cc09a064@oss.qualcomm.com> References: <20261203-hawi-camss-v6-0-6a30cc09a064@oss.qualcomm.com> <20261203-hawi-camss-v6-3-6a30cc09a064@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 08:50:05 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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/driver= s/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 |=3D 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 &=3D ~CSID_RUP_AUP_RDI(port_id); > +} > + > +static void __csid_reg_update(struct csid_device *csid, int port_id) > +{ > + csid->reg_update |=3D 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_i= d) > +{ > + /* Hardware clears the registers upon consuming the settings */ > + csid->reg_update &=3D ~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 &=3D ~BIT(i) csid->addr_update |=3D 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 ena= ble, u8 port, u8 vc) > +{ > + u32 val; > + u8 lane_cnt =3D 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 =3D &csid->fmt[MSM_CSID_PAD_FIR= ST_SRC + port]; > + const struct csid_format_info *format =3D csid_get_fmt_entry(csid->res-= >formats->formats, > + csid->res->formats->nformats, > + input_format->code); > + > + if (!lane_cnt) > + lane_cnt =3D 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=3D1 builds. [ ... ] > +static void csid_configure_stream(struct csid_device *csid, u8 enable) > +{ > + u8 i, k; > + > + __csid_configure_rx(csid, &csid->phy); > + > + for (i =3D 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 =3D 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 =3D 0; > + for (i =3D 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 |=3D 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 |=3D 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 =3D { > + .configure_stream =3D csid_configure_stream, > + .configure_testgen_pattern =3D csid_configure_testgen_pattern, > + .hw_version =3D csid_hw_version, > + .isr =3D csid_isr, > + .reset =3D csid_reset, > + .src_pad_code =3D csid_src_pad_code, > + .subdev_init =3D csid_subdev_init, > + .reg_update =3D csid_subdev_reg_update, > + .addr_update =3D 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/pl= atform/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[] =3D { > + /* VFE0 - TFE Full */ > + { > + .clock =3D { "vfe0_fast_ahb", "vfe0", "cpas_vfe0", > + "camnoc_rt_axi", "camnoc_nrt_axi", "qdss_debug_xo", > + "cpas_mnoc_hf", "cpas_mnoc_sf" }, > + .clock_rate =3D { { 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 =3D { > + .version =3D CAMSS_HAWI, > + .pd_name =3D "top", > + .pm_clks =3D { "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[] =3D { > + { .compatible =3D "qcom,hawi-camss", .data =3D &hawi_resources }, > { .compatible =3D "qcom,kaanapali-camss", .data =3D &kaanapali_resource= s }, [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.o= rg --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-hawi-camss= -v6-0-6a30cc09a064@oss.qualcomm.com?part=3D3