Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp397903pxj; Wed, 16 Jun 2021 05:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV7s4e6eLFl3ZkHdG5UUmi4SdTHPYQ1PidM7Y+Tu/uokJUS4VIu6hLgIi01F3IiTfehr/Q X-Received: by 2002:a05:6638:379d:: with SMTP id w29mr3945230jal.2.1623845363617; Wed, 16 Jun 2021 05:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623845363; cv=none; d=google.com; s=arc-20160816; b=g3TV8pUNTFIX+Zj35PkYe7yF3RSs1PXGt5bHh5b/RLKSyPMZr9lr3YcVCPpK/FzPIT kF1f6gZ/m/MpBtog4sW+eNJL20rVMm7+qRg/LFQrBXX8Qn2+EQDQKiglLAKZRQFMRL6T R0QE12ZowWbqDCJwT1x1cTTmaIZoSCDGRFMUuF+7sTi8jHRYBIY/Bz2iSPaJAm29wY9M hHgpvyiqnvkH98Qh/R49qxpO5rtCgi6VqNkrDP5rs2Tb/JLyWNU2sB6w/LztJ6fFajWJ F+0GVpi2IhCLUdIitm9IMRQIxlVX6p0NRPZMIyNQUmOC/uRnooPNPo4c90z/qcILGzMH Slbg== 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:message-id:date:subject:cc:to:from :wdcironportexception:ironport-sdr:ironport-sdr:ironport-sdr :dkim-signature; bh=bekF/Oxk6Pz2V9pVJUgRqmFr1YoxBacbq39JofZADh8=; b=TWsOSSUAMmjuoiTizOvzzmZ56K0VMw2KSwapxGz+VvaTstJd3rBOoRFivkxGpHfURF Qusl2f2LMjX9STUlD7ta4Bn+APsQSKsoeJ9ahX1bve0JCcBTPQY3BjM6gySfgJXWwFiT T0skfdPx0HoLxV0Z8VH4JbkHreqoYz+t+NH48Ufd3XzoBCqcTE5v4Zxvm6qN2wjlGa53 EjJTaqkdaMFCu9Mz9IW9Q2L6xwGEVLK+nzV8yzkftDjJASXp03eKfITrQfx9HZKvUZAw KPVeZPsIOxSqquGnI5H0VE3NifnoBQDbLP1w35UsZSEK1E03WvdUXQQAmk96wEFGf8Fx pbUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=oQl2pwix; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si2501130jaq.63.2021.06.16.05.08.52; Wed, 16 Jun 2021 05:09:23 -0700 (PDT) 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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=oQl2pwix; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232311AbhFPLac (ORCPT + 99 others); Wed, 16 Jun 2021 07:30:32 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:4725 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbhFPLac (ORCPT ); Wed, 16 Jun 2021 07:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1623842907; x=1655378907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vDksMCPROdbgzbzogxqTNaIIhU8JtS4xpZaUcJ4bey0=; b=oQl2pwixA4lHYViow8hSLnIhErYW/z5D+KIvGRaBGpBniiP1Arm5vSvp /QS9Fv8amdLJYp8iTkDydBJ5IPH/tM9qTtphAaPGdbrGtq0Of9/6GjNhi 35/OSkAaVKhfz0XAHzp9LbIrEu1AMw3V2qSwvlgguvnPwRdO77BSpQ//1 p9s+D2KovF1NpZqc7mRRJvDotkJSjtR+Fa/vrvmZfdNk+ydpV/C3Y3kJS IFBg5Jngllqt/lXErrHXWBsmFcZHld14khMxBJ+/TcpFJUCjrzPMfPoPP jUKJdAd1oig1+eZnmn9LgyLpTOTlVpHkSzf5ThzcFEYiT+kmuVl2W3+NQ A==; IronPort-SDR: yCmXQd5wjhaEVJWdruSvhbJBvEXhC+Btb4+F4aXh6k5zZYB6HX6xC9LeXtbTzCoVKe+knOguhs DRuZVBJyg6BhFcQza6Jgck08nVj4PigtQriJdvZGuKImBjx96zogBWB8k1IlWuIkfSPfzqcqVA Zg9AKgFI2h8jJKSo5HQnedW9F2hARn8mw86K/8VMvssqB/DMLj5Jd+OsdZKQR7QZKuFccloo0M tAbby7fC59vNSVeGCyhHywgkOfNXJISyybFI4hLeOOsylCERAtcDLxz3h7p6AXrm3RzM9bk05T Izw= X-IronPort-AV: E=Sophos;i="5.83,277,1616428800"; d="scan'208";a="172653640" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 16 Jun 2021 19:28:26 +0800 IronPort-SDR: d2/9KKYyTCaAbSEShE3vMf9nI0wNArUFXIrqmIbIk0zuZhDhH335MbGTxmgmcDLq/6LYaEpCQH V2Mb4V1wXpkpx91fCi29BesLL84SS/QEjqSzEMon+QZ4EYZVLd0OJLaWi1dqQ3S1TfJeh+envQ 9jlhxQS1qyr784rITAl4Q6YCOtYNA/T1JGkSOVYlmtD033j2TfW5cGnNw5uzHNagPWXn3Mazu8 JDDpot8mhLEAJaQYQWJN0RFk/7oBg0qKbkYi9/1DSt+erXICnAL5FThNV+dIhJTe4zwlad51Zp FGMf/tctJeaV2zXkaI+Rz3WK Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2021 04:07:16 -0700 IronPort-SDR: A2vqhEIDRK/0wFXZ118GlQpZQgZZs/qOlE4ofgSyvVowxTZ6QvEEg92v7E6CElBmuZnkuLB6AY tktGWgA7CehWbs4p5omXKjeknfgQ09sm6T8az6slQsyet4undwJrOBbX0gSQxBm6dTCB7hDAZr wG4Gwnr3VbKsJ/tQAWbPzRZ1Mm1eS8KHWz+dc5oadctnhHEGH1OZLqrtd5XnUmQL3cezt6LrJS /ifSNQY3FP590509Eg2F++diIStI4Dg2U9ZvZv3iAL+CGufaiiSNupO/PWCrXA1n0bNG8i8Q0u 1/c= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip01.wdc.com with ESMTP; 16 Jun 2021 04:28:22 -0700 From: Avri Altman To: "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, Bart Van Assche , yongmyung lee , Daejun Park , alim.akhtar@samsung.com, asutoshd@codeaurora.org, Zang Leigang , Avi Shchislowski , Bean Huo , cang@codeaurora.org, stanley.chu@mediatek.com, Avri Altman Subject: [PATCH v11 01/12] scsi: ufshpb: Cache HPB Control mode on init Date: Wed, 16 Jun 2021 14:27:49 +0300 Message-Id: <20210616112800.52963-2-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616112800.52963-1-avri.altman@wdc.com> References: <20210616112800.52963-1-avri.altman@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will use it later, when we'll need to differentiate between device and host control modes. Signed-off-by: Avri Altman Reviewed-by: Daejun Park --- drivers/scsi/ufs/ufshcd.h | 2 ++ drivers/scsi/ufs/ufshpb.c | 8 +++++--- drivers/scsi/ufs/ufshpb.h | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 90aad8393572..0b4496c1af64 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -652,6 +652,7 @@ struct ufs_hba_variant_params { * @hpb_disabled: flag to check if HPB is disabled * @max_hpb_single_cmd: device reported bMAX_DATA_SIZE_FOR_SINGLE_CMD value * @is_legacy: flag to check HPB 1.0 + * @control_mode: either host or device */ struct ufshpb_dev_info { int num_lu; @@ -661,6 +662,7 @@ struct ufshpb_dev_info { bool hpb_disabled; u8 max_hpb_single_cmd; bool is_legacy; + u8 control_mode; }; #endif diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 69c2450ef650..61f4fcf6bc07 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -1608,6 +1608,9 @@ static void ufshpb_lu_parameter_init(struct ufs_hba *hba, % (hpb->srgn_mem_size / HPB_ENTRY_SIZE); hpb->pages_per_srgn = DIV_ROUND_UP(hpb->srgn_mem_size, PAGE_SIZE); + + if (hpb_dev_info->control_mode == HPB_HOST_CONTROL) + hpb->is_hcm = true; } static int ufshpb_alloc_region_tbl(struct ufs_hba *hba, struct ufshpb_lu *hpb) @@ -2301,11 +2304,10 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf) { struct ufshpb_dev_info *hpb_dev_info = &hba->ufshpb_dev; int version, ret; - u8 hpb_mode; u32 max_hpb_single_cmd = HPB_MULTI_CHUNK_LOW; - hpb_mode = desc_buf[DEVICE_DESC_PARAM_HPB_CONTROL]; - if (hpb_mode == HPB_HOST_CONTROL) { + hpb_dev_info->control_mode = desc_buf[DEVICE_DESC_PARAM_HPB_CONTROL]; + if (hpb_dev_info->control_mode == HPB_HOST_CONTROL) { dev_err(hba->dev, "%s: host control mode is not supported.\n", __func__); hpb_dev_info->hpb_disabled = true; diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h index 1e8d6e1d909e..dc168ba08a09 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -228,6 +228,8 @@ struct ufshpb_lu { u32 entries_per_srgn_shift; u32 pages_per_srgn; + bool is_hcm; + struct ufshpb_stats stats; struct ufshpb_params params; -- 2.25.1