Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1004276pxb; Thu, 4 Mar 2021 00:13:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd0bteEZ7X+ktLaegzDKledh41dKwxmXJipWouvfyhB6Qg9pdbrG4MPv7c8jnthzvgLc6a X-Received: by 2002:aa7:c618:: with SMTP id h24mr3020199edq.358.1614845581403; Thu, 04 Mar 2021 00:13:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614845581; cv=none; d=google.com; s=arc-20160816; b=x+fJ8RTwsmr55QSMvNR4AbKlmx6wxcpQsR4WGUriGSLteyZY4wfhlSROTfiy9BeFwK PwgNTKRbCP//Xo1VBkPdSHE9vT09BsL01cl6xJoACgYvK7wEanUb1GIUvMNxiXaJ+K/u lZ7WA+h3i9p2bN710ePGkCWJP39r1+JwC6aSJZ7HveXeqxcZJ49490gw85Jg2JcPErtZ KjhHE9FBZ7v14joHMCuqybAcKlQwWeFvi9khioM5r7KyKqOV+5JKien/6eTyFTost4Xw jaCgxSlwHvMYBzZh9ysndDx0G9sMeqlS5Qd43ogL8qyHDgBr6bpNoP1+TY5bSjPRzlO2 2+hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:cc:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=l6vq/WBBlvQg1WwwVK0qu86gyKgI6e+2OCjYuFyaH2s=; b=PMQKwiqahrD2bNZTmPFr5BU81so1kjPJuviCvcfjfemI3pt2oMsWaKAlQBRM2QapkI 7KwXx4UwhcHCMVVD5r0zef0vF2sF6we5NZVMnFTRBUtpMWkUDyiharnGatZovF5/uvFS 3UvgqhIs3kViaxeBIyqwCxMX1Th4qdp0VyfvaTHFu90YJwNZDEpe+/Y1UTE1BUZWfx8k ytB801qDxZd6QsL5bok0duWF91PuBbOA4QbfczSd9rwofkJ9cNHxG0w+G2U68GHebX1R mQ29nfD5ub4WuftGljJZjjSVVBCFq2J9lgUS8UGcBCDeTth5CsM6JOpAPgN9a0fK9HE/ I0Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=V+ndImMJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq23si10300223ejb.498.2021.03.04.00.12.39; Thu, 04 Mar 2021 00:13:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=V+ndImMJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232536AbhCCL13 (ORCPT + 99 others); Wed, 3 Mar 2021 06:27:29 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:10617 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244235AbhCCDEk (ORCPT ); Tue, 2 Mar 2021 22:04:40 -0500 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210303023147epoutp02f6f65fdf30a3adeb94fa2043f509105d~otEyfZqRA3126431264epoutp02R for ; Wed, 3 Mar 2021 02:31:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210303023147epoutp02f6f65fdf30a3adeb94fa2043f509105d~otEyfZqRA3126431264epoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1614738707; bh=l6vq/WBBlvQg1WwwVK0qu86gyKgI6e+2OCjYuFyaH2s=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=V+ndImMJECzQ3hSha1k1jkYpFJI8Tvlv2qFHgiilZ7G+/mfxx9q7jnM/GyHv597u+ HOY/novA/u3zQNDMb6D5yQdWGnd8Z7CrRAHYW7BUdd8bY9Qo0fL5N6ilUYu9VxTFYW kRnUmNMIlWGklTeFuXxRR/9N0qeyRxueNDiUf8FY= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20210303023146epcas2p2fed4fc2e5d474eec0720ffd8e2402cb1~otExnIdEn1646916469epcas2p2B; Wed, 3 Mar 2021 02:31:46 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.40.187]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DqygP22lgz4x9Q8; Wed, 3 Mar 2021 02:31:45 +0000 (GMT) X-AuditID: b6c32a46-1d9ff7000000dbf8-ff-603ef5114ab9 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 85.99.56312.115FE306; Wed, 3 Mar 2021 11:31:45 +0900 (KST) Mime-Version: 1.0 Subject: RE: Re: [PATCH v25 4/4] scsi: ufs: Add HPB 2.0 support Reply-To: daejun7.park@samsung.com Sender: Daejun Park From: Daejun Park To: Bean Huo , Daejun Park , Greg KH , "avri.altman@wdc.com" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "asutoshd@codeaurora.org" , "stanley.chu@mediatek.com" , "cang@codeaurora.org" , "bvanassche@acm.org" , ALIM AKHTAR , Javier Gonzalez CC: "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , JinHwan Park , SEUNGUK SHIN , Sung-Jun Park , yongmyung lee , Jinyoung CHOI , BoRam Shin X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20210303023144epcms2p58b342049ed4aca3287beaedfcbcedf37@epcms2p5> Date: Wed, 03 Mar 2021 11:31:44 +0900 X-CMS-MailID: 20210303023144epcms2p58b342049ed4aca3287beaedfcbcedf37 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJsWRmVeSWpSXmKPExsWy7bCmha7gV7sEgytz2CwezNvGZrG37QS7 xcufV9ksDt9+x24x7cNPZotP65exWrw8pGmx6kG4RfPi9WwWc842MFn09m9ls3h85zO7xaIb 25gs+v+1s1hc3gU0qPv6DjaL5cf/MVnc3sJlsXTrTUaLzulrWCwWLdzN4iDqcfmKt8flvl4m j52z7rJ7TFh0gNFj/9w17B4tJ/ezeHx8eovFo2/LKkaPz5vkPNoPdDMFcEXl2GSkJqakFimk 5iXnp2TmpdsqeQfHO8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYAfaikUJaYUwoUCkgsLlbS t7Mpyi8tSVXIyC8usVVKLUjJKTA0LNArTswtLs1L10vOz7UyNDAwMgWqTMjJ2LXxFXPBYYmK li93mBoYLwt0MXJySAiYSNz+sIKpi5GLQ0hgB6PE2zOPGLsYOTh4BQQl/u4QBqkRFrCX+Hi2 nxHEFhJQklh/cRY7RFxP4tbDNWBxNgEdiekn7rODzBERWMoiMeX4MmYQh1ngF5PEiccfGCG2 8UrMaH/KAmFLS2xfvhUszingLrFz9iWoGg2JH8t6mSFsUYmbq9+yw9jvj82HqhGRaL13FqpG UOLBz91QcUmJY7s/MEHY9RJb7/xiBDlCQqCHUeLwzlusEAl9iWsdG8GO4BXwldi6fjHYAhYB VYn3Kx8yg3wvIeAisbVVHiTMLCAvsf3tHLAws4CmxPpd+hAVyhJHbrHAfNWw8Tc7OptZgE+i 4/BfuPiOeU+gLlOTWPdzPdMERuVZiJCehWTXLIRdCxiZVzGKpRYU56anFhsVGCFH7iZGcGrX ctvBOOXtB71DjEwcjIcYJTiYlUR4xV/aJgjxpiRWVqUW5ccXleakFh9iNAV6ciKzlGhyPjC7 5JXEG5oamZkZWJpamJoZWSiJ8xYbPIgXEkhPLEnNTk0tSC2C6WPi4JRqYJp0XaZJ5Oudawyu bc9M919/uX/r/d2xR4JNZ831alFaHiC1z9pKXydYuV/vF6OsVs/amyXf7mgmq0YeUDGNPcEZ z9QbsqXR63/pjk8GVafjp2wR375wrcFjF6YPjd3uLNaaMYv7HOXiLpgvq9dpmRj85OTMq0mv q3l9JHs+feNJ2qZUf/hvD4PE3TVL9gbIbgmeclpYKPZE9c9tDpuFP0t3Kz+QnLBn+rzZPUmK iv/Tdq7JLgiI0jEMORchbGe1ZWHM7elXI3w9/57YnZ0yUWqSuerq8xpdP6dts7p3flKMrk++ lOOK35sz+blT3qWY2kjcWf3ZXJWhoGfeAuHi3ZOlvf/4rJln1Jp1d29bqxJLcUaioRZzUXEi ALIfA6R2BAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210226073233epcms2p80fca2dffabea03143a9414838f757633 References: <20210226073233epcms2p80fca2dffabea03143a9414838f757633@epcms2p8> <20210226073525epcms2p5e7ddd6e92b2f76b2b3dcded49f8ff256@epcms2p5> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > 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. OK, > > + 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. OK, Done. Thanks, Daejun