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=1796372843; b=NAcsoTy1SNXcXJK71mcI81sXwPazw7g8LHXO5w3OugMQAS1ijkMOz68nATHMa1bDtCHN vQB6lNI3lMK50RpmClDafe6d3rna0OSbmVVuTJoluZL74ZKw8ZdH7A9NSJhPcYrPUVa3Y G7mJGhtCOB6EK5TXI20CgNoUbO24KqKQ1VXwAlvnCY2eci3UKKdTqZqodP5sPpodPyNWd e6MPYskK4Fyv59XpEJ5NxqSGkptm0XijiDblIdPmLOZ6SOzyIllULMzZ7fTsuVOrD2+YN KcYsLVvpfZn+/0Y/jYQEWKq0mAz03PXFsZWLdvSx1kJpRp1MYUnh2TrhQDSCDdf3u9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796372843; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=/dM+DpZnr+q9GXifp84oecknu0mvyQm6CucaVisIna8=; b=PpYp9JreZgoqgWOzbyJTfDXmq9fFExlDPz5IUnmYF8LluQCAQZwfIxyTgbu8mA5grnjf 4KOxijAWAtDpEUpbtoDOuV6ov8FQjjL+VMA9kziAt9e5nFu4YUcDdhxrL22bfCGhI7aMH Q6p39XWgdV1fAYhb/vOr42909yhs3UsH4sccGLk08JeB5sRTzBteiuzAGr4DpqYLTl6Kh neLWuV598qHSXtmJjQA9mhXtPJXvdqLdn29gZVecA3F/pvCn8iGnEXbYujLAU+SxY+GM8 10Ln3WHt+cw01tFNQjAqrqpwT6d84w4vt5X3BI3vV2/Dzz/i5fESME6NkiJNjCI129g== 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="EMT/TQcF"; 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 C3573606A322 for ; Fri, 4 Dec 2026 08:27:23 +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=EMT/TQcF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A0751F00897; Fri, 4 Dec 2026 08:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796372843; bh=/dM+DpZnr+q9GXifp84oecknu0mvyQm6CucaVisIna8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=EMT/TQcFA2xnGeWrDakBN9l30DVr7OVwrobRz9R/SmdjilPpS4URwt/P6vpZ+S0jn G70DUayW/fxgKjkCiYlUB32hh63ARKQyZhmqAU6M9qGZ63VLNyayZeJSIDqER5vTNw +hpbTLLDGRHSh5a7FeZ88Gf1mu8TvOLBFiNftH4Fvi6mfdfnF3zuMfWcLswcS2nzoe qWWGGZw88OniGbBX4ESoY+SdxnwlOcitsDyrpFC2Di2z4ZLWI4AjawabmwWncdIHfh NnImfVf/OiaF2M+YSegKg0ilyLP+9nk43bg/52llz4ZQfUmWlIU1FFdhz/lU4hr5RF 4TO/692hUc42g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 04/10] media: qcom: cam-icc: add the Titan camera NoC driver Reply-To: sashiko-reviews@lists.linux.dev To: "Atanas Filipov" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org In-Reply-To: <20261204075339.4077387-5-atanas.filipov@oss.qualcomm.com> References: <20261204075339.4077387-1-atanas.filipov@oss.qualcomm.com> <20261204075339.4077387-5-atanas.filipov@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 08:27:22 +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 8 potential issues to consider: - [High] media: qcom: cam-icc: Kconfig under MEDIA_SUPPORT stalls icc_sync_state() - [High] media: qcom: cam-icc: drop OPP votes while camnoc_axi stays at 400 MHz - [Medium] media: qcom: cam-icc: qcom_cam_icc_remove() leaks enabled clocks on unbind - [Medium] media: qcom: cam-icc: partial clock/OPP failure breaks icc_set_bw() rollback - [Medium] media: qcom: cam-icc: unbalanced disable_irq() in qcom_cam_icc_resume() - [Medium] media: qcom: cam-icc: unchecked match data in qcom_cam_icc_probe() - [Medium] media: qcom: cam-icc: SBM IRQ left unmasked across runtime PM transitions - [Medium] media: qcom: cam-icc: wrong IRQ clear order and unmask during RPM_RESUMING -- commit 28878b8cb1373ee083c9daeccda766f64646eb4a Author: Atanas Filipov media: qcom: cam-icc: add the Titan camera NoC driver This commit adds an interconnect provider driver for the Qualcomm Titan camera NoC, scaling AXI and AHB clocks and rail OPP levels from aggregated bandwidth votes while configuring static QoS and error interrupts on runtime resume. > diff --git a/drivers/media/platform/qcom/cam-icc/Kconfig b/drivers/media/= platform/qcom/cam-icc/Kconfig > new file mode 100644 > index 0000000000000..8fae973ce1b0c > --- /dev/null > +++ b/drivers/media/platform/qcom/cam-icc/Kconfig > @@ -0,0 +1,14 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +config QCOM_CAM_ICC > + tristate "Qualcomm Titan camera NoC core driver" > + depends on ARCH_QCOM || COMPILE_TEST > + depends on COMMON_CLK && PM > + depends on INTERCONNECT > + select PM_OPP > + default ARCH_QCOM [Severity: High] Can nesting QCOM_CAM_ICC under MEDIA_SUPPORT prevent icc_sync_state() from ever completing? This Kconfig file is sourced inside MEDIA_SUPPORT, MEDIA_PLATFORM_SUPPORT, and MEDIA_PLATFORM_DRIVERS, so default ARCH_QCOM has no effect when CONFIG_MEDIA_SUPPORT=3Dn and limits the driver to at most =3Dm when CONFIG_MEDIA_SUPPORT=3Dm (as in arm64 defconfig). Because qcom_cam_icc_dri= ver sets .sync_state =3D icc_sync_state, any boot where the camera NoC DT node = has #interconnect-cells enabled but this driver is not built in or loaded leaves icc_sync_state() below providers_count. That permanently pins boot floor bandwidth constraints across every interconnect provider on the SoC, breaking low-power scaling and system suspend. > diff --git a/drivers/media/platform/qcom/cam-icc/qcom-cam-icc-core.c b/dr= ivers/media/platform/qcom/cam-icc/qcom-cam-icc-core.c > new file mode 100644 > index 0000000000000..dbfccdb30da3e > --- /dev/null > +++ b/drivers/media/platform/qcom/cam-icc/qcom-cam-icc-core.c [ ... ] > +static int qcom_cam_icc_set_axi_rate(struct qcom_cam_icc *camnoc, u64 ra= te) > +{ > + unsigned long freq =3D min_t(u64, rate, ULONG_MAX); > + struct dev_pm_opp *opp; > + int ret; > + > + if (!rate) { > + ret =3D clk_set_min_rate(camnoc->axi_clk, 0); > + if (ret) > + return ret; > + > + ret =3D clk_set_rate(camnoc->axi_clk, 0); > + if (ret) > + return ret; > + > + return dev_pm_opp_set_opp(camnoc->dev, NULL); > + } [Severity: High] Can dev_pm_opp_set_opp(camnoc->dev, NULL) drop the rail voltage while camnoc_axi is still running at 400 MHz on SA8775P? Unlike SM8250 and SC7280, ftbl_cam_cc_camnoc_axi_clk_src in drivers/clk/qcom/camcc-sa8775p.c has no 19.2 MHz XO entry and only a single 400 MHz entry, so clk_set_rate(camnoc->axi_clk, 0) rounds up to 400 MHz and leaves cam_cc_camnoc_axi_clk enabled at 400 MHz. Calling dev_pm_opp_set_opp(camnoc->dev, NULL) while the device is runtime-active immediately lowers SA8775P_MMCX and SA8775P_MXC below their required rpmhpd_opp_svs_l1 corner. On the next qcom_cam_icc_runtime_resume(), clk_bulk_prepare_enable() also restores the parked 400 MHz RCG configuration via clk_rcg2_shared_enable() and writes QoS and IRQ registers before any client votes bandwidth to raise those rails, risking bus errors or hardware hangs. [ ... ] > +static int qcom_cam_icc_update(struct qcom_cam_icc *camnoc) > +{ > + struct icc_node *ahb =3D camnoc->icc_data->nodes[camnoc->data->ahb_id]; > + unsigned long ahb_rate; > + u64 rate; > + int ret; > + > + rate =3D qcom_cam_icc_axi_rate(camnoc); > + ahb_rate =3D (ahb && (ahb->avg_bw || ahb->peak_bw)) ? QCOM_CAM_ICC_AHB_= RATE : 0; > + if (rate =3D=3D camnoc->axi_rate && ahb_rate =3D=3D camnoc->ahb_rate) > + return 0; > + > + if (rate !=3D camnoc->axi_rate) { > + ret =3D qcom_cam_icc_set_axi_rate(camnoc, rate); > + if (ret) > + return ret; > + > + camnoc->axi_rate =3D rate; > + } > + > + if (ahb_rate !=3D camnoc->ahb_rate) { > + ret =3D clk_set_min_rate(camnoc->ahb_clk, ahb_rate); > + if (ret) > + return ret; > + > + ret =3D clk_set_rate(camnoc->ahb_clk, ahb_rate); > + if (ret) > + return ret; > + > + camnoc->ahb_rate =3D ahb_rate; > + } [Severity: Medium] Can a partial clock or OPP failure leave hardware clock state out of sync with camnoc->axi_rate and camnoc->ahb_rate and defeat icc_set_bw() rollback? In qcom_cam_icc_set_axi_rate() when !rate, if clk_set_rate() or dev_pm_opp_set_opp() fails after clk_set_min_rate(0) succeeds, axi_clk is already lowered while camnoc->axi_rate keeps the old frequency. The same mismatch occurs if clk_set_rate() fails after clk_set_min_rate() for ahb_clk here or for axi_clk in qcom_cam_icc_config_clks(). When icc_set_bw() rolls back a failed apply_constraints() by restoring the previous bandwidths and calling provider->set() again, the early check rate =3D=3D camnoc->axi_rate && ahb_rate =3D=3D camnoc->ahb_rate returns 0 = and skips restoring the modified clock state. [ ... ] > +static void qcom_cam_icc_irq_init(struct qcom_cam_icc *camnoc) > +{ > + const struct qcom_cam_icc_data *data =3D camnoc->data; > + size_t i; > + > + writel(data->sbm->clear_val, camnoc->base + data->sbm->clear_reg); > + > + for (i =3D 0; i < data->num_irq_errs; i++) { > + const struct qcom_cam_icc_irq_err *err =3D &data->irq_errs[i]; > + > + writel(1, camnoc->base + err->base + err->clear_off); > + writel(err->enable_val, camnoc->base + err->base + err->enable_off); > + } > + > + if (data->err_logger) { > + writel(1, camnoc->base + data->err_logger->base + QCOM_CAM_ICC_ERL_ERR= CLR); > + writel(QCOM_CAM_ICC_ERL_MAINCTL_STALL_EN | QCOM_CAM_ICC_ERL_MAINCTL_FA= ULT_EN, > + camnoc->base + data->err_logger->base + QCOM_CAM_ICC_ERL_MAINCT= L); > + } > + > + writel(camnoc->irq_mask, camnoc->base + data->sbm->enable_reg); > +} [Severity: Medium] Is data->sbm->clear_reg cleared too early here, and can unmasking data->sbm->enable_reg during RPM_RESUMING wedge the error interrupt? Unlike qcom_cam_icc_irq(), this clears data->sbm->clear_reg before clearing err->clear_off and QCOM_CAM_ICC_ERL_ERRCLR. If a stale error persists across runtime suspend while the shared top GDSC stays powered, the SBM can re-latch before the individual sources are cleared. In addition, qcom_cam_icc_irq_init() runs inside qcom_cam_icc_runtime_resum= e() while rpm_resume() still has runtime_status set to RPM_RESUMING. If an interrupt fires before rpm_resume() transitions to RPM_ACTIVE, qcom_cam_icc_irq() sees pm_runtime_get_if_active() <=3D 0 and returns IRQ_N= ONE without clearing the latched status, which leaves a rising-edge interrupt line asserted high and silences future error interrupts until the next suspend/resume cycle. [ ... ] > +static int qcom_cam_icc_runtime_suspend(struct device *dev) > +{ > + struct qcom_cam_icc *camnoc =3D dev_get_drvdata(dev); > + > + clk_bulk_disable_unprepare(camnoc->num_clks, camnoc->clks); > + icc_set_bw(camnoc->hf_path, 0, 0); > + icc_set_bw(camnoc->cfg_path, 0, 0); > + > + return 0; > +} [Severity: Medium] Can leaving SBM interrupts unmasked in qcom_cam_icc_runtime_suspend() drop and wedge edge-triggered camera NoC error interrupts? qcom_cam_icc_runtime_suspend() disables clocks without masking data->sbm->enable_reg (or the per-source error enables) and without synchronizing with the threaded qcom_cam_icc_irq() handler. If an error fires during suspend, or while suspended with the shared TITAN_TOP_GDSC held on by another consumer such as cci0 or cci1, the threaded handler bails out: CPU0 CPU1 rpm_suspend() runtime_status =3D RPM_SUSPENDING qcom_cam_icc_runtime_suspend() clk_bulk_disable_unprepare() -> wakes qcom_cam_icc_irq() qcom_cam_icc_irq() pm_runtime_get_if_active() -> 0 return IRQ_NONE <-- status uncleared Because the interrupt is rising-edge triggered, leaving the SBM status uncleared keeps the line latched high and suppresses further error interrupts (and leaves the error logger stalled if STALL_EN triggered) until the next runtime resume re-runs qcom_cam_icc_irq_init(). [ ... ] > +static int qcom_cam_icc_resume(struct device *dev) > +{ > + struct qcom_cam_icc *camnoc =3D dev_get_drvdata(dev); > + int ret; > + > + ret =3D pm_runtime_force_resume(dev); > + if (ret) > + return ret; > + > + enable_irq(camnoc->irq); > + > + return 0; > +} [Severity: Medium] Does returning early when pm_runtime_force_resume() fails leave camnoc->irq permanently disabled? qcom_cam_icc_suspend() calls disable_irq(camnoc->irq), and even on callback failure pm_runtime_force_resume() marks the device suspended and re-enables runtime PM before system resume proceeds. Skipping enable_irq(camnoc->irq) leaves the IRQ disable depth unbalanced across subsequent runtime resumes. Calling enable_irq(camnoc->irq) unconditionally is safe because the device remains suspended on error and qcom_cam_icc_irq() checks pm_runtime_get_if_active() <=3D 0. [ ... ] > + camnoc->dev =3D dev; > + camnoc->data =3D device_get_match_data(dev); > + > + camnoc->base =3D devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(camnoc->base)) > + return PTR_ERR(camnoc->base); > + > + camnoc->num_clks =3D devm_clk_bulk_get_all(dev, &camnoc->clks); > + if (camnoc->num_clks < 0) > + return dev_err_probe(dev, camnoc->num_clks, "failed to get clocks\n"); > + > + camnoc->axi_clk =3D devm_clk_get(dev, camnoc->data->rate_clk); [Severity: Medium] Can device_get_match_data() return NULL here and cause a NULL pointer dereference? If a platform device is bound to qcom-cam-icc without matching qcom_cam_icc_of_match (for example via sysfs driver_override and bind), camnoc->data is NULL and dereferencing camnoc->data->rate_clk oopses in devm_clk_get(). Checking if (!camnoc->data) and returning -ENODEV avoids the crash. [ ... ] > + ret =3D qcom_cam_icc_irq_request(pdev, camnoc); > + if (ret) > + return dev_err_probe(dev, ret, "failed to request the interrupt\n"); > + > + ret =3D devm_pm_runtime_enable(dev); > + if (ret) > + return ret; > + > + ret =3D qcom_cam_icc_icc_init(camnoc); > + if (ret) > + return dev_err_probe(dev, ret, "failed to register the interconnect pr= ovider\n"); > + > + return 0; > +} > + > +static void qcom_cam_icc_remove(struct platform_device *pdev) > +{ > + struct qcom_cam_icc *camnoc =3D platform_get_drvdata(pdev); > + > + icc_provider_deregister(&camnoc->provider); > + icc_nodes_remove(&camnoc->provider); > +} [Severity: Medium] Can unbinding the driver while the device is RPM_ACTIVE leak enabled clocks and detach power domains while clocks are still running? During unbind, __device_release_driver() resumes the device with pm_runtime_get_sync() and calls pm_runtime_put_sync(). If the device stays RPM_ACTIVE (for example because userspace set power/control to on, or an in-flight qcom_cam_icc_irq() holds pm_runtime_get_if_active()), qcom_cam_icc_remove() returns without synchronizing IRQ teardown or suspending the device. Because devm_pm_runtime_enable() is registered after qcom_cam_icc_irq_request(), LIFO devres teardown runs pm_runtime_disable() before free_irq() without calling qcom_cam_icc_runtime_suspend(). Later devres callbacks then detach the power domains while clocks are active, and devm_clk_bulk_release_all() puts the handles without disabling or unpreparing them, permanently leaking prepare_count and enable_count on camnoc->clks. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204075339.4077= 387-1-atanas.filipov@oss.qualcomm.com?part=3D4