Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: "Peter Wang (王信友)" <peter.wang@mediatek.com>,
	"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 08:32:38 -0800	[thread overview]
Message-ID: <6745d2d0-e8c4-407c-a22d-5577997f1ca3@acm.org> (raw)
In-Reply-To: <877f7704215c36bfb15808e3a168767845ce09c4.camel@mediatek.com>

On 12/18/25 11:32 PM, Peter Wang (王信友) wrote:
> 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?

This has been considered but unfortunately the UFSHCI register set
definition makes this impossible. hba->host->can_queue must be set
before scsi_add_host() is called. hba->host->can_queue is derived
from the controller capabilities register (CAP). MCQ must be enabled
before NUTRS is extracted from the CAP register. Otherwise NUTRS is
reported as 32 - 1 instead of 64 - 1 (assuming that the host
controller supports 64 outstanding commands in MCQ mode).

Thanks,

Bart.

  reply	other threads:[~2025-12-19 16:32 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 (王信友)
2025-12-19 16:32   ` Bart Van Assche [this message]
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=6745d2d0-e8c4-407c-a22d-5577997f1ca3@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nitin.rawat@oss.qualcomm.com \
    --cc=peter.wang@mediatek.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