All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Larisa Grigore" <larisa.grigore@oss.nxp.com>
Cc: linux-scsi@vger.kernel.org, imx@lists.linux.dev,
	devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	Frank.Li@kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH v12 05/14] ufs: core: Add common Hibern8 TX FSM polling helper
Date: Fri, 04 Dec 2026 08:45:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-249427@kernel.org> (raw)
In-Reply-To: <20261204-b4-ufs-s32n7-v12-5-4cf32fc871a0@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ufs: duplicated TX_FSM_STATE read loop in
  ufshcd_dme_check_tx_hibern8()
--

commit 35f7d43025bd68ab336cf438a36fd36afca394df
Author: Larisa Grigore <larisa.grigore@oss.nxp.com>

ufs: core: Add common Hibern8 TX FSM polling helper

This commit factors out the Hibern8 TX_FSM_STATE polling logic into a common
ufshcd_dme_check_tx_hibern8() helper and switches the HiSilicon and Qualcomm
UFS drivers to use it.

> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index a6817e4bd1f83..9b893e4ada191 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4494,6 +4494,103 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,

[ ... ]

> +static int ufshcd_tx_lanes_in_hibern8(struct ufs_hba *hba,
> +				      unsigned int num_lanes)
> +{
> +	u32 tx_fsm_val = 0;
> +	unsigned int i;
> +	int err;
> +
> +	for (i = 0; i < num_lanes; i++) {
> +		err = ufshcd_dme_get(hba,
> +				     UIC_ARG_MIB_SEL(TX_FSM_STATE,
> +						     UIC_ARG_MPHY_TX_GEN_SEL_INDEX(i)),
> +				     &tx_fsm_val);
> +		if (err) {
> +			dev_err(hba->dev,
> +				"%s: unable to get TX_FSM_STATE for lane %u, err %d\n",
> +				__func__, i, err);
> +			/* A positive value is a UIC result code, not an errno. */
> +			return err > 0 ? -EIO : err;
> +		}
> +
> +		if (tx_fsm_val != UFS_TX_STATE_HIBERN8)
> +			return -EAGAIN;
> +	}
> +
> +	return 0;
> +}

[ ... ]

> +	ret = 0;
> +	for (i = 0; i < num_lanes; i++) {
> +		err = ufshcd_dme_get(hba,
> +				     UIC_ARG_MIB_SEL(TX_FSM_STATE,
> +						     UIC_ARG_MPHY_TX_GEN_SEL_INDEX(i)),
> +				     &state);
> +		if (err) {
> +			dev_err(hba->dev,
> +				"%s: unable to get TX_FSM_STATE for lane %u, err %d\n",
> +				__func__, i, err);
> +			/* A positive value is a UIC result code, not an errno. */
> +			return err > 0 ? -EIO : err;
> +		}
> +		if (state != UFS_TX_STATE_HIBERN8) {
> +			dev_err(hba->dev,
> +				"%s: TX lane %u stuck in TX_FSM_STATE %u\n",
> +				__func__, i, state);
> +			ret = -ETIMEDOUT;
> +		}
> +	}

[Severity: Low]
As reported by Bart Van Assche on v1 [1], the per-lane TX_FSM_STATE DME
read, error logging, and positive UIC result to -EIO translation are
duplicated between ufshcd_tx_lanes_in_hibern8() and the timeout path of
ufshcd_dme_check_tx_hibern8().  Could this be shared via a small helper
or a parameter to ufshcd_tx_lanes_in_hibern8() (for example, to log
stuck lanes on timeout)?

[1] https://lore.kernel.org/r/4af1df20-f6e4-4559-9cc0-e4db05597090@acm.org

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-b4-ufs-s32n7-v12-0-4cf32fc871a0@oss.nxp.com?part=5

  reply	other threads:[~2026-12-04  8:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:35 [PATCH v12 00/14] Add S32N79RDB UFS support Larisa Grigore
2026-12-04  8:35 ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 01/14] ufs: core: Return a negative errno from WLUN suspend/resume Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 02/14] ufs: dwc: Return a negative error if the link is down Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 03/14] ufs: unipro: Move Tx/Rx FSM state definitions to unipro.h Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 04/14] ufs: unipro: Add TX/RX FSM state attributes Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 05/14] ufs: core: Add common Hibern8 TX FSM polling helper Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:45   ` sashiko-bot [this message]
2026-12-04  8:35 ` [PATCH v12 06/14] ufs: dwc: Move Versal2 M-PHY CREG access helpers into ufshcd-dwc Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 07/14] ufs: dwc: Export common clock divider and link status helpers Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 08/14] ufs: dwc: Sort CBCRCTRL and CBREFCLKCTRL2 by offset Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 09/14] ufs: dwc: Move shared M-PHY CR bitfield macros to ufshcd-dwc.h Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 10/14] ufs: pltfrm: Add a flags argument to ufshcd_pltfrm_init() Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 11/14] ufs: pltfrm: Add a flag to manage fixed rate clocks Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:35 ` [PATCH v12 12/14] dt-bindings: ufs: Add NXP S32N79 UFS host controller Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  8:46   ` sashiko-bot
2026-12-04 14:41   ` Rob Herring (Arm)
2026-12-04 14:41     ` Rob Herring (Arm)
2026-12-04  8:35 ` [PATCH v12 13/14] ufs: s32n7: Add NXP S32N79 UFS host controller driver Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore
2026-12-04  9:03   ` sashiko-bot
2026-12-04  8:35 ` [PATCH v12 14/14] MAINTAINERS: Add NXP S32N7 UFS host controller entry Larisa Grigore
2026-12-04  8:35   ` Larisa Grigore

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-249427@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=larisa.grigore@oss.nxp.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.