mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] scsi: ufs: core: check asymmetric connected lanes
       [not found] <CGME20241008062836epcas2p2caa5c41cf8fe4d1bfe5d923633ea2618@epcas2p2.samsung.com>
@ 2024-10-08  6:38 ` SEO HOYOUNG
  2024-10-08 17:42   ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: SEO HOYOUNG @ 2024-10-08  6:38 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, alim.akhtar, avri.altman, jejb,
	martin.petersen, beanhuo, bvanassche, kwangwon.min, kwmad.kim,
	sh425.lee, quic_nguyenb, cpgs, h10.kim, junwoo80.lee, wkon.kim
  Cc: SEO HOYOUNG

Performance problems may occur if there is a problem with the
asymmetric connected lane such as h/w failure.
Currently, only check connected lane for rx/tx is checked if it is not 0.
But it should also be checked if it is asymmetrically connected.

v1 -> v2: add error routine.
ufs initialization error occurs in case of asymmetic connected

Signed-off-by: SEO HOYOUNG <hy50.seo@samsung.com>
---
 drivers/ufs/core/ufshcd.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 24a32e2fd75e..1381eb7d506a 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4540,6 +4540,14 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *hba)
 		return -EINVAL;
 	}
 
+	if (pwr_info->lane_rx != pwr_info->lane_tx) {
+		dev_err(hba->dev, "%s: asymmetric connected lanes. rx=%d, tx=%d\n",
+			__func__,
+				pwr_info->lane_rx,
+				pwr_info->lane_tx);
+		return -EINVAL;
+	}
+
 	/*
 	 * First, get the maximum gears of HS speed.
 	 * If a zero value, it means there is no HSGEAR capability.
@@ -8579,7 +8587,8 @@ static int ufshcd_device_params_init(struct ufs_hba *hba)
 		hba->dev_info.f_power_on_wp_en = flag;
 
 	/* Probe maximum power mode co-supported by both UFS host and device */
-	if (ufshcd_get_max_pwr_mode(hba))
+	ret = ufshcd_get_max_pwr_mode(hba);
+	if (ret)
 		dev_err(hba->dev,
 			"%s: Failed getting max supported power mode\n",
 			__func__);
-- 
2.26.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] scsi: ufs: core: check asymmetric connected lanes
  2024-10-08  6:38 ` [PATCH v2] scsi: ufs: core: check asymmetric connected lanes SEO HOYOUNG
@ 2024-10-08 17:42   ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2024-10-08 17:42 UTC (permalink / raw)
  To: SEO HOYOUNG, linux-scsi, linux-kernel, alim.akhtar, avri.altman,
	jejb, martin.petersen, beanhuo, kwangwon.min, kwmad.kim,
	sh425.lee, quic_nguyenb, cpgs, h10.kim, junwoo80.lee, wkon.kim

On 10/7/24 11:38 PM, SEO HOYOUNG wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 24a32e2fd75e..1381eb7d506a 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4540,6 +4540,14 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *hba)
>   		return -EINVAL;
>   	}
>   
> +	if (pwr_info->lane_rx != pwr_info->lane_tx) {
> +		dev_err(hba->dev, "%s: asymmetric connected lanes. rx=%d, tx=%d\n",
> +			__func__,
> +				pwr_info->lane_rx,
> +				pwr_info->lane_tx);
> +		return -EINVAL;
> +	}
> +
>   	/*
>   	 * First, get the maximum gears of HS speed.
>   	 * If a zero value, it means there is no HSGEAR capability.
> @@ -8579,7 +8587,8 @@ static int ufshcd_device_params_init(struct ufs_hba *hba)
>   		hba->dev_info.f_power_on_wp_en = flag;
>   
>   	/* Probe maximum power mode co-supported by both UFS host and device */
> -	if (ufshcd_get_max_pwr_mode(hba))
> +	ret = ufshcd_get_max_pwr_mode(hba);
> +	if (ret)
>   		dev_err(hba->dev,
>   			"%s: Failed getting max supported power mode\n",
>   			__func__);

I see two independent changes in the above patch. Should this patch
perhaps be split into two patches?

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-08 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20241008062836epcas2p2caa5c41cf8fe4d1bfe5d923633ea2618@epcas2p2.samsung.com>
2024-10-08  6:38 ` [PATCH v2] scsi: ufs: core: check asymmetric connected lanes SEO HOYOUNG
2024-10-08 17:42   ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®