Hi Asutosh, On Wed, 2022-10-05 at 18:06 -0700, Asutosh Das wrote: > Introduce multi-circular queue (MCQ) which has been added > in UFSHC v4.0 standard in addition to the Single Doorbell mode. > The MCQ mode supports multiple submission and completion queues. > Add support to configure the number of queues. > > Co-developed-by: Can Guo <quic_cang@xxxxxxxxxxx> > Signed-off-by: Can Guo <quic_cang@xxxxxxxxxxx> > Signed-off-by: Asutosh Das <quic_asutoshd@xxxxxxxxxxx> > --- > drivers/ufs/core/Makefile | 2 +- > drivers/ufs/core/ufs-mcq.c | 113 > +++++++++++++++++++++++++++++++++++++++++ > drivers/ufs/core/ufshcd-priv.h | 1 + > drivers/ufs/core/ufshcd.c | 12 +++++ > include/ufs/ufshcd.h | 4 ++ > 5 files changed, 131 insertions(+), 1 deletion(-) > create mode 100644 drivers/ufs/core/ufs-mcq.c > [...] > /** > * ufshcd_probe_hba - probe hba to detect device and initialize it > * @hba: per-adapter instance > @@ -8224,6 +8233,9 @@ static int ufshcd_probe_hba(struct ufs_hba > *hba, bool init_dev_params) > goto out; > > if (is_mcq_supported(hba)) { > + ret = ufshcd_config_mcq(hba); > + if (ret) > + goto out; > ret = scsi_add_host(host, hba->dev); > if (ret) { > dev_err(hba->dev, "scsi_add_host > failed\n"); > ufshcd_probe_hba() may be called multiple times (from ufshcd_async_scan() and ufshcd_host_reset_and_restore()). It is not a good idea to allocate memory in ufshcd_config_mcq(). Although use parameter init_dev_params to decide call ufshcd_config_mcq() or not, it may cause ufshcd_host_reset_and_restore() not to configure MCQ (init SQ/CQ ptr...) again. Suggest to separate configure MCQ (set hardware register) and allocate memory to different function Thanks, Eddie Huang