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=1796037532; b=atjyMROqxRRZHtAra/6/hUPS3AMpZBCv/1B3E1Am1B9QUYce5HhNxFq3j9FBzp1tTDOp MF65aD0cubWR3+63jKZUr8wFUeNiSM9Aolac4sv9x8X6TtmXGyrIBga2dKnvT75LiS5sP SMCbJnymy4ZG8h8PobRkqHTIv9vZX3z23I62gO71TiS3IJIPXvOFKCBDHaL85+ctba8fG qjy+LF3wW7mfnHLpVLa5jYwTiIWg7v8VI5X+BFT3qLnDMewcBU+K+Hb1BejMaDo89WVlR OqxdlG9mQ2taCvpzehDIrv6CTFVWgl2x/qZ409Y6AyxgftaNOoyTcIxF1aT+JpP4s3g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796037532; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=UwNls9u1NpDbemd+XjM/5OaNiN1ZAPM7Y61jyuZtGPw=; b=lCQQkSJ7HnzVKTq1wng8xXnSQ2iAz0QvWWJOwqWRcceKNRDyJ04Fd389VrHOsmDIBDPb SDVi4f4EmZ5tIc0rGVDrEVeJLXHu6PlD/cEfGqGlDL936b//7oqfZzwXa/JLDTr9Bv9bM Zp5dAZBloj6mf9RpNKr5zvYXjvmxv8knSwYyBGVcqTrKFBSL6wUR4TOsasUUl3J8GBvXZ wpeWWzanEzAwqXhAP2rlqEFNRW5vRf7NRrzINa60oO5gyk8d0WkXv6jmbzihCya3ngloA fd94fLTKLNKu3p+Rui48r/Yr9lgtU1oUfCgNjTzU8XzOJ7swbXuNs2y2tJH7/hNJsZg== 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=iDraEh5T; 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 91C34606A320 for ; Mon, 30 Nov 2026 11:18:52 +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=iDraEh5T Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01C151F00896; Mon, 30 Nov 2026 11:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796037532; bh=UwNls9u1NpDbemd+XjM/5OaNiN1ZAPM7Y61jyuZtGPw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=iDraEh5Tli60y9QaOfuCKaEaA72j/4susXpKyMvg20kNx6PFSR5leRtxSWCDlpc2Q zXFnFrCmWslrP15wYfMfB3+CXN5dm1VsXqb+swG0uLxX7Sivt74959Axcsof29yfXg keUa/vQkF0tumGNxQQYrJrRo79vSpiuC6wytlJu+5j1ZRxhO9FujTrxPIGvE+YYpiv 8v77yDffKwAwz46DM9UZEEH6dWLYfbE8hve9hcUN1xpZc3LCN5BpdHPIk825jAuBpH 3HxhCFQxUIfLey1CvAicH9Q+2w6CWjNUf/MFSAsQ7l9OvZkk8gyusGlEuXISU8jpqv vTHUXpIhREEnw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 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: <20261130104955.1288089-5-atanas.filipov@oss.qualcomm.com> References: <20261130104955.1288089-1-atanas.filipov@oss.qualcomm.com> <20261130104955.1288089-5-atanas.filipov@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 11:18:51 +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 5 potential issues to consider: - [High] media: qcom: cam-icc: clk_set_rate_range() with ULONG_MAX prevents downscaling - [Medium] media: qcom: cam-icc: PD_FLAG_DEV_LINK_ON leaks active reference on top GDSC - [Medium] media: qcom: cam-icc: of_icc_xlate_onecell() drops interconnect path tags - [Medium] media: qcom: cam-icc: premature drvdata and runtime PM enable in probe - [Medium] media: qcom: cam-icc: race between qcom_cam_icc_irq() and force suspend -- commit 99e6773ec5e7bf2c96781aedd0dc83a40d461f04 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 to scale the AXI/AHB clocks and power domain rail levels from aggregated bandwidth votes, and to configure static QoS and error interrupts on runtime resume. > 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..beb0ee0cad7a4 > --- /dev/null > +++ b/drivers/media/platform/qcom/cam-icc/qcom-cam-icc-core.c > @@ -0,0 +1,635 @@ [ ... ] > +static int qcom_cam_icc_set_axi_rate(struct qcom_cam_icc *camnoc, u64 ra= te) > +{ > + unsigned long freq =3D rate; > + struct dev_pm_opp *opp; > + int ret; > + > + if (!rate) { > + ret =3D clk_set_rate_range(camnoc->axi_src, 0, ULONG_MAX); > + if (ret) > + return ret; > + > + return dev_pm_opp_set_opp(camnoc->dev, NULL); > + } [ ... ] > +static int qcom_cam_icc_update(struct qcom_cam_icc *camnoc) > +{ > + struct icc_node *ahb =3D camnoc->icc_data->nodes[camnoc->data->ahb_id]; > + const struct qcom_cam_icc_ahb_level *level; > + unsigned long ahb_rate; > + u64 rate; > + int ret; > + > + rate =3D qcom_cam_icc_axi_rate(camnoc); > + level =3D qcom_cam_icc_ahb_level(camnoc, ahb ? ahb->peak_bw : 0); > + if (rate =3D=3D camnoc->axi_rate && level =3D=3D camnoc->ahb_level) > + 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 (level !=3D camnoc->ahb_level) { > + ahb_rate =3D level ? level->slow_ahb_rate : 0; > + ret =3D clk_set_rate_range(camnoc->ahb_src, ahb_rate, ULONG_MAX); [Severity: High] Does calling clk_set_rate_range() with max set to ULONG_MAX prevent camnoc->axi_src and camnoc->ahb_src from ever scaling back down? clk_set_rate_range() clamps clk->core->req_rate into [min, max] and passes that clamped value to clk_core_set_rate_nolock(), which updates req_rate: drivers/clk/clk.c:clk_set_rate_range_nolock() { ... rate =3D clamp(clk->core->req_rate, min, max); ret =3D clk_core_set_rate_nolock(clk->core, rate); ... } Once qcom_cam_icc_config_clks() or qcom_cam_icc_update() raises the minimum frequency to R_high, req_rate becomes R_high. When bandwidth votes later drop to a lower OPP frequency R_low or 0, clamp(R_high, R_low, ULONG_MAX) still evaluates to R_high, so the clock stays at R_high while dev_pm_opp_set_opp() lowers or drops the voltage rail performance state, undervolting the active AXI clock. [ ... ] > +static int qcom_cam_icc_icc_init(struct qcom_cam_icc *camnoc) > +{ > + const struct qcom_cam_icc_data *data =3D camnoc->data; > + struct icc_provider *provider =3D &camnoc->provider; > + struct icc_onecell_data *icc_data; > + size_t i, j; > + int ret; > + > + icc_data =3D devm_kzalloc(camnoc->dev, struct_size(icc_data, nodes, dat= a->num_ids), > + GFP_KERNEL); > + if (!icc_data) > + return -ENOMEM; > + > + icc_data->num_nodes =3D data->num_ids; > + camnoc->icc_data =3D icc_data; > + > + provider->dev =3D camnoc->dev; > + provider->set =3D qcom_cam_icc_icc_set; > + provider->aggregate =3D qcom_cam_icc_icc_aggregate; > + provider->get_bw =3D qcom_cam_icc_icc_get_bw; > + provider->xlate =3D of_icc_xlate_onecell; > + provider->data =3D icc_data; [Severity: Medium] Does using of_icc_xlate_onecell drop interconnect path tags? The Titan camera NoC bindings define #interconnect-cells =3D <2>, where the second cell is the path tag. Because provider->xlate is set instead of provider->xlate_extended, of_icc_get_from_provider() leaves src_data->tag as 0, and of_icc_get_by_index() never applies the tag to paths starting at a camera NoC port (including the downstream mmss_noc and mc_virt providers). [ ... ] > +static irqreturn_t qcom_cam_icc_irq(int irq, void *dev_id) > +{ > + struct qcom_cam_icc *camnoc =3D dev_id; > + const struct qcom_cam_icc_data *data =3D camnoc->data; > + u32 status, pending, enable; > + size_t i; > + > + if (pm_runtime_get_if_active(camnoc->dev) <=3D 0) > + return IRQ_NONE; > + > + status =3D readl(camnoc->base + data->sbm->status_reg); [ ... ] > +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); > + > + return icc_set_bw(camnoc->cfg_path, 0, 0); > +} [ ... ] > +static const struct dev_pm_ops qcom_cam_icc_pm_ops =3D { > + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) > + RUNTIME_PM_OPS(qcom_cam_icc_runtime_suspend, qcom_cam_icc_runtime_resum= e, NULL) > +}; [Severity: Medium] Can qcom_cam_icc_irq() race with pm_runtime_force_suspend() and access camnoc->base after clocks and cfg_path are disabled? CPU0 CPU1 qcom_cam_icc_irq() pm_runtime_get_if_active() > 0 dpm_suspend() pm_runtime_force_suspend() qcom_cam_icc_runtime_suspend() clk_bulk_disable_unprepare(..= .) icc_set_bw(cfg_path, 0, 0) readl(camnoc->base + ...) <-- unclocked MMIO access pm_runtime_force_suspend() runs during dpm_suspend(), before dpm_suspend_noirq() disables device interrupts, and invokes qcom_cam_icc_runtime_suspend() regardless of the power.usage_count reference taken by pm_runtime_get_if_active(). > + > +static const char * const qcom_cam_icc_pd_names[] =3D { "top" }; > + > +static const struct dev_pm_domain_attach_data qcom_cam_icc_pd_data =3D { > + .pd_names =3D qcom_cam_icc_pd_names, > + .num_pd_names =3D ARRAY_SIZE(qcom_cam_icc_pd_names), > + .pd_flags =3D PD_FLAG_DEV_LINK_ON, > +}; [Severity: Medium] Does PD_FLAG_DEV_LINK_ON leave the top GDSC powered on after probe? PD_FLAG_DEV_LINK_ON passes DL_FLAG_RPM_ACTIVE to device_link_add(), which calls pm_runtime_get_sync() on the top power domain under the assumption that the consumer device will be set to RPM_ACTIVE during probe. Because qcom_cam_icc_probe() leaves camnoc->dev in RPM_SUSPENDED state, that active supplier reference is never dropped when probe finishes, keeping the Titan top GDSC powered on after boot until camnoc->dev goes through a runtime resume and suspend cycle. [ ... ] > + platform_set_drvdata(pdev, camnoc); > + > + ret =3D qcom_cam_icc_pd_init(camnoc); > + if (ret) > + return dev_err_probe(dev, ret, "failed to attach the power domains\n"); > + > + ret =3D qcom_cam_icc_opp_init(camnoc); > + if (ret) > + return dev_err_probe(dev, ret, "failed to add the OPP table\n"); > + > + ret =3D devm_pm_runtime_enable(dev); > + if (ret) > + return ret; > + > + 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 qcom_cam_icc_icc_init(camnoc); > + if (ret) > + return dev_err_probe(dev, ret, "failed to register the interconnect pr= ovider\n"); [Severity: Medium] Can enabling runtime PM and publishing drvdata before qcom_cam_icc_irq_request() leave error interrupts disabled on runtime resume? qcom_cam_icc_link() uses platform_get_drvdata(pdev) to check whether this driver has finished probing before calling device_link_add() with DL_FLAG_PM_RUNTIME, which can immediately runtime-resume camnoc->dev while both devices are probing. If runtime resume runs between devm_pm_runtime_enable() and qcom_cam_icc_irq_request() (either via a concurrent qcom_cam_icc_link() caller or via sysfs), qcom_cam_icc_runtime_resume() -> qcom_cam_icc_irq_init() writes camnoc->irq_mask to data->sbm->enable_reg while camnoc->irq_mask is still 0. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130104955.1288= 089-1-atanas.filipov@oss.qualcomm.com?part=3D4