[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR04MB657588F1C76DC0D5BFC68862FC819@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Mon, 22 Feb 2021 19:29:09 +0000
From: Avri Altman <Avri.Altman@....com>
To: "daejun7.park@...sung.com" <daejun7.park@...sung.com>,
Greg KH <gregkh@...uxfoundation.org>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
"cang@...eaurora.org" <cang@...eaurora.org>,
"bvanassche@....org" <bvanassche@....org>,
"huobean@...il.com" <huobean@...il.com>,
ALIM AKHTAR <alim.akhtar@...sung.com>,
Javier Gonzalez <javier.gonz@...sung.com>
CC: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
JinHwan Park <jh.i.park@...sung.com>,
SEUNGUK SHIN <seunguk.shin@...sung.com>,
Sung-Jun Park <sungjun07.park@...sung.com>,
yongmyung lee <ymhungry.lee@...sung.com>,
Jinyoung CHOI <j-young.choi@...sung.com>,
BoRam Shin <boram.shin@...sung.com>
Subject: RE: [PATCH v22 4/4] scsi: ufs: Add HPB 2.0 support
> @@ -7447,8 +7452,14 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
>
> if (dev_info->wspecversion >= UFS_DEV_HPB_SUPPORT_VERSION &&
> (b_ufs_feature_sup & UFS_DEV_HPB_SUPPORT)) {
> - dev_info->hpb_enabled = true;
> - ufshpb_get_dev_info(hba, desc_buf);
> + bool hpb_en = false;
> +
> + err = ufshcd_query_flag_retry(hba,
> UPIU_QUERY_OPCODE_READ_FLAG,
> + QUERY_FLAG_IDN_HPB_EN, 0, &hpb_en);
> + if (!err && hpb_en) {
> + dev_info->hpb_enabled = true;
> + ufshpb_get_dev_info(hba, desc_buf);
QUERY_FLAG_IDN_HPB_EN only apply to HPB2.0
> + }
> }
>
> +
> +/*
> + * WRITE_BUFFER CMD support 36K (len=9) ~ 512K (len=128) default.
> + * it is possible to change range of transfer_len through sysfs.
> + */
Actually the transfer length is limited by its (and read id) single byte.
Fixing MAX_HPB_READ_ID = 128 is IMO a reasonable choice,
But not limited by spec. Maybe make note of that ?
> +static inline bool ufshpb_is_required_wb(struct ufshpb_lu *hpb, int len)
> +{
> + return (len >= hpb->pre_req_min_tr_len &&
> + len <= hpb->pre_req_max_tr_len);
> }
Maybe also check HPB2.0 as well?
> -void ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> +int ufshpb_prep(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> {
> struct ufshpb_lu *hpb;
> struct ufshpb_region *rgn;
> @@ -282,26 +546,27 @@ void ufshpb_prep(struct ufs_hba *hba, struct
> ufshcd_lrb *lrbp)
> u64 ppn;
> unsigned long flags;
> int transfer_len, rgn_idx, srgn_idx, srgn_offset;
> + int read_id = MAX_HPB_READ_ID;
Should be 0 if wb is not used?
> +
> + hpb->pre_req = kcalloc(qd, sizeof(struct ufshpb_req), GFP_KERNEL);
> + hpb->throttle_pre_req = qd;
What is the point in throttling if you are allowing 32 simultaneous commands?
There can't be more than qd/2 anyway?
On the contrary, it makes much more sense to control the inflight map requests, instead?
> + hpb->num_inflight_pre_req = 0;
> +
> -#define HPB_SUPPORT_VERSION 0x100
> +#define HPB_SUPPORT_VERSION 0x200
In ufshpb_get_dev_info you are bailing out if version != HPB_SUPPORT_VERSION
Meaning you are no longer backward supporting HPB1.0?
Maybe it would be more constructive to allow a day or 2 for more people to comment this new patch?
After all, it is a lot of code.
Thanks,
Avri
Powered by blists - more mailing lists