Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp123808pxb; Tue, 2 Feb 2021 00:34:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoUn73jkuIoteC2A53cehP5jsLrVZyGH5+iy60EDnm8E8YsPvKbRuDoECUXxvAXoZrmbtL X-Received: by 2002:a17:906:33c5:: with SMTP id w5mr21883385eja.319.1612254865116; Tue, 02 Feb 2021 00:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612254865; cv=none; d=google.com; s=arc-20160816; b=NHheyRtvZLRfm16f8CTqHTLTAtDFH1LXUlwAz+Y+eI0E4VMZxI33ssfqykNWIFz0OT heN3cDqMFlbeIzgpuGBuyV/ad7TZ3id/ULO0Y4v3lMRPDdFdtarO+4vBbqSIbSQYfwPh FBTf23/SF+iQm7mDiMAV5kx6bUMLvc//cRurLRlp2zcePbS5pEP23AW/IHEJhwLkwQmj n/cckK6ej0OWWfuXHGXC+u3E0EUVfktaAJcn2r6m7mSWWf7pxbZlgBCQxGHPsqhX0/UJ 0JtsDaVESfIqOOy5SBjrXwitSvPEhJ0pglOfNyx7bfel66cSTbKKJkcpDzToc3q02aM2 zpuA== 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=m6sOg3a65m3D0uLhGyXQS9q2HLAWcL9aDNFjykKCuIQ=; b=b0vpPKeinB5SQOhnRZ4M6QA0jhOSX/nmxgR8o/4o36jdMfabfq5hlZhOjzv3dM/EQ2 i4d3l5s9nwuKhd8Qz6fcWSMbR4TaSJ09qNIiHBWjGX8Faw/ysYW917RyNN+MAe0BR6fB eE5Dcc0LpHjPuGMW6a8VS+C19eEZA6YlcJGz4byd982FwN2HyHJQl91VwKYQugeNxnOf k/eN8reD6+D1rSQvNaG0O6u9dRimp6NFEMYhxkLfMRSlTQBlLq2sookY164ZZndg/3Dd c3wvac8ZNj7QeepcEAF4anDtjcLPM47gyea4i0I0jE6HDxVTGAe+0sPgm+SCJZeMFESQ kMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=QOWix0hA; 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 u7si12336558edx.172.2021.02.02.00.33.59; Tue, 02 Feb 2021 00:34:25 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=QOWix0hA; 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 S231987AbhBBIbm (ORCPT + 99 others); Tue, 2 Feb 2021 03:31:42 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:61777 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232643AbhBBIbi (ORCPT ); Tue, 2 Feb 2021 03:31:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1612255195; x=1643791195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0AjtmRJZexTaXO2vUjsyEA72SNrDJfixMJbAY5nTV0w=; b=QOWix0hAJEQm9gX88DiFxeWHbdSpJaIxjuc7UzELc2TyxgIoQHZVI4Fo rw1fviMXJOgmT0TmbX4Bsx7Owob3HBQqTQbto2yS83WUF6RPUeNRyVWer clW4nNYMa4r02YJuO5hvRlOm+tdL+bnI5/2KWBerobYJcYeTWNCsK2n4V sqjV00NC0lAuKcW+9xnKJWPnQ1vQciic4w2MsNSAJldH2K46DW7KUw+jW GaEHq7steODC6fqWdamKoZxFQ3GPUIUdeJ6Hrn3CJ9HOyj8zgmYBKKAHJ QeeTLwy0iZ4EOKk9VmUhdLlRjmPZHiSkENrznFSi7ojHInTc2MwwZaNKE A==; IronPort-SDR: 7C8Wq3wFK85m8kcXA7SCIkJEptolEYXv01sbsmTaBciR8mCNXa6VJd+nZ8qRrXjHRlutJceRx3 H/cm75/jHr3lEjiWfLEx9mYiupuI/2ZiJXCSy2YgG2pq7l7RnhLoxHWdQ6XgIEtkeUmoSDFwEb ReS0fKM75rdn2ZMRrNmrcbglCBIcBIhiRpbFfXOd+kuCCUlmXfXVv48TYQ2gt+JoCoFq7cku+t At7Z1dmTt4gqdrJFOgj7ZP9QcG810lJD7xQP97FSUnEeEhZBXNvisu+pA1oquX9RAF1dUluOu1 kms= X-IronPort-AV: E=Sophos;i="5.79,394,1602518400"; d="scan'208";a="262976940" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2021 16:38:16 +0800 IronPort-SDR: l8nHQoPpfV+UUfQ5x4CV/s9K5av4esijLsz32V2JoQ6I6iqpF34k7jp0jJkCAAwYgpdpplekDa b+mAPSS6jV1wm4oN0N8oZOJvivNlXU/vs8Jt7QJi17LPkPEDVLEt+rvtuN5++rzh2HeB4fEphV FkWcmRpKs+TcQFt2EDhZVgMqR7S9rCrr/rDg4meUKpibHR9kUwmvsIrJdWTzvVg8YzpMth8m9l 4kbJGiTJ12a8owN2Ypziwmk9iJNWvdybxi+DLShjPj34+zIGeOykrSo0aGq3prneCXXhbkQoZ4 fnkohmWPpEMpw/QBOyUcDX+f Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 00:12:40 -0800 IronPort-SDR: 8xhIZr8DTJ/b700KnocG2yBamqsRnjF2btetWxLAFz0uQ7Evw5Whiqb0CR3blDgeu+HsqyX+yi 6gKsbmUP2qCv7k8hFoa2cSCbI6p9bOr6Gj5EyqbyrhAaSu9oOFzDtpMXJBvmXygYdMVI0TSCWn 3l4DE8nUvQclf3aAoNGaQAANc9dnZswCnBSsFWOgOzjxS7kHSYNqCbfzepxbwFSVIAGfmm7CrF uRV3xwXR7QbLKVC1763bmFggGqO5DZhuw/LLAct0mPI3QeaeGhVIH98ERWW8Ang8QKutQlmGdK Jdw= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2021 00:30:28 -0800 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 v2 1/9] scsi: ufshpb: Cache HPB Control mode on init Date: Tue, 2 Feb 2021 10:29:59 +0200 Message-Id: <20210202083007.104050-2-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210202083007.104050-1-avri.altman@wdc.com> References: <20210202083007.104050-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 --- 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 961fc5b77943..7aeb83b10c37 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -654,6 +654,7 @@ struct ufs_hba_variant_params { * @srgn_size: device reported HPB sub-region size * @slave_conf_cnt: counter to check all lu finished initialization * @hpb_disabled: flag to check if HPB is disabled + * @control_mode: either host or device */ struct ufshpb_dev_info { int num_lu; @@ -661,6 +662,7 @@ struct ufshpb_dev_info { int srgn_size; atomic_t slave_conf_cnt; bool hpb_disabled; + u8 control_mode; }; #endif diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 73e7b3ed04a4..46f6a7104e7e 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -1128,6 +1128,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) @@ -1694,10 +1697,9 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf) { struct ufshpb_dev_info *hpb_dev_info = &hba->ufshpb_dev; int version; - u8 hpb_mode; - 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 2c43a03b66b6..afeb6365daf8 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -186,6 +186,8 @@ struct ufshpb_lu { u32 entries_per_srgn_shift; u32 pages_per_srgn; + bool is_hcm; + struct ufshpb_stats stats; struct kmem_cache *map_req_cache; -- 2.25.1