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=1796125516; b=tJ+0DFrYuYU7jFP4UECg2A16HIkugdhvf5GWL4+pLR2IGKk8gbWDPkv49fdNsrND6Fwx cQGajeIC25yNjytEply+u0I/V824mNN6WNie0AQ+z+kkbICswefLyXMR/fX/NJcG+ZIbK YOkTfpPBLypXvnYu2ABKY4bYm7NO12GZejrZsgWinmpIwMw8aHYIBRLLfGR0f0eJShIfo 7vM+XGXOvscoQ8wlbWzkZ/iyfpyzVhUgEji++sJxZHClskfLH0TbjbU13Bd1+EmXmOliE J9ehWCZS1lBxqiJWp+etT19ufN/6F737FFy66SGsfqBkK0y99mCPtVEexRd+lgVTHug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796125516; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=6smvMyVPExPRLf5tCeppgDG7bckOdgkskhKE2jZjNtw=; b=qPlJibokPvZmJXEuc/PRCIFWMIOcAH1LfYGqdNWYu8+zRI7Q5htMB/yH60r3kGCWepao ZuO7bxoDudJt6O8NsfxkojtMuXSRNuCT5juikDquuaJG8FWIPELJnx9QcEZMuFjci+G7F tpOgmBdovS5b6R7aUgC5ZbLlUrsOJaEQd1MeNpmW0brFuq4IFGkuasIXcpTFR6hX+xZYr ah9L6r6fNir8sBaJLMVoZFDmfBogp0My6kdanXcwvqyh06eSPTkQ9wtlbCZFr5p+gvBvv hd8VkTU7//AEeCKRYFrWY+awfAU7Ak4lL1JtbdtlbOU0O6O8Z0UPnpjwqFWHC8/th9g== 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=VpA4Cakp; 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 98BE2606A32C; Tue, 1 Dec 2026 11:45:16 +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=VpA4Cakp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E7DE1F000C1; Tue, 1 Dec 2026 11:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796125516; bh=6smvMyVPExPRLf5tCeppgDG7bckOdgkskhKE2jZjNtw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VpA4Cakp4ge2qBLxolhowiIVENH9Uv4HRUngoXlqrqAKorPQNqMBiWyiOCP9fIsUY C4vfVjxG6oscbDa/d/WoVvjVU3oPeRIK2u0y8lSNcUn8TFCNlj/8XLlV4q410HbD4l jPdnWKxYLnA3+HJkG1CW02GzNFTjMLEDwlXP4b0LcyXqqRsOk5BZC+QSzX+KqxsIs6 1SrFnNjmrs7Tpbd3a85cvWDaMfEFMHiwD8i+rycdmYIE7VrHD2fV5xNpKZjpHrWV+x hqei5k3gcqSuwmOIkuUGOm0ktTfykLRQ9hlPYhevX1KoS6Vy2WmdUX4YGfdQMpnmTJ vMjM6FWEMYBEA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 4/4] scsi: ufs: tegra: Add Tegra264 UFS host controller driver Reply-To: sashiko-reviews@lists.linux.dev To: "Kartik Rajput" Cc: linux-scsi@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261201-tegra264-ufs-v3-4-1d04d40388a4@nvidia.com> References: <20261201-tegra264-ufs-v3-0-1d04d40388a4@nvidia.com> <20261201-tegra264-ufs-v3-4-1d04d40388a4@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 11:45:15 +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 4 potential issues to consider: - [High] scsi: ufs: tegra: probe fails with -ENODEV in ufs_tegra_parse_clock_info() - [High] scsi: ufs: tegra: missing prepare and complete callbacks in ufs_tegra_pm_ops - [Medium] scsi: ufs: tegra: missing device_reset op leaves WriteBooster state stale - [Medium] scsi: ufs: tegra: missing reset assertion and aux cleanup in ufs_tegra_exit() -- commit 9955cb7a8be25d99221a19b3ca6c4dc209b70aaf Author: Kartik Rajput scsi: ufs: tegra: Add Tegra264 UFS host controller driver This commit adds a platform driver for the UFS host controller on NVIDIA Tegra264 SoCs, handling Tegra-specific auxiliary registers, clocks, resets, and M-PHY lane operations. > diff --git a/drivers/ufs/host/ufs-tegra.c b/drivers/ufs/host/ufs-tegra.c > new file mode 100644 > index 0000000000000..3819530e8371d > --- /dev/null > +++ b/drivers/ufs/host/ufs-tegra.c > @@ -0,0 +1,696 @@ [ ... ] > +static int ufs_tegra_parse_clock_info(struct ufs_hba *hba) > +{ > + struct ufs_tegra *ufs =3D ufshcd_get_variant(hba); > + struct ufs_clk_info *clki; > + > + list_for_each_entry(clki, &hba->clk_list_head, list) { > + if (!strcmp(clki->name, "core")) > + ufs->core_clk =3D clki->clk; > + > + if (!strcmp(clki->name, "hs")) > + ufs->hs_clk =3D clki->clk; > + } > + > + if (!ufs->core_clk || !ufs->hs_clk) > + return -ENODEV; > + > + return 0; > +} [Severity: High] Does ufs_tegra_parse_clock_info() always fail probe with -ENODEV on a Device Tree node matching Documentation/devicetree/bindings/ufs/nvidia,tegr= a264-ufs.yaml? In drivers/ufs/host/ufshcd-pltfrm.c, ufshcd_parse_clock_info() returns early without populating hba->clk_list_head unless the node specifies freq-table-hz, and ufshcd_parse_operating_points() does the same unless operating-points-v2 is present. Neither property is defined in the Tegra264 UFS binding (and UFS_TEGRA_HS_CLK_RATE_HZ at 5840000000UL does not fit in a 32-bit freq-table-hz cell or u32 clki->max_freq), so hba->clk_list_head stays empty, the controller clocks are never acquired or enabled by UFSHCD, and ufs->core_clk and ufs->hs_clk remain NULL. [ ... ] > +static int ufs_tegra_init(struct ufs_hba *hba) > +{ [ ... ] > + err =3D reset_control_bulk_deassert(ufs->num_resets, ufs->resets); > + if (err) > + return err; > + > + ufs_tegra_aux_init(hba); > + ufs_tegra_update_hclk_div(hba); > + > + return 0; > +} [ ... ] > +static void ufs_tegra_exit(struct ufs_hba *hba) > +{ > + ufs_tegra_mphy_disable(hba); > +} [Severity: Medium] Should ufs_tegra_exit() also clear DEV_CTRL_CLK_EN | DEV_CTRL_RESET in UFSHC_AUX_DEV_CTRL and assert ufs->resets? ufs_tegra_init() deasserts the exclusive bulk resets and enables the auxiliary device clock and reset line via ufs_tegra_aux_init(). When ufshcd_init() fails after ufshcd_hba_init() or the driver is unbound, ufshcd_hba_exit() calls ufs_tegra_exit() and then turns off the clocks and regulators while UFSHC_AUX_DEV_CTRL remains enabled and the controller resets remain deasserted. [ ... ] > +static int ufs_tegra_hce_enable_notify(struct ufs_hba *hba, enum ufs_not= ify_change_status status) > +{ > + struct ufs_tegra *ufs =3D ufshcd_get_variant(hba); > + u32 value; > + int err; > + > + switch (status) { > + case PRE_CHANGE: > + err =3D ufs_tegra_power_up_sequence(hba); > + if (err) > + return err; > + > + /* > + * Assert device reset; POST_CHANGE releases it via > + * ufs_tegra_configure_aux() so the HCE toggle pulses it. > + */ > + value =3D readl(ufs->aux + UFSHC_AUX_DEV_CTRL); > + value &=3D ~DEV_CTRL_RESET; > + writel(value, ufs->aux + UFSHC_AUX_DEV_CTRL); > + break; > + case POST_CHANGE: > + value =3D readl(ufs->aux + UFSHC_AUX_SW_EN_CLK_SLCG); > + value &=3D ~CLK_OVR_ON; > + writel(value, ufs->aux + UFSHC_AUX_SW_EN_CLK_SLCG); > + > + ufs_tegra_setup(hba); > + break; > + default: > + return -EINVAL; > + } > + > + return 0; > +} [ ... ] > +static const struct ufs_hba_variant_ops ufs_tegra_vops =3D { > + .name =3D "ufs-tegra", > + .init =3D ufs_tegra_init, > + .exit =3D ufs_tegra_exit, > + .suspend =3D ufs_tegra_suspend, > + .resume =3D ufs_tegra_resume, > + .hce_enable_notify =3D ufs_tegra_hce_enable_notify, > + .negotiate_pwr_mode =3D ufs_tegra_negotiate_pwr_mode, > + .pwr_change_notify =3D ufs_tegra_pwr_change_notify, > + .link_startup_notify =3D ufs_tegra_link_startup_notify, > + .set_dma_mask =3D ufs_tegra_set_dma_mask, > +}; [Severity: Medium] Does pulsing DEV_CTRL_RESET in ufs_tegra_hce_enable_notify() without implementing .device_reset in ufs_tegra_vops leave WriteBooster disabled after system resume or host error recovery? ufs_tegra_set_caps() enables UFSHCD_CAP_WB_EN and sets hba->spm_lvl to UFS_PM_LVL_5. On resume from UFS_PM_LVL_5 (or during error recovery), ufshcd_reset_and_restore() calls ufshcd_device_reset(), which only clears hba->dev_info.wb_enabled and hba->dev_info.wb_buf_flush_enabled and marks the device active when vops->device_reset is implemented: drivers/ufs/core/ufshcd.c:ufshcd_device_reset() { ... err =3D ufshcd_vops_device_reset(hba); if (!err) { ufshcd_set_ufs_dev_active(hba); if (ufshcd_is_wb_allowed(hba)) { hba->dev_info.wb_enabled =3D false; hba->dev_info.wb_buf_flush_enabled =3D false; } ... } Because ufs_tegra_hce_enable_notify() then hardware-resets the UFS device via DEV_CTRL_RESET, the volatile WriteBooster flags on the device are cleared while hba->dev_info.wb_enabled stays true in software, causing ufshcd_wb_toggle() to return early without re-enabling WriteBooster. Leaving hba->curr_dev_pwr_mode at UFS_POWERDOWN_PWR_MODE also makes ufshcd_link_startup() set link_startup_again =3D true and run link startup twice. [ ... ] > +static const struct dev_pm_ops ufs_tegra_pm_ops =3D { > + SET_SYSTEM_SLEEP_PM_OPS(ufshcd_system_suspend, ufshcd_system_resume) > + SET_RUNTIME_PM_OPS(ufshcd_runtime_suspend, ufshcd_runtime_resume, NULL) > +}; [Severity: High] Does omitting .prepare =3D ufshcd_suspend_prepare and .complete =3D ufshcd_resume_complete from ufs_tegra_pm_ops break system suspend when the controller is already runtime-suspended? ufs_tegra_set_caps() sets hba->spm_lvl =3D UFS_PM_LVL_5 (UIC_LINK_OFF_STATE) while hba->rpm_lvl stays at the default UFS_PM_LVL_3 (UIC_LINK_HIBERN8_STATE), where ufs_tegra_suspend() leaves the M-PHY powered on during runtime suspend. When the UFS device W-LUN is already runtime-suspended, ufshcd_wl_system_suspend() and ufshcd_system_suspend() both return early without running __ufshcd_wl_suspend(hba, UFS_SYSTEM_PM) unless ufshcd_suspend_prepare() first runtime-resumes the W-LUN because rpm_lvl and spm_lvl differ. As a result, ufs_tegra_suspend() is never called for UFS_SYSTEM_PM, the M-PHY stays powered on during system sleep, and hba->uic_link_state remains UIC_LINK_HIBERN8_STATE instead of UIC_LINK_OFF_STATE. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-tegra264-u= fs-v3-0-1d04d40388a4@nvidia.com?part=3D4