[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <748f9c294e304cc5b5ccd9804fa647afc39c8bc3.camel@gmail.com>
Date: Mon, 05 Sep 2022 15:48:15 +0200
From: Bean Huo <huobean@...il.com>
To: Asutosh Das <quic_asutoshd@...cinc.com>, quic_nguyenb@...cinc.com,
quic_xiaosenh@...cinc.com, stanley.chu@...iatek.com,
adrian.hunter@...el.com, bvanassche@....org, avri.altman@....com,
mani@...nel.org, quic_cang@...cinc.com, beanhuo@...ron.com,
martin.petersen@...cle.com, linux-scsi@...r.kernel.org
Cc: linux-arm-msm@...r.kernel.org,
Alim Akhtar <alim.akhtar@...sung.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Jinyoung Choi <j-young.choi@...sung.com>,
Kiwoong Kim <kwmad.kim@...sung.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v3 2/4] ufs: core: mcq: Adds Multi-Circular Queue
support
On Fri, 2022-09-02 at 15:41 -0700, Asutosh Das wrote:
> +/**
> + * ufshcd_mcq_decide_queue_depth - decide the queue depth
> + * @hba - per adapter instance
> + *
> + * MAC - Max. Active Command of the Host Controller (HC)
> + * HC wouldn't send more than this commands to the device.
> + * The default MAC is 32, but the max. value may vary with
> + * vendor implementation.
> + * Calculates and adjusts the queue depth based on the depth
> + * supported by the HC, ufs device and if ext_iid is supported.
> + */
> +u32 ufshcd_mcq_decide_queue_depth(struct ufs_hba *hba)
> +{
> + u32 qd, val;
> + int mac;
> +
> + mac = ufshcd_mcq_vops_get_hba_mac(hba);
> + if (mac < 0) {
> + val = ufshcd_readl(hba, REG_UFS_MCQ_CFG);
> + mac = (val & MCQ_CFG_MAC_MASK) >> MCQ_CFG_MAC_OFFSET;
> + }
> +
> + /* MAC is a 0 based value. */
> + mac += 1;
> + qd = min_t(u32, mac, hba->dev_info.bqueuedepth);
> + if (!qd)
> + qd = mac;
> +
> + /* Adjust queue depth based on ext_iid support. */
> + if (qd > 256 && (!hba->ext_iid_sup || !hba-
> >dev_info.b_ext_iid_en))
> + qd = 256;
> + else if (qd > 4096 && hba->ext_iid_sup && hba-
> >dev_info.b_ext_iid_en)
> + qd = 4096;
> +
Astosh,
I don't understand here. How can qd be 4096? MAC in UFSHCI is 9 bits
width, the maximum depth will be 512, and hba->dev_info.bqueuedepth is
one byte width, maximum will be 256.
Kind regards,
Bean
Powered by blists - more mailing lists