Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737398 > unrolled thread

[PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled

Started byHuanlin Ke <chgokhl@gmail.com>
First post2017-09-22 12:40 +0200
Last post2017-09-28 03:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled Huanlin Ke <chgokhl@gmail.com> - 2017-09-22 12:40 +0200
    Re: [PATCH] scsi: ufs: continue to boot even with Boot LUN is  disabled Subhash Jadavani <subhashj@codeaurora.org> - 2017-09-26 23:40 +0200
    Re: [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled "Martin K. Petersen" <martin.petersen@oracle.com> - 2017-09-28 03:50 +0200

#1737398 — [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled

FromHuanlin Ke <chgokhl@gmail.com>
Date2017-09-22 12:40 +0200
Subject[PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled
Message-ID<ustxg-4ZS-9@gated-at.bofh.it>
Several configurable fields of the Device Descriptor and the Unit
Descriptors determine the Boot LUN status. The bBootEnable field and
the bBootLunEn attribute is set to zero by default, so the Boot LUN is
disabled by default.

At which point the scsi device add for Boot LUN will fail, but we can
continue to use the ufs device in fact. This failure shouldn't abort the
device boot.

Signed-off-by: Huanlin Ke <kehuanlin@pinecone.net>
---
 drivers/scsi/ufs/ufshcd.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 794a460..bff84be 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5998,25 +5998,22 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
 	}
 	scsi_device_put(hba->sdev_ufs_device);
 
-	sdev_boot = __scsi_add_device(hba->host, 0, 0,
-		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
-	if (IS_ERR(sdev_boot)) {
-		ret = PTR_ERR(sdev_boot);
-		goto remove_sdev_ufs_device;
-	}
-	scsi_device_put(sdev_boot);
-
 	sdev_rpmb = __scsi_add_device(hba->host, 0, 0,
 		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL);
 	if (IS_ERR(sdev_rpmb)) {
 		ret = PTR_ERR(sdev_rpmb);
-		goto remove_sdev_boot;
+		goto remove_sdev_ufs_device;
 	}
 	scsi_device_put(sdev_rpmb);
+
+	sdev_boot = __scsi_add_device(hba->host, 0, 0,
+		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
+	if (IS_ERR(sdev_boot))
+		dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__);
+	else
+		scsi_device_put(sdev_boot);
 	goto out;
 
-remove_sdev_boot:
-	scsi_remove_device(sdev_boot);
 remove_sdev_ufs_device:
 	scsi_remove_device(hba->sdev_ufs_device);
 out:
-- 
2.7.4

[toc] | [next] | [standalone]


#1740222 — Re: [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled

FromSubhash Jadavani <subhashj@codeaurora.org>
Date2017-09-26 23:40 +0200
SubjectRe: [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled
Message-ID<uu5K9-1HA-5@gated-at.bofh.it>
In reply to#1737398
On 2017-09-22 03:31, Huanlin Ke wrote:
> Several configurable fields of the Device Descriptor and the Unit
> Descriptors determine the Boot LUN status. The bBootEnable field and
> the bBootLunEn attribute is set to zero by default, so the Boot LUN is
> disabled by default.
> 
> At which point the scsi device add for Boot LUN will fail, but we can
> continue to use the ufs device in fact. This failure shouldn't abort 
> the
> device boot.
> 
> Signed-off-by: Huanlin Ke <kehuanlin@pinecone.net>
> ---
>  drivers/scsi/ufs/ufshcd.c | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 794a460..bff84be 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -5998,25 +5998,22 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba 
> *hba)
>  	}
>  	scsi_device_put(hba->sdev_ufs_device);
> 
> -	sdev_boot = __scsi_add_device(hba->host, 0, 0,
> -		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
> -	if (IS_ERR(sdev_boot)) {
> -		ret = PTR_ERR(sdev_boot);
> -		goto remove_sdev_ufs_device;
> -	}
> -	scsi_device_put(sdev_boot);
> -
>  	sdev_rpmb = __scsi_add_device(hba->host, 0, 0,
>  		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL);
>  	if (IS_ERR(sdev_rpmb)) {
>  		ret = PTR_ERR(sdev_rpmb);
> -		goto remove_sdev_boot;
> +		goto remove_sdev_ufs_device;
>  	}
>  	scsi_device_put(sdev_rpmb);
> +
> +	sdev_boot = __scsi_add_device(hba->host, 0, 0,
> +		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
> +	if (IS_ERR(sdev_boot))
> +		dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__);
> +	else
> +		scsi_device_put(sdev_boot);
>  	goto out;
> 
> -remove_sdev_boot:
> -	scsi_remove_device(sdev_boot);
>  remove_sdev_ufs_device:
>  	scsi_remove_device(hba->sdev_ufs_device);
>  out:

Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1741124

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2017-09-28 03:50 +0200
Message-ID<uuw7E-2ov-3@gated-at.bofh.it>
In reply to#1737398
Huanlin,

> Several configurable fields of the Device Descriptor and the Unit
> Descriptors determine the Boot LUN status. The bBootEnable field and
> the bBootLunEn attribute is set to zero by default, so the Boot LUN is
> disabled by default.
>
> At which point the scsi device add for Boot LUN will fail, but we can
> continue to use the ufs device in fact. This failure shouldn't abort the
> device boot.

Applied to 4.15/scsi-queue. Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web