Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp955119pxb; Wed, 3 Mar 2021 22:24:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9eUJlBzp7QjdMzxJKcIfU1Y6Zce37NwZB/mNPeoZWIcvMnacwi2aft8ai0Xw4cGP4VfS+ X-Received: by 2002:aa7:c353:: with SMTP id j19mr506224edr.263.1614839067526; Wed, 03 Mar 2021 22:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614839067; cv=none; d=google.com; s=arc-20160816; b=wcIhIVj/Vm+eOyLQ2KzTDUwIbjpRv7Wm7e+CGW2UQKUd4NqBnS/C+Tg+QP7TqPF9bP aQOFD3hgmiaht+zoVM4yErVKf5LFOZ7oJ1uz999v5t5Y4MnLKBekZHeFSXzqo5ISE5sT XvsS/4M1OfFTRtheDeE5rWTXK8i0T3HWRHgCPcMgku5TCxPIXEZPF6lJpTLUfITZdkj+ KSXiDHwXVuVwmqlhk0uxz73ZQwL0ehqkkqhWtFvJvc5Cjd+q8laHJb1dI4a8DaxdBjc4 /OLBhd/0xgefl0RF5zDQqalU3WMykjRJqc+Kvtv+rtxIvQBQog+WqTk3bi/J0eyXBgmx ad6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=03fMenL1JcVf3REoLCDjJM5wD7/kclW1skBkKJBLspM=; b=tu4ur9FdIVGVnr5Bthxc4LTuqFFo4dNQgr+/2UD/B9G5jnCZnK0U5DNToB5q1VdhfX QfUQ75UPO2e0mhtHVvFZkq5Z2qYeRUuHTrGeMckYJr//AymrlFS76OILHfF0qLcXlDa7 hOZ4D9Zhbt06b8GqAU4WmPql/rqOiDjLTB3zbg95xvn0BPLxXCLXOHJDcJjEd0JWY+ht V78SPa4jXOrsB6b4PIgn1qsr3rtVzB/ipQ9YLUJqcNP71Gc+xmJAqx43UganJ369ak17 tDGQX2Ph0Pw9b6tT9xSITLL/UHtMKHKSTwVqbWMuKBDvba4GqlEZZ2iGEgOAkEHo7pLA +BgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qyQ8NZko; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z21si17396938edx.208.2021.03.03.22.24.05; Wed, 03 Mar 2021 22:24:27 -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=@gmail.com header.s=20161025 header.b=qyQ8NZko; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578644AbhCBP0P (ORCPT + 99 others); Tue, 2 Mar 2021 10:26:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351036AbhCBNE5 (ORCPT ); Tue, 2 Mar 2021 08:04:57 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8235BC061221; Tue, 2 Mar 2021 05:02:33 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id hs11so35089278ejc.1; Tue, 02 Mar 2021 05:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=03fMenL1JcVf3REoLCDjJM5wD7/kclW1skBkKJBLspM=; b=qyQ8NZko5e0fbSww/SDJz7zYoihVR2YZ+NQ0eET1ITBoQ2gDtVgbSTlwxTR4co/1mM rC/nNLykdjjbNcQdwqexR8M8GaZV5bcB5E7yuW3gMmGBoMqFvUMgqswWjt12MJNmog4L 2+oeC5yXbdnN5P6ttJLvs1zZZrR393kIDwoejSfcS6v+jFL930nP+30Ib8J3UIe2ZJGs HWSJl1T/H5c+t7QiBbMPqZ0tgVDmf7kMwtm5Hlibd5qe1SJgZZzHvqKA8IQL910/NsFw gPU7FNnVthipk5mGshnygFQ+dj28yCjhUsIW5Bm5pr+eE1m9Gfp9Cr7up60f5nT/j67F NCAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=03fMenL1JcVf3REoLCDjJM5wD7/kclW1skBkKJBLspM=; b=jK8iOGkSVgAA14+ozisOSoR3qTDYtowA6rpoQU7StXnE+v1S48sSHipIIvprmPVues A3RAFrOsJ7uduq+IvE7sx4J1VXU4G6jgL6Dm0lQkyzPIG843wh6CRdyMdVrVPwEtuWgL gCDEUGhhnLkLBfFxOurlnZVhDuHjwM7AGl6HVqNtx+jREaZAzmCYQzJEZHVE7yunjCD9 FVuoRZ3GJcnu81/Lh+HyaoakUrqMUSJWsmw0yu+lxkSevhXMcS4kBSVRb/9Y+racMYOH gwcKmiageO0f2CwoNGl75GS2TWg1tEUBrH8EwcAylCj0Ou+3FytF+WOavWoG8svfkkPP 4uVg== X-Gm-Message-State: AOAM532wIHuNmFakz2JB86UVVvox+zXvb/+Xgj/BRM/Cbdqf3YbZfBiO RRBV1X9pdEnS+X1ssdkTjr0= X-Received: by 2002:a17:907:1b06:: with SMTP id mp6mr20782239ejc.408.1614690152275; Tue, 02 Mar 2021 05:02:32 -0800 (PST) Received: from ubuntu-laptop (ip5f5bec5d.dynamic.kabel-deutschland.de. [95.91.236.93]) by smtp.googlemail.com with ESMTPSA id l18sm9486088ejk.86.2021.03.02.05.02.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Mar 2021 05:02:32 -0800 (PST) Message-ID: Subject: Re: [PATCH v25 4/4] scsi: ufs: Add HPB 2.0 support From: Bean Huo To: daejun7.park@samsung.com, 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 Date: Tue, 02 Mar 2021 14:02:29 +0100 In-Reply-To: <20210226073525epcms2p5e7ddd6e92b2f76b2b3dcded49f8ff256@epcms2p5> References: <20210226073233epcms2p80fca2dffabea03143a9414838f757633@epcms2p8> <20210226073525epcms2p5e7ddd6e92b2f76b2b3dcded49f8ff256@epcms2p5> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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