[PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls

Nitin Rawat posted 10 patches 6 months, 3 weeks ago
[PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Nitin Rawat 6 months, 3 weeks ago
Commit 3f6d1767b1a0 ("phy: ufs-qcom: Refactor all init steps into
phy_poweron") moved the phy_power_on/off from ufs_qcom_setup_clocks
to suspend/resume func.

To have a better power saving, remove the phy_power_on/off calls from
resume/suspend path and put them back to ufs_qcom_setup_clocks, so that
PHY regulators & clks can be turned on/off along with UFS's clocks.

Since phy phy_power_on is separated out from phy calibrate, make
separate calls to phy_power_on calls from ufs qcom driver.

Co-developed-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Can Guo <quic_cang@quicinc.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 58 +++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 31 deletions(-)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index dfe164da3668..1b313c1c530f 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -696,26 +696,17 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
 	enum ufs_notify_change_status status)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;

 	if (status == PRE_CHANGE)
 		return 0;

-	if (ufs_qcom_is_link_off(hba)) {
-		/*
-		 * Disable the tx/rx lane symbol clocks before PHY is
-		 * powered down as the PLL source should be disabled
-		 * after downstream clocks are disabled.
-		 */
+	if (!ufs_qcom_is_link_active(hba))
 		ufs_qcom_disable_lane_clks(host);
-		phy_power_off(phy);

-		/* reset the connected UFS device during power down */
-		ufs_qcom_device_reset_ctrl(hba, true);

-	} else if (!ufs_qcom_is_link_active(hba)) {
-		ufs_qcom_disable_lane_clks(host);
-	}
+	/* reset the connected UFS device during power down */
+	if (ufs_qcom_is_link_off(hba) && host->device_reset)
+		ufs_qcom_device_reset_ctrl(hba, true);

 	return ufs_qcom_ice_suspend(host);
 }
@@ -723,26 +714,11 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
 static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
 	int err;

-	if (ufs_qcom_is_link_off(hba)) {
-		err = phy_power_on(phy);
-		if (err) {
-			dev_err(hba->dev, "%s: failed PHY power on: %d\n",
-				__func__, err);
-			return err;
-		}
-
-		err = ufs_qcom_enable_lane_clks(host);
-		if (err)
-			return err;
-
-	} else if (!ufs_qcom_is_link_active(hba)) {
-		err = ufs_qcom_enable_lane_clks(host);
-		if (err)
-			return err;
-	}
+	err = ufs_qcom_enable_lane_clks(host);
+	if (err)
+		return err;

 	return ufs_qcom_ice_resume(host);
 }
@@ -1132,12 +1108,20 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba)
  * @on: If true, enable clocks else disable them.
  * @status: PRE_CHANGE or POST_CHANGE notify
  *
+ * There are certain clocks which comes from the PHY so it needs
+ * to be managed together along with controller clocks which also
+ * provides a better power saving. Hence keep phy_power_off/on calls
+ * in ufs_qcom_setup_clocks, so that PHY's regulators & clks can be
+ * turned on/off along with UFS's clocks.
+ *
  * Return: 0 on success, non-zero on failure.
  */
 static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
 				 enum ufs_notify_change_status status)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
+	struct phy *phy = host->generic_phy;
+	int err;

 	/*
 	 * In case ufs_qcom_init() is not yet done, simply ignore.
@@ -1156,10 +1140,22 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
 				/* disable device ref_clk */
 				ufs_qcom_dev_ref_clk_ctrl(host, false);
 			}
