Skip to contentSkip to conversation

ufs: qcom: drop custom Android boot parameters

RFT Krzysztof Kozlowski 6 participants 7 messages Mar 20, 2022 – Mar 21, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/[email protected]/T/#u

---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -15
index 0d2e950d0865..586c0e567ff9 100644
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
-		return -ENODEV;
-
 	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
 		err = -ENOMEM;
Signature · 1 line
2.32.0
Tested-by
#1 lore raw
Quoted 10 lines · Krzysztof Kozlowski

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

No obvious regression on QCOM devboards DB845c (sdm845) and RB5 (sm8250), and Xiaomi Pocophone F1 (sdm845) running AOSP.

Quoted 49 lines

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/[email protected]/T/#u

---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -16
index 0d2e950d0865..586c0e567ff9 100644
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
        .deassert = ufs_qcom_reset_deassert,
 };
 
-#define        ANDROID_BOOT_DEV_MAX    30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-       strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-       return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
        struct resource *res;
        struct ufs_clk_info *clki;
 
-       if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
-               return -ENODEV;
-
        host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
        if (!host) {
                err = -ENOMEM;
--

2.32.0

#2 lore raw
In reply to Krzysztof Kozlowski
Quoted 15 lines

-----Original Message-----
From: Krzysztof Kozlowski [mailto:[email protected]]
Sent: Sunday, March 20, 2022 4:36 PM
To: Andy Gross <[email protected]>; Bjorn Andersson <[email protected]>; Alim Akhtar <[email protected]>; Avri Altman <[email protected]>; James E.J. Bottomley <[email protected]>; Martin K. Petersen <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Cc: Krzysztof Kozlowski <[email protected]>; Luca Weiss <[email protected]>
Subject: [RFT] ufs: qcom: drop custom Android boot parameters

Quoted 2 lines

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it

refuses

Quoted 1 line

to probe. Thise androidboot.bootdevice is provided by stock/vendor (from

an

In case you are resending
s/thise/this

Rest looks good.

Quoted 3 lines

Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able

to

drivers/scsi/ufs/ufs-qcom.c

Quoted 18 lines

boot regardless of bootloader. Driver should not depend on some Android custom environment data.

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/f61abc2b-3ce8-7b1f-3d28-
[email protected]/T/#u
---
drivers/scsi/ufs/ufs-qcom.c | 15 ---------------

1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -0

index

Quoted 34 lines

0d2e950d0865..586c0e567ff9 100644

drivers/scsi/ufs/ufs-qcom.c +0 -13
@@ -957,18 +957,6 @@ static const struct reset_control_ops
 ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str) -{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev); -#endif
-
 /**
 * ufs_qcom_init - bind phy with controller
 * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	if (strlen(android_boot_dev) && strcmp(android_boot_dev,
 dev_name(dev)))
-		return -ENODEV;
-
 	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
		err = -ENOMEM;

--
2.32.0

Tested-by
#3 lore raw
In reply to Krzysztof Kozlowski

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

As expected this makes UFS probe even if the node is named ufs@1d84000 on my device.

While I don't know why the code existed in the first place, it was added back in 2015 with the introduction of the driver, so probably it's just some remains from downstream that weren't cleaned up back then.

With this commit also 6b9afd8f96c6 ("arm64: dts: qcom: sm8250: change ufs node name to ufshc") could be reverted (but it would probably make more sense to rename all ufshc@ to ufs@ in a new commit).

Regards
Luca

Quoted 46 lines

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/[email protected]/T/#u

---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -15
index 0d2e950d0865..586c0e567ff9 100644
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
-		return -ENODEV;
-
 	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
 		err = -ENOMEM;
Signature · 1 line
2.32.0
#4 lore raw

Hi all again,

Quoted 15 lines · Luca Weiss

Hi Krzysztof,

Quoted 11 lines · Krzysztof Kozlowski

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

Quoted 6 lines

As expected this makes UFS probe even if the node is named ufs@1d84000 on my device.

While I don't know why the code existed in the first place, it was added back in 2015 with the introduction of the driver, so probably it's just some remains from downstream that weren't cleaned up back then.

I went digging a bit and found the original commit from downstream:
https://source.codeaurora.org/quic/la/kernel/msm-3.18/commit/?id=15e2c78d6a7ec73be941e058671942fd9f72b128

<quote>
Boot device can be either UFS or eMMC which means if eMMC is the boot device, probing UFS device is not desirable as it's not going to be used after probing. Kernel command line parameter "android.bootdevice" tells the kernel about the boot device so look at this boot device parameter to know whether to probe UFS device or not. </quote>

Should be safe to remove.

Regards
Luca

Quoted 56 lines

With this commit also 6b9afd8f96c6 ("arm64: dts: qcom: sm8250: change ufs node name to ufshc") could be reverted (but it would probably make more sense to rename all ufshc@ to ufs@ in a new commit).

Regards
Luca

Quoted 46 lines

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/[email protected]/T/#u

---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -15
index 0d2e950d0865..586c0e567ff9 100644
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
-		return -ENODEV;
-
 	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
 		err = -ENOMEM;
Signature · 1 line
2.32.0
Reviewed-by
#5 lore raw
In reply to Krzysztof Kozlowski
Quoted 11 lines · Krzysztof Kozlowski

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

I encountered that same code a few months ago and thought then that this code doesn't belong here.

Reviewed-by
#6 lore raw
In reply to Krzysztof Kozlowski
Quoted 5 lines · Krzysztof Kozlowski

The QCOM UFS driver requires an androidboot.bootdevice command line argument matching the UFS device name. If the name is different, it refuses to probe. Thise androidboot.bootdevice is provided by stock/vendor (from an Android-based device) bootloader.

Quoted 7 lines

This does not make sense from Linux point of view. Driver should be able to boot regardless of bootloader. Driver should not depend on some Android custom environment data.

Quoted 46 lines

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/[email protected]/T/#u

---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +0 -15
index 0d2e950d0865..586c0e567ff9 100644
@@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
-		return -ENODEV;
-
 	host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
 	if (!host) {
 		err = -ENOMEM;
Signature · 1 line
2.32.0