lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5cb5a04dd25984c4ddf7713ce0ffbbbbb969ea4.camel@gmail.com>
Date:   Tue, 02 Mar 2021 14:02:29 +0100
From:   Bean Huo <huobean@...il.com>
To:     daejun7.park@...sung.com, Greg KH <gregkh@...uxfoundation.org>,
        "avri.altman@....com" <avri.altman@....com>,
        "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>,
        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 v25 4/4] scsi: ufs: Add HPB 2.0 support

On Fri, 2021-02-26 at 16:35 +0900, Daejun Park wrote:
> 
> 
>  static void __ufshpb_evict_region(struct ufshpb_lu *hpb,
>  				  struct ufshpb_region *rgn)
>  {
> @@ -1209,6 +1579,16 @@ static void ufshpb_lu_parameter_init(struct
> ufs_hba *hba,
>  	u32 entries_per_rgn;
>  	u64 rgn_mem_size, tmp;
>  
> +	/* for pre_req */
> +	if (hpb_dev_info->max_hpb_single_cmd)
> +		hpb->pre_req_min_tr_len = hpb_dev_info-
> >max_hpb_single_cmd;
> +	else
> +		hpb->pre_req_min_tr_len = HPB_MULTI_CHUNK_LOW;


Here is not correct. according to Spec:

The size is calculated as ( bMAX_DATA_SIZE_FOR_HPB_SINGLE_CMD +1 )*4KB.
00h: 4KB
01h: 8KB
02h: 12KB
03h: 16KB
...
FEh: 1020KB
FFh: 1024KB

so, here if hpb_dev_info->max_hpb_single_cmd is 0x00, means 4KB, not
36KB.



> +	hpb->pre_req_max_tr_len = max(HPB_MULTI_CHUNK_HIGH,
> +				      hpb->pre_req_min_tr_len);
> +
> 
>  out:
>  	/* All LUs are initialized */
>  	if (atomic_dec_and_test(&hba->ufshpb_dev.slave_conf_cnt))
> @@ -1812,8 +2307,9 @@ void ufshpb_get_geo_info(struct ufs_hba *hba,
> u8 *geo_buf)
>  void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf)
>  {
>  	struct ufshpb_dev_info *hpb_dev_info = &hba->ufshpb_dev;
> -	int version;
> +	int version, ret;
>  	u8 hpb_mode;
> +	u32 max_hpb_sigle_cmd = 0;
>  
>  	hpb_mode = desc_buf[DEVICE_DESC_PARAM_HPB_CONTROL];
>  	if (hpb_mode == HPB_HOST_CONTROL) {
> @@ -1824,13 +2320,27 @@ void ufshpb_get_dev_info(struct ufs_hba *hba,
> u8 *desc_buf)
>  	}
>  
>  	version = get_unaligned_be16(desc_buf +
> DEVICE_DESC_PARAM_HPB_VER);
> -	if (version != HPB_SUPPORT_VERSION) {
> +	if ((version != HPB_SUPPORT_VERSION) &&
> +	    (version != HPB_SUPPORT_LEGACY_VERSION)) {
>  		dev_err(hba->dev, "%s: HPB %x version is not
> supported.\n",
>  			__func__, version);
>  		hpb_dev_info->hpb_disabled = true;
>  		return;
>  	}
>  
> +	if (version == HPB_SUPPORT_LEGACY_VERSION)
> +		hpb_dev_info->is_legacy = true;
> +
> +	pm_runtime_get_sync(hba->dev);
> +	ret = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
> +		QUERY_ATTR_IDN_MAX_HPB_SINGLE_CMD, 0, 0,
> &max_hpb_sigle_cmd);
> +	pm_runtime_put_sync(hba->dev);
> +
> +	if (ret)
> +		dev_err(hba->dev, "%s: idn: read max size of single hpb
> cmd query request failed",
> +			__func__);
> +	hpb_dev_info->max_hpb_single_cmd = max_hpb_sigle_cmd;
> +

Here you didn't add 1, if you read out the
QUERY_ATTR_IDN_MAX_HPB_SINGLE_CMD == 7, means device can support
maximum HPB Data size for using single HPB command is 7+1
((7+1)*4=32KB), not 7.


Bean




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