Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "bvanassche@acm.org" <bvanassche@acm.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"nitin.rawat@oss.qualcomm.com" <nitin.rawat@oss.qualcomm.com>,
	"avri.altman@sandisk.com" <avri.altman@sandisk.com>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>
Subject: Re: [PATCH for rc] ufs: core: Configure MCQ after link startup
Date: Fri, 19 Dec 2025 07:32:52 +0000	[thread overview]
Message-ID: <877f7704215c36bfb15808e3a168767845ce09c4.camel@mediatek.com> (raw)
In-Reply-To: <20251218230741.2661049-1-bvanassche@acm.org>

On Thu, 2025-12-18 at 15:07 -0800, Bart Van Assche wrote:
> Commit f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host
> earlier")
> did not only cause scsi_add_host() to be called earlier. It also
> swapped
> the order of link startup and enabling and configuring MCQ mode.
> Before
> that commit, the call chains for link startup and enabling MCQ were
> as
> follows:
> 
> ufshcd_init()
>   ufshcd_link_startup()
>   ufshcd_add_scsi_host()
>     ufshcd_mcq_enable()
> 
> Apparently this change causes link startup to fail. Fix this by
> configuring
> MCQ after link startup has completed.
> 
> Reported-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
> Fixes: f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host
> earlier")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Hi Bart,

It seems strange to me that ufshcd_mcq_enable is called before
ufshcd_link_startup.

In driver development, configuration (config) should generally
be done before enabling (enable) the hardware.
Reason:
Configuring first ensures the hardware operates correctly and
avoids unexpected behavior or safety issues.

Typical steps:
1. Set registers/parameters
2. Initialize resources
3. Configure interrupts/DMA
4. Enable the hardware

So, do you also consider moving ufshcd_mcq_enable after 
ufshcd_config_mcq?

Thanks.
Peter

  reply	other threads:[~2025-12-19  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 23:07 [PATCH for rc] ufs: core: Configure MCQ after link startup Bart Van Assche
2025-12-19  7:32 ` Peter Wang (王信友) [this message]
2025-12-19 16:32   ` Bart Van Assche
2025-12-22  5:55     ` Peter Wang (王信友)
2026-01-04 21:42 ` 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=877f7704215c36bfb15808e3a168767845ce09c4.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nitin.rawat@oss.qualcomm.com \
    --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