+
+			err = phy_power_off(phy);
+			if (err) {
+				dev_err(hba->dev, "phy power off failed, ret=%d\n", err);
+				return err;
+			}
 		}
 		break;
 	case POST_CHANGE:
 		if (on) {
+			err = phy_power_on(phy);
+			if (err) {
+				dev_err(hba->dev, "phy power on failed, ret = %d\n", err);
+				return err;
+			}
+
 			/* enable the device ref clock for HS mode*/
 			if (ufshcd_is_hs_mode(&hba->pwr_info))
 				ufs_qcom_dev_ref_clk_ctrl(host, true);
--
2.48.1
Re: [PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Aishwarya 6 months ago
Hi Nitin,

When booting the kernel from next-20250619 on Arm64 Qualcomm boards
(RB5 and DB845C), we observe that the baseline bootr test fails due to
dmesg.emerg errors in our CI environment.

A full git bisect (log included below) points to this patch as the
culprit. The issue was introduced sometime from tag next-20250616 in
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git.

This issue is not present in v6.16-rc2

Here’s a sample of the failure observed on the RB5 board:
lert :   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
kern  :alert :   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
kern  :alert :   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
kern  :alert : user pgtable: 4k pages, 48-bit VAs, pgdp=0000000102c4c000
kern  :alert : [0000000000000000] pgd=0000000000000000
kern  :emerg : Internal error: Oops: 0000000096000004 [#1]  SMP
kern  :emerg : Code: a90157f3 aa0003f3 f90013f6 f9405c15 (f94002b6) 
<8>[   30.933289] <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=emerg RESULT=fail UNITS=lines MEASUREMENT=2>
+ <8>[   30.943798] <LAVA_SIGNAL_ENDRUN 0_dmesg 1000325_2.4.4.1>
set +x

Git bisection log:
git bisect start
# status: waiting for both good and bad commits
# good: [9afe652958c3ee88f24df1e4a97f298afce89407] Merge tag 'x86_urgent_for_6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 9afe652958c3ee88f24df1e4a97f298afce89407
# status: waiting for bad commit, 1 good commit known
# bad: [4325743c7e209ae7845293679a4de94b969f2bef] Add linux-next specific files for 20250617
git bisect bad 4325743c7e209ae7845293679a4de94b969f2bef
# good: [436c8cbbcb18deb96100cd9f33f1efedddc31d9c] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
git bisect good 436c8cbbcb18deb96100cd9f33f1efedddc31d9c
# good: [183d224083773ca4a84a458fb608efecff19e19e] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
git bisect good 183d224083773ca4a84a458fb608efecff19e19e
# good: [1347ff0c0e510f1a6adb78259a2a0ddfac41d258] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git
git bisect good 1347ff0c0e510f1a6adb78259a2a0ddfac41d258
# bad: [b09bd04eabb1994257f4c11d0ed25ff03517d3ec] Merge branch 'gpio/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
git bisect bad b09bd04eabb1994257f4c11d0ed25ff03517d3ec
# good: [70bc9e18653c20fbcb47184d9498ad7bd7b7d6be] Merge branch 'togreg' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git bisect good 70bc9e18653c20fbcb47184d9498ad7bd7b7d6be
# bad: [3a847fb85c9d47e61ad5d9d54b762a3e99a08084] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
git bisect bad 3a847fb85c9d47e61ad5d9d54b762a3e99a08084
# skip: [50355ac70d4f104e2f82bfbd0658c129027ebb37] dt-bindings: phy: Convert marvell,comphy-cp110 to DT schema
git bisect skip 50355ac70d4f104e2f82bfbd0658c129027ebb37
# good: [acc6b0d73d902d3296d8c77878a9b508c2c6a5bf] phy: qcom-qmp-ufs: Rename qmp_ufs_power_off
git bisect good acc6b0d73d902d3296d8c77878a9b508c2c6a5bf
# bad: [35b629b28afd72a14ed573f1b180dc4ab1bf7e19] dt-bindings: phy: Convert ti,dm816x-usb-phy to DT schema
git bisect bad 35b629b28afd72a14ed573f1b180dc4ab1bf7e19
# bad: [66acaf8f6b0bcc273f8356b2a77baa90b177014c] dt-bindings: phy: Convert img,pistachio-usb-phy to DT schema
git bisect bad 66acaf8f6b0bcc273f8356b2a77baa90b177014c
# bad: [f151f3a6ebe184b5f8c9abe58fe2d63f9950139b] dt-bindings: phy: Convert brcm,ns2-drd-phy to DT schema
git bisect bad f151f3a6ebe184b5f8c9abe58fe2d63f9950139b
# bad: [77d2fa54a94574f767d5fb296b6b8e011eba0c8e] scsi: ufs: qcom : Refactor phy_power_on/off calls
git bisect bad 77d2fa54a94574f767d5fb296b6b8e011eba0c8e
# good: [7f600f0e193a6638135026c3718ac296ed3f5044] phy: qcom-qmp-ufs: Remove qmp_ufs_exit() and Inline qmp_ufs_com_exit()
git bisect good 7f600f0e193a6638135026c3718ac296ed3f5044
# good: [a079b2d715340482e425ff136b55810ab8279800] phy: qcom-qmp-ufs: refactor qmp_ufs_power_off
git bisect good a079b2d715340482e425ff136b55810ab8279800
# first bad commit: [77d2fa54a94574f767d5fb296b6b8e011eba0c8e] scsi: ufs: qcom : Refactor phy_power_on/off calls

Thanks,
Aishwarya
Re: [PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Nitin Rawat 6 months ago
On 6/19/2025 7:23 PM, Aishwarya wrote:
> Hi Nitin,
> 
> When booting the kernel from next-20250619 on Arm64 Qualcomm boards
> (RB5 and DB845C), we observe that the baseline bootr test fails due to
> dmesg.emerg errors in our CI environment.
> 
> A full git bisect (log included below) points to this patch as the
> culprit. The issue was introduced sometime from tag next-20250616 in
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git.


Hi Aishwarya,

I tested booting the QRB5165 using the qrb5165-rb5.dtb with the latest 
upstream tip multiple times, and each time it successfully booted to the 
shell without any issues.

Are you encountering a boot failure, or is there a specific test case 
you're running that triggers the problem? If so, could you please share 
the dmesg log to help check further.

Thanks,
Nitin

> 
> This issue is not present in v6.16-rc2
> 
> Here’s a sample of the failure observed on the RB5 board:
> lert :   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
> kern  :alert :   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> kern  :alert :   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> kern  :alert : user pgtable: 4k pages, 48-bit VAs, pgdp=0000000102c4c000
> kern  :alert : [0000000000000000] pgd=0000000000000000
> kern  :emerg : Internal error: Oops: 0000000096000004 [#1]  SMP
> kern  :emerg : Code: a90157f3 aa0003f3 f90013f6 f9405c15 (f94002b6)
> <8>[   30.933289] <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=emerg RESULT=fail UNITS=lines MEASUREMENT=2>
> + <8>[   30.943798] <LAVA_SIGNAL_ENDRUN 0_dmesg 1000325_2.4.4.1>
> set +x
> 
> Git bisection log:
> git bisect start
> # status: waiting for both good and bad commits
> # good: [9afe652958c3ee88f24df1e4a97f298afce89407] Merge tag 'x86_urgent_for_6.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> git bisect good 9afe652958c3ee88f24df1e4a97f298afce89407
> # status: waiting for bad commit, 1 good commit known
> # bad: [4325743c7e209ae7845293679a4de94b969f2bef] Add linux-next specific files for 20250617
> git bisect bad 4325743c7e209ae7845293679a4de94b969f2bef
> # good: [436c8cbbcb18deb96100cd9f33f1efedddc31d9c] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git
> git bisect good 436c8cbbcb18deb96100cd9f33f1efedddc31d9c
> # good: [183d224083773ca4a84a458fb608efecff19e19e] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git
> git bisect good 183d224083773ca4a84a458fb608efecff19e19e
> # good: [1347ff0c0e510f1a6adb78259a2a0ddfac41d258] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git
> git bisect good 1347ff0c0e510f1a6adb78259a2a0ddfac41d258
> # bad: [b09bd04eabb1994257f4c11d0ed25ff03517d3ec] Merge branch 'gpio/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
> git bisect bad b09bd04eabb1994257f4c11d0ed25ff03517d3ec
> # good: [70bc9e18653c20fbcb47184d9498ad7bd7b7d6be] Merge branch 'togreg' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
> git bisect good 70bc9e18653c20fbcb47184d9498ad7bd7b7d6be
> # bad: [3a847fb85c9d47e61ad5d9d54b762a3e99a08084] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git
> git bisect bad 3a847fb85c9d47e61ad5d9d54b762a3e99a08084
> # skip: [50355ac70d4f104e2f82bfbd0658c129027ebb37] dt-bindings: phy: Convert marvell,comphy-cp110 to DT schema
> git bisect skip 50355ac70d4f104e2f82bfbd0658c129027ebb37
> # good: [acc6b0d73d902d3296d8c77878a9b508c2c6a5bf] phy: qcom-qmp-ufs: Rename qmp_ufs_power_off
> git bisect good acc6b0d73d902d3296d8c77878a9b508c2c6a5bf
> # bad: [35b629b28afd72a14ed573f1b180dc4ab1bf7e19] dt-bindings: phy: Convert ti,dm816x-usb-phy to DT schema
> git bisect bad 35b629b28afd72a14ed573f1b180dc4ab1bf7e19
> # bad: [66acaf8f6b0bcc273f8356b2a77baa90b177014c] dt-bindings: phy: Convert img,pistachio-usb-phy to DT schema
> git bisect bad 66acaf8f6b0bcc273f8356b2a77baa90b177014c
> # bad: [f151f3a6ebe184b5f8c9abe58fe2d63f9950139b] dt-bindings: phy: Convert brcm,ns2-drd-phy to DT schema
> git bisect bad f151f3a6ebe184b5f8c9abe58fe2d63f9950139b
> # bad: [77d2fa54a94574f767d5fb296b6b8e011eba0c8e] scsi: ufs: qcom : Refactor phy_power_on/off calls
> git bisect bad 77d2fa54a94574f767d5fb296b6b8e011eba0c8e
> # good: [7f600f0e193a6638135026c3718ac296ed3f5044] phy: qcom-qmp-ufs: Remove qmp_ufs_exit() and Inline qmp_ufs_com_exit()
> git bisect good 7f600f0e193a6638135026c3718ac296ed3f5044
> # good: [a079b2d715340482e425ff136b55810ab8279800] phy: qcom-qmp-ufs: refactor qmp_ufs_power_off
> git bisect good a079b2d715340482e425ff136b55810ab8279800
> # first bad commit: [77d2fa54a94574f767d5fb296b6b8e011eba0c8e] scsi: ufs: qcom : Refactor phy_power_on/off calls
> 
> Thanks,
> Aishwarya

Re: [PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Aishwarya 6 months ago
Hi Nitin,

To clarify — the defconfig kernel does boot successfully on our Arm64
Qualcomm platforms (RB5 and DB845C). However, starting from
next-20250613, we are seeing the following three test failures in the
`bootrr` baseline test in our CI environment:

  - baseline.bootrr.scsi-disk-device0-probed
  - dmesg.alert
  - dmesg.emerg

Test suite:
  https://github.com/kernelci/bootrr/tree/main

These failures are due to kernel alerts seen in the boot logs. A relevant
snippet is shown below:

  kern  :alert : Unable to handle kernel NULL pointer dereference at
  virtual address 0000000000000000
  kern  :alert : Mem abort info:
  kern  :alert :   ESR = 0x0000000096000004
  kern  :alert :   EC = 0x25: DABT (current EL), IL = 32 bits
  kern  :alert :   SET = 0, FnV = 0
  kern  :alert :   EA = 0, S1PTW = 0
  kern  :alert :   FSC = 0x04: level 0 translation fault
  kern  :alert : Data abort info:
  kern  :alert :   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
  kern  :alert :   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
  kern  :alert :   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
  kern  :alert : user pgtable: 4k pages, 48-bit VAs, pgdp=0000000109c41000
  kern  :alert : [0000000000000000] pgd=0000000000000000
  <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=alert RESULT=fail UNITS=lines
  MEASUREMENT=13>

  kern  :emerg : Internal error: Oops: 0000000096000004 [#1] SMP
  kern  :emerg : Code: a90157f3 aa0003f3 f90013f6 f9405c15 (f94002b6)
  <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=emerg RESULT=fail UNITS=lines
  MEASUREMENT=2>

Please let me know if you need full logs or further details to help
with debugging.

Thanks,
Aishwarya
Re: [PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Nitin Rawat 6 months ago

On 6/21/2025 3:14 AM, Aishwarya wrote:
> Hi Nitin,
> 
> To clarify — the defconfig kernel does boot successfully on our Arm64
> Qualcomm platforms (RB5 and DB845C). However, starting from
> next-20250613, we are seeing the following three test failures in the
> `bootrr` baseline test in our CI environment:
> 
>    - baseline.bootrr.scsi-disk-device0-probed
>    - dmesg.alert
>    - dmesg.emerg
> 

Hi Aishwarya,

Thanks for testing and reporting this issue. Can you please
test with the attached fix and let me know if it helps.

Regards,
Nitin

> Test suite:
>    https://github.com/kernelci/bootrr/tree/main
> 
> These failures are due to kernel alerts seen in the boot logs. A relevant
> snippet is shown below:
> 
>    kern  :alert : Unable to handle kernel NULL pointer dereference at
>    virtual address 0000000000000000
>    kern  :alert : Mem abort info:
>    kern  :alert :   ESR = 0x0000000096000004
>    kern  :alert :   EC = 0x25: DABT (current EL), IL = 32 bits
>    kern  :alert :   SET = 0, FnV = 0
>    kern  :alert :   EA = 0, S1PTW = 0
>    kern  :alert :   FSC = 0x04: level 0 translation fault
>    kern  :alert : Data abort info:
>    kern  :alert :   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
>    kern  :alert :   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
>    kern  :alert :   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
>    kern  :alert : user pgtable: 4k pages, 48-bit VAs, pgdp=0000000109c41000
>    kern  :alert : [0000000000000000] pgd=0000000000000000
>    <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=alert RESULT=fail UNITS=lines
>    MEASUREMENT=13>
> 
>    kern  :emerg : Internal error: Oops: 0000000096000004 [#1] SMP
>    kern  :emerg : Code: a90157f3 aa0003f3 f90013f6 f9405c15 (f94002b6)
>    <LAVA_SIGNAL_TESTCASE TEST_CASE_ID=emerg RESULT=fail UNITS=lines
>    MEASUREMENT=2>
> 
> Please let me know if you need full logs or further details to help
> with debugging.
> 
> Thanks,
> Aishwarya
From 3f6abf0f5a1ad6dba975824c97c94a77babb9d38 Mon Sep 17 00:00:00 2001
From: Nitin Rawat <quic_nitirawa@quicinc.com>
Date: Sat, 21 Jun 2025 21:40:42 +0530
Subject: [PATCH V1] scsi: ufs: qcom : Fix NULL pointer dereference in
 ufs_qcom_setup_clocks

Fix a NULL pointer dereference in ufs_qcom_setup_clocks due to an
uninitialized 'host' variable. The variable 'phy' is now assigned
after confirming 'host' is not NULL.

Call Stack:

[    6.448070] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000
[    6.448449] ufs_qcom_setup_clocks+0x28/0x148 ufs_qcom (P)
[    6.448466] ufshcd_setup_clocks (drivers/ufs/core/ufshcd-priv.h:142)
[    6.448477] ufshcd_init (drivers/ufs/core/ufshcd.c:9468)
[    6.448485] ufshcd_pltfrm_init (drivers/ufs/host/ufshcd-pltfrm.c:504)
[    6.448495] ufs_qcom_probe+0x28/0x68 ufs_qcom
[    6.448508] platform_probe (drivers/base/platform.c:1404)
[    6.448519] really_probe (drivers/base/dd.c:579 drivers/base/dd.c:657)
[    6.448526] __driver_probe_device (drivers/base/dd.c:799)
[    6.448532] driver_probe_device (drivers/base/dd.c:829)
[    6.448539] __driver_attach (drivers/base/dd.c:1216)
[    6.448545] bus_for_each_dev (drivers/base/bus.c:370)
[    6.448556] driver_attach (drivers/base/dd.c:1234)
[    6.448567] bus_add_driver (drivers/base/bus.c:678)
[    6.448577] driver_register (drivers/base/driver.c:249)
[    6.448584] __platform_driver_register (drivers/base/platform.c:868)
[    6.448592] ufs_qcom_pltform_init+0x28/0xff8 ufs_qcom
[    6.448605] do_one_initcall (init/main.c:1274)
[    6.448615] do_init_module (kernel/module/main.c:3041)
[    6.448626] load_module (kernel/module/main.c:3511)
[    6.448635] init_module_from_file (kernel/module/main.c:3704)
[    6.448644] __arm64_sys_finit_module (kernel/module/main.c:3715.

Fixes: 77d2fa54a945 ("scsi: ufs: qcom : Refactor phy_power_on/off calls")
Reported-by: Aishwarya <aishwarya.tcv@arm.com>
Closes: https://lore.kernel.org/lkml/20250620214408.11028-1-aishwarya.tcv@arm.com/
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Closes: https://lkml.org/lkml/2025/6/21/107
Co-developed-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
---
 drivers/ufs/host/ufs-qcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index ba4b2880279c..318dca7fe3d7 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -1124,7 +1124,7 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
 				 enum ufs_notify_change_status status)
 {
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
-	struct phy *phy = host->generic_phy;
+	struct phy *phy;
 	int err;

 	/*
@@ -1135,6 +1135,8 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
 	if (!host)
 		return 0;

+	phy = host->generic_phy;
+
 	switch (status) {
 	case PRE_CHANGE:
 		if (on) {
--
2.48.1

Re: [PATCH V6 10/10] scsi: ufs: qcom : Refactor phy_power_on/off calls
Posted by Marek Szyprowski 5 months, 3 weeks ago
On 21.06.2025 19:15, Nitin Rawat wrote:
>
> On 6/21/2025 3:14 AM, Aishwarya wrote:
>> Hi Nitin,
>>
>> To clarify — the defconfig kernel does boot successfully on our Arm64
>> Qualcomm platforms (RB5 and DB845C). However, starting from
>> next-20250613, we are seeing the following three test failures in the
>> `bootrr` baseline test in our CI environment:
>>
>>    - baseline.bootrr.scsi-disk-device0-probed
>>    - dmesg.alert
>>    - dmesg.emerg
>>
>
> Hi Aishwarya,
>
> Thanks for testing and reporting this issue. Can you please
> test with the attached fix and let me know if it helps.
>
I also stepped into this issue on the RB5 board and I confirm that that 
patch fixes it. Thanks!

Feel free to add:

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>


 > ...

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland