From: Avri Altman <Avri.Altman@wdc.com>
To: Can Guo <quic_cang@quicinc.com>,
"bvanassche@acm.org" <bvanassche@acm.org>,
"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
"beanhuo@micron.com" <beanhuo@micron.com>,
"quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>,
"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
"quic_ziqichen@quicinc.com" <quic_ziqichen@quicinc.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"kernel-team@android.com" <kernel-team@android.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Daejun Park <daejun7.park@samsung.com>,
Jinyoung Choi <j-young.choi@samsung.com>,
Kiwoong Kim <kwmad.kim@samsung.com>,
open list <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/2] scsi: ufs: Add Multi-Circular Queue support
Date: Fri, 22 Jul 2022 07:31:06 +0000 [thread overview]
Message-ID: <DM6PR04MB65750EE12401C4F69B352E5CFC909@DM6PR04MB6575.namprd04.prod.outlook.com> (raw)
In-Reply-To: <1658214120-22772-2-git-send-email-quic_cang@quicinc.com>
> +static int ufshcd_mcq_config_resource(struct ufs_hba *hba)
> +{
> + struct platform_device *pdev = to_platform_device(hba->dev);
> + struct ufshcd_res_info_t *res;
> + struct resource *res_mem, *res_mcq;
> + int i, ret = 0;
> +
> + memcpy(hba->res, ufshcd_res_info, sizeof(ufshcd_res_info));
> +
> + for (i = 0; i < RES_MAX; i++) {
> + res = &hba->res[i];
> +
> + res->resource = platform_get_resource_byname(pdev,
> + IORESOURCE_MEM,
> + res->name);
> + if (!res->resource) {
> + dev_info(hba->dev, "Resource %s not provided\n", res-
> >name);
> + if (i == RES_MEM)
> + return -ENOMEM;
> + continue;
> + } else if (i == RES_MEM) {
> + res_mem = res->resource;
> + res->base = hba->mmio_base;
> + continue;
> + }
> +
> + res->base = devm_ioremap_resource(hba->dev, res->resource);
> + if (IS_ERR(res->base)) {
> + dev_err(hba->dev, "Failed to map res %s, err = %d\n",
> + res->name, (int)PTR_ERR(res->base));
> + res->base = NULL;
> + ret = PTR_ERR(res->base);
> + goto out_err;
> + }
> + }
> +
> + res = &hba->res[RES_MCQ];
> + /* MCQ resource provided */
> + if (res->base)
> + goto out;
> +
> + /* Manually allocate MCQ resource */
Did you consider to force providing the MCQ configuration?
> + res_mcq = res->resource;
> + res_mcq = devm_kzalloc(hba->dev, sizeof(*res_mcq), GFP_KERNEL);
> + if (!res_mcq) {
> + dev_err(hba->dev, "Failed to alloate MCQ resource\n");
> + goto out_err;
> + }
> + res->is_alloc = true;
> +
> + res_mcq->start = res_mem->start +
> + mcq_sqattr_offset(hba->mcq_capabilities);
> + res_mcq->end = res_mcq->start + 32 * MCQ_QCFG_SIZE - 1;
Shouldn't there can be MCQCap.MAXQ queues and no more than 32?
> +int ufshcd_mcq_init(struct ufs_hba *hba)
> +{
> + struct Scsi_Host *host = hba->host;
> + struct ufs_hw_queue *hwq;
> + int i, ret = 0;
> +
> + if (!is_mcq_supported(hba))
> + return 0;
> +
> + ret = ufshcd_mcq_config_resource(hba);
> + if (ret) {
> + dev_err(hba->dev, "Failed to config MCQ resource\n");
> + return ret;
> + }
> +
> + ret = ufshcd_vops_config_mcq_rop(hba);
> + if (ret) {
> + dev_err(hba->dev, "MCQ Runtime Operation Pointers not
> configured\n");
> + goto out_err;
> + }
> +
> + hba->nr_queues[HCTX_TYPE_DEFAULT] = num_possible_cpus();
> + hba->nr_queues[HCTX_TYPE_READ] = 0;
> + hba->nr_queues[HCTX_TYPE_POLL] = 1;
> +
> + for (i = 0; i < HCTX_MAX_TYPES; i++)
> + host->nr_hw_queues += hba->nr_queues[i];
> +
> + host->can_queue = hba->nutrs;
> + host->cmd_per_lun = hba->nutrs;
> +
> + /* One more reserved for dev_cmd_queue */
> + hba->nr_hw_queues = host->nr_hw_queues + 1;
Is it possible, since MCQ memory space is *added* to the UTR & UTMR lists,
That we'll keep using the legacy doorbell for query commands?
Wouldn't it will simplify the hw_queue bookkeeping
> -#define ufshcd_hex_dump(prefix_str, buf, len) do { \
> - size_t __len = (len); \
> - print_hex_dump(KERN_ERR, prefix_str, \
> - __len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE,\
> - 16, 4, buf, __len, false); \
> +#define ufshcd_hex_dump(prefix_str, buf, len) do { \
> + size_t __len = (len); \
> + \
> + print_hex_dump(KERN_ERR, prefix_str, \
> + __len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE, \
> + 16, 4, buf, __len, false); \
> + \
> } while (0)
Should this be part of this patch?
> +#define UFSHCD_MCQ_IO_QUEUE_OFFSET 1
Maybe add a comment above: "queue 0 is reserved for query commands" or something
That is if the query commands don't use the legacy doorbell
> +static inline bool ufshcd_is_hwq_full(struct ufs_hw_queue *q)
> +{
> + return (q->sq_hp_slot == ((q->sq_tp_slot + 1) %
> + q->max_entries));
> +}
Isn't sq_tp_slot is already % q->max_entries ?
Thanks,
Avri
next prev parent reply other threads:[~2022-07-22 7:31 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1658214120-22772-1-git-send-email-quic_cang@quicinc.com>
2022-07-19 7:01 ` [PATCH 1/2] scsi: ufs: Add Multi-Circular Queue support Can Guo
2022-07-19 23:01 ` Bart Van Assche
2022-07-19 23:07 ` Bart Van Assche
2022-07-20 17:34 ` Asutosh Das (asd)
2022-07-20 7:57 ` kernel test robot
2022-07-20 11:41 ` kernel test robot
2022-07-20 16:36 ` kernel test robot
2022-07-22 7:31 ` Avri Altman [this message]
2022-07-22 17:35 ` Asutosh Das (asd)
2022-07-22 19:37 ` Avri Altman
2022-07-22 20:14 ` Asutosh Das (asd)
2022-07-22 20:22 ` Avri Altman
2022-07-22 21:05 ` Asutosh Das (asd)
2022-07-22 17:58 ` Bart Van Assche
2022-07-26 6:48 ` Can Guo
2022-07-22 14:42 ` Avri Altman
2022-07-23 14:59 ` Avri Altman
2022-07-26 2:55 ` Can Guo
2022-07-23 15:26 ` Avri Altman
2022-07-24 3:14 ` Bart Van Assche
2022-07-25 16:24 ` Asutosh Das (asd)
2022-07-23 20:22 ` Avri Altman
2022-07-25 16:26 ` Asutosh Das (asd)
2022-07-25 19:50 ` Avri Altman
2022-07-25 20:24 ` Asutosh Das (asd)
2022-07-23 21:23 ` Avri Altman
2022-07-24 3:15 ` Bart Van Assche
2022-07-25 16:35 ` Asutosh Das (asd)
2022-07-26 22:47 ` Bart Van Assche
2022-07-24 4:07 ` Avri Altman
2022-07-25 16:38 ` Asutosh Das (asd)
2022-07-26 6:35 ` Can Guo
2022-07-26 9:46 ` Avri Altman
2022-07-24 4:32 ` Avri Altman
2022-07-26 6:21 ` Can Guo
2022-07-24 7:21 ` Avri Altman
2022-07-24 21:54 ` Bean Huo
2022-07-25 17:35 ` Asutosh Das (asd)
2022-07-25 9:16 ` Dan Carpenter
2022-07-28 19:10 ` John Garry
2022-07-28 19:15 ` Asutosh Das (asd)
2022-07-28 20:29 ` Bart Van Assche
2022-07-28 21:07 ` Asutosh Das (asd)
2022-07-29 16:43 ` Asutosh Das (asd)
2022-07-29 18:59 ` Bart Van Assche
2022-07-28 19:38 ` Bart Van Assche
2022-07-28 20:00 ` Asutosh Das (asd)
2022-07-19 7:01 ` [PATCH 2/2] scsi: ufs-qcom: Implement three CMQ related vops Can Guo
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=DM6PR04MB65750EE12401C4F69B352E5CFC909@DM6PR04MB6575.namprd04.prod.outlook.com \
--to=avri.altman@wdc.com \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=daejun7.park@samsung.com \
--cc=j-young.choi@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=kernel-team@android.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=quic_asutoshd@quicinc.com \
--cc=quic_cang@quicinc.com \
--cc=quic_nguyenb@quicinc.com \
--cc=quic_ziqichen@quicinc.com \
--cc=stanley.chu@mediatek.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;
as well as URLs for NNTP newsgroup(s).