Re: [RFC PATCH v3 2/4] ufs: core: mcq: Adds Multi-Circular Queue support
From: Bean Huo
Date: Mon Sep 05 2022 - 12:27:14 EST
On Fri, 2022-09-02 at 15:41 -0700, Asutosh Das wrote:
>
> +
> +static void ufshcd_mcq_config_nr_queues(struct ufs_hba *hba)
> +{
> + int i, rem;
> + u32 hbaq_cap, cmp;
> + struct Scsi_Host *host = hba->host;
> +
> + hbaq_cap = hba->mcq_capabilities & 0xff;
> +
> + rem = hbaq_cap - dev_cmd_queue;
> + /* min() compares variables of same type */
> + hba->nr_queues[HCTX_TYPE_DEFAULT] = min(hbaq_cap -
> dev_cmd_queue,
hba->nr_queues[HCTX_TYPE_DEFAULT] = min(rem, num_possible_cpus());
> + num_possible_cpus());
> + rem -= hba->nr_queues[HCTX_TYPE_DEFAULT];
> + if (rem <= 0)
> + goto out;
> + cmp = rem;
> + hba->nr_queues[HCTX_TYPE_POLL] = min(cmp, poll_queues);
> + rem -= hba->nr_queues[HCTX_TYPE_POLL];
> + if (rem <= 0)
> + goto out;
> + cmp = rem;
> + hba->nr_queues[HCTX_TYPE_READ] = min(cmp, read_queues);
static read_queues is not initialized.
>
.....
> +static inline void ufshcd_inc_tp(struct ufs_hw_queue *q)
> +{
> + u32 mask = q->max_entries - 1;
> + u32 val;
> +
> + q->sq_tp_slot = (q->sq_tp_slot + 1) & mask;
> + val = q->sq_tp_slot * sizeof(struct utp_transfer_req_desc);
> + writel(val, q->mcq_sq_tp);
> +}
This function just accesses the submission queue tail pointer. The
function name should clearly explain this.