[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <95c026bdb884a27bc6f954e3c01113816723c999.camel@mediatek.com>
Date: Mon, 13 May 2024 09:32:38 +0000
From: Peter Wang (王信友) <peter.wang@...iatek.com>
To: "avri.altman@....com" <avri.altman@....com>, "martin.petersen@...cle.com"
<martin.petersen@...cle.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
CC Chou (周志杰) <cc.chou@...iatek.com>,
Alice Chao (趙珮均) <Alice.Chao@...iatek.com>,
"beanhuo@...ron.com" <beanhuo@...ron.com>, "bvanassche@....org"
<bvanassche@....org>, Chun-Hung Wu (巫駿宏)
<Chun-hung.Wu@...iatek.com>, "linux-scsi@...r.kernel.org"
<linux-scsi@...r.kernel.org>, Tun-yu Yu (游敦聿)
<Tun-yu.Yu@...iatek.com>, Naomi Chu (朱詠田)
<Naomi.Chu@...iatek.com>, Powen Kao (高伯文)
<Powen.Kao@...iatek.com>
Subject: Re: [PATCH v2] scsi: ufs: Allow RTT negotiation
On Fri, 2024-05-03 at 14:34 +0300, Avri Altman wrote:
> The rtt-upiu packets precede any data-out upiu packets, thus
> synchronizing the data input to the device: this mostly applies to
> write
> operations, but there are other operations that requires rtt as well.
>
> There are several rules binding this rtt - data-out dialog,
> specifically
> There can be at most outstanding bMaxNumOfRTT such packets. This
> might
> have an effect on write performance (sequential write in particular),
> as
> each data-out upiu must wait for its rtt sibling.
>
> UFSHCI expects bMaxNumOfRTT to be min(bDeviceRTTCap, NORTT). However,
> as of today, there does not appears to be no-one who sets it: not the
> host controller nor the driver. It wasn't an issue up to now:
> bMaxNumOfRTT is set to 2 after manufacturing, and wasn't limiting the
> write performance.
>
> UFS4.0, and specifically gear 5 changes this, and requires the device
> to
> be more attentive. This doesn't come free - the device has to
> allocate
> more resources to that end, but the sequential write performance
> improvement is significant. Early measurements shows 25% gain when
> moving from rtt 2 to 9. Therefore, set bMaxNumOfRTT to be
> min(bDeviceRTTCap, NORTT) as UFSHCI expects.
>
> Signed-off-by: Avri Altman <avri.altman@....com>
> Reviewed-by: Bean Huo <beanhuo@...ron.com>
> ---
> Changes since v1:
> - bMaxNumOfRTT is a Persistent attribute - do not override if it was
> written (Bean)
> ---
> drivers/ufs/core/ufshcd.c | 36 ++++++++++++++++++++++++++++++++++++
> include/ufs/ufshcd.h | 2 ++
> include/ufs/ufshci.h | 1 +
> 3 files changed, 39 insertions(+)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 0819ddafe7a6..c472bfdf071e 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -102,6 +102,9 @@
> /* Default RTC update every 10 seconds */
> #define UFS_RTC_UPDATE_INTERVAL_MS (10 * MSEC_PER_SEC)
>
> +/* bMaxNumOfRTT is equal to two after device manufacturing */
> +#define DEFAULT_MAX_NUM_RTT 2
> +
> /* UFSHC 4.0 compliant HC support this mode. */
> static bool use_mcq_mode = true;
>
> @@ -2405,6 +2408,8 @@ static inline int
> ufshcd_hba_capabilities(struct ufs_hba *hba)
> ((hba->capabilities & MASK_TASK_MANAGEMENT_REQUEST_SLOTS) >>
> 16) + 1;
> hba->reserved_slot = hba->nutrs - 1;
>
> + hba->nortt = FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba-
> >capabilities) + 1;
>
Hi Arvi.
Get nortt from NUTRS will have problem in mediatek platform.
The NUTRS in medatek platfrom is 32 or 64, but actually
host rtt support is only 2.
Please add new vops for host the set real rtt support.
Thanks.
Peter
Powered by blists - more mailing lists