Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: neil.armstrong@linaro.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, "Bao D. Nguyen" <quic_nguyenb@quicinc.com>
Subject: Re: [PATCH v6 11/11] scsi: ufs: core: Move code out of an if-statement
Date: Thu, 31 Oct 2024 10:51:10 -0700	[thread overview]
Message-ID: <afaca557-6b7f-4f48-a38a-19eca725282f@acm.org> (raw)
In-Reply-To: <0c0bc528-fdc2-4106-bc99-f23ae377f6f5@linaro.org>

On 10/31/24 7:46 AM, Neil Armstrong wrote:
> This change regresses the Qualcomm SM8650 Platforms, QRD and HDK boards 
> fails to boot:
> https://git.codelinaro.org/linaro/qcomlt/ci/staging/cdba-tester/-/jobs/182758#L1200
> 
> [    5.155432] ufshcd-qcom 1d84000.ufshc: Resource ufs_mem not provided
> [    5.155439] ufshcd-qcom 1d84000.ufshc: MCQ mode is disabled, err=-19
> [    5.155443] ufshcd-qcom 1d84000.ufshc: ufshcd_add_scsi_host: failed 
> to initialize (legacy doorbell mode not supported)
> [    5.155874] ufshcd-qcom 1d84000.ufshc: error -EINVAL: Initialization 
> failed with error -22
> 
> then causes system crash:
> [   15.400948] Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
> [   15.667218] Call trace:
> [   15.669833]  _raw_spin_lock_irqsave+0x34/0x8c (P)
> [   15.674829]  pm_runtime_get_if_active+0x24/0x9c (L)
> [   15.679998]  pm_runtime_get_if_active+0x24/0x9c
> [   15.684811]  ufshcd_rtc_work+0x138/0x1b4
> [   15.688991]  process_one_work+0x148/0x288
> [   15.693258]  worker_thread+0x2cc/0x3d4
> [   15.697248]  kthread+0x110/0x114
> [   15.700703]  ret_from_fork+0x10/0x20
> [   15.704516] Code: b9000841 d503201f 52800001 52800022 (88e17c02)
> [   15.710956] ---[ end trace 0000000000000000 ]---

Hi Neil,

Thank you for the very detailed report. I think that two bugs are being
reported:
* Support for non-MCQ UFSHCI 4.0 controllers is broken.
* The RTC update code is activated too early.

Is the patch below sufficient to fix both issues?

Thanks,

Bart.


diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 0787387b7ce1..0b6b0cd4af33 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8620,6 +8620,13 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
  		ufshcd_init_clk_scaling_sysfs(hba);
  	}

+	/*
+	 * The RTC update code accesses the hba->ufs_device_wlun->sdev_gendev
+	 * pointer.
+	 */
+	schedule_delayed_work(&hba->ufs_rtc_update_work,
+			      msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
+
  	ufs_bsg_probe(hba);
  	scsi_scan_host(hba->host);

@@ -8714,8 +8721,6 @@ static int ufshcd_post_device_init(struct ufs_hba 
*hba)
  	ufshcd_force_reset_auto_bkops(hba);

  	ufshcd_set_timestamp_attr(hba);
-	schedule_delayed_work(&hba->ufs_rtc_update_work,
-			      msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));

  	if (!hba->max_pwr_info.is_valid)
  		return 0;
@@ -10345,8 +10350,7 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
  			dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
  				err);
  		}
-	}
-	if (!is_mcq_supported(hba) && !hba->lsdb_sup) {
+	} else if (!hba->lsdb_sup) {
  		dev_err(hba->dev,
  			"%s: failed to initialize (legacy doorbell mode not supported)\n",
  			__func__);


  reply	other threads:[~2024-10-31 17:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 20:11 [PATCH v6 00/11] Combine the two UFS driver scsi_add_host() calls Bart Van Assche
2024-10-16 20:11 ` [PATCH v6 01/11] scsi: ufs: core: Introduce ufshcd_add_scsi_host() Bart Van Assche
2024-10-16 20:11 ` [PATCH v6 02/11] scsi: ufs: core: Introduce ufshcd_post_device_init() Bart Van Assche
2024-10-16 20:11 ` [PATCH v6 03/11] scsi: ufs: core: Call ufshcd_add_scsi_host() later Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 04/11] scsi: ufs: core: Introduce ufshcd_process_probe_result() Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 05/11] scsi: ufs: core: Convert a comment into an explicit check Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 06/11] scsi: ufs: core: Move the ufshcd_device_init() calls Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 07/11] scsi: ufs: core: Move the ufshcd_device_init(hba, true) call Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 08/11] scsi: ufs: core: Expand " Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 09/11] scsi: ufs: core: Remove code that is no longer needed Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 10/11] scsi: ufs: core: Move the MCQ scsi_add_host() call Bart Van Assche
2024-10-16 20:12 ` [PATCH v6 11/11] scsi: ufs: core: Move code out of an if-statement Bart Van Assche
2024-10-31 14:46   ` Neil Armstrong
2024-10-31 17:51     ` Bart Van Assche [this message]
2024-10-31 19:55       ` Neil Armstrong
2024-10-31 21:15         ` Bart Van Assche
2024-11-05 22:01           ` Bart Van Assche
2024-11-06  8:48             ` Neil Armstrong
2024-11-06  9:57             ` Neil Armstrong
2024-11-06 17:51               ` Bart Van Assche
2024-11-07 10:49                 ` Manivannan Sadhasivam
2024-10-25 19:30 ` [PATCH v6 00/11] Combine the two UFS driver scsi_add_host() calls Martin K. Petersen
2024-11-05  2:32 ` Martin K. Petersen

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=afaca557-6b7f-4f48-a38a-19eca725282f@acm.org \
    --to=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_nguyenb@quicinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox