Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3016753pxj; Sun, 6 Jun 2021 23:16:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9w207WqUzjYL5mzbM3URQFhdrX6jm209TZvFK1hQa4aE06kdmyXRlgwR1GC1Qu9900iFd X-Received: by 2002:a17:906:c0c9:: with SMTP id bn9mr16552911ejb.7.1623046600865; Sun, 06 Jun 2021 23:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623046600; cv=none; d=google.com; s=arc-20160816; b=bYcpXN6AS4OXoHg7Phe9sy1uaRIBlPQRvo8gYRSnbPWapb/t2018uoGqO5PvTGAAfp zFrNNT8/TZQl7VK12BWD57l21IgkHkGGurIi7nvDIhDrsvU0cK8O3pAWdAzbRKI0J0nV 7HF4mVNNBhkxUqOoFUpnOx1PmEn5XdMB4qliq2yV9mA1b0wZtKDwN0OBYgLeZY9sfAJ7 qywURUimc7FNLZL2Wst0V/NpUCCwF3XJJoa5DZqs/43Q3/iZ9DtNfOj2ZbirKCtyO8G2 7O16I5lYK3uIn2F+NhBK66W+QdJz9W+71RdLQjhLJJUYszgFZFOKPqcHR8fxzOn+eVrO Ks8g== 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=1AMGmrG5K8GGf+6DQoD1CRci2SoVCWz4/4WwnDaa9mQ=; b=utiz8g9DfZdzG6obab4AKItLpIkH6IUfeeL/92WfAzuYCwA6aEewpLg4GDV48Afv26 ymDvoaHXwWICBXOv9LbF+fD9QPxVg7CouU4q5zQ5E4gHf7+0oofoA1XSj1ZXrxK/08Sz sR8abZhnVNE9ry0EPiAVskYVhGn4qVwBbqGSEU1WB4sLoa+1xIXP2wg3+sBZtLvRZdgZ H8Pn6F/FNOicFXWF3ZWdyFMgXu+VlPjfjDtwgQjZkOD3FSiecoZx1JoZb9wtiGZDr7Cj ked2va7No6gCn1rtk2touf0GuV6ytjNf9Lp3SO5rVLmhudtS8vCU5yesJtxt6hbs6Uf0 VOYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=RoZAs8uC; 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 26si11809770ejk.419.2021.06.06.23.16.18; Sun, 06 Jun 2021 23:16:40 -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=RoZAs8uC; 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 S230200AbhFGGQX (ORCPT + 99 others); Mon, 7 Jun 2021 02:16:23 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:10219 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbhFGGQW (ORCPT ); Mon, 7 Jun 2021 02:16:22 -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=1623046473; x=1654582473; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o1RBvppYbzo9lDI/z75bmk4RKInfGwbwTZ8ujyGC3aw=; b=RoZAs8uCHx+3/cBE0Qw6EXjRifINxhCQvVidO9SmwBGXRU47CuubHCRp zNIpx8NpmP7fvV0f+S5vobUEytCemAxIGO1Q+2IFr5ZZossqKfgbEn3x7 prloZUGX051gDXVkp7I8lE+OYp3YUomc7vamsf5VkH4hw5LRkj6xSWkM3 CY3vc0xAxPV25++IIQ4G2xANy3h+iz3FXP728zsA9+CN2HCvuHLrHmGkA gAXUSv3FB4js7FkgE6EYnI4iLyEVnPYIvXT+JotAWpAqSux801lpVsqc1 2ljjSQ2C1qeVycPZsI+ZqrsFjmnB9R3i2MSIgKILRyZ0XBlVN9y7Wup0Z Q==; IronPort-SDR: JC07m2JjR9tmqo+I2qj1o981+/phkEFBixBLSVQdG6f+78P2t+c9tc7+Kb4vX7xoD6yr6CycE4 2BVcxjoJE6NjSn8sQFeysOV05Nw0w1N4N0HIDPGWMHL8gUkiCCbX60nbmsYQDHEzXzclHBToJC aWlQUO+lf5/KY/XvGhXre4m0oIQmEQHS4xdwpOAgyE/wMi/nHVzTrVPujOc83Gptb6xUsWXRFr JqxWJraoSJV35M23HpsRMVZaOFDDl0bIUJpHOb0ZbG4/3/5WAhnFM+0+FhyAPu5S/HQVfadcL5 OZA= X-IronPort-AV: E=Sophos;i="5.83,254,1616428800"; d="scan'208";a="274818153" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 07 Jun 2021 14:14:33 +0800 IronPort-SDR: rcAT6/V8oUJkdO02OacMW7NVJqTdlhGg4GKrUgNzkKQdoaQDD2Y2aW0x9nUhsT386kSIvsQgdv eg+pol60/fgGASoEM/X7M2K/TcNjrw0GLavDFGAEZQMVnqhb5fD710x+pMs9Q/L2euZYmg1tCo RmaAcnWJl43eQMF7t73K8XDMdG0AntdUwBZaZ61kE9GRMj1XTI61nzLXAHhecB9EES4O7OpUlL JckiLz7Ei9l1UzOft7vkZkpmqHso1IHHKm5SSbnkHfKdXotA1s9SAA0TIIVU6J983LNg8bDtSH IRTbviuk18ejEPcH9J20Y5vZ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2021 22:52:14 -0700 IronPort-SDR: 2s17Djd8Ysi0bpPd0spPJ194ckYRbvj4+ZoXsTqLOQ5Yx6zD/AuVixJn+XWh//PwanHN9moC13 XyphAhlDNQij241IY4rEcl1Nyg3tsbxxAVnxP/+0lAC+HJNE5oAZVYwQSCuxZzErviCVqv3MTZ 77L0gqKQtco8Vk09vibHTBfmXYhjuoYas45hIQiozOVQ92y7T2/MwRPSWh4VzVVW1x0oO9moLF 4cRPWD1IXCptHV4ddEQEntJVX+JRge53brS4D9Nc+pGQckdXcDTk1vt3EAlmv11IuaC3rHZdzb 6h8= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip02.wdc.com with ESMTP; 06 Jun 2021 23:14:28 -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 v10 01/12] scsi: ufshpb: Cache HPB Control mode on init Date: Mon, 7 Jun 2021 09:13:50 +0300 Message-Id: <20210607061401.58884-2-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210607061401.58884-1-avri.altman@wdc.com> References: <20210607061401.58884-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 d902414e4a6f..ccb1bccf6380 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -654,6 +654,7 @@ struct ufs_hba_variant_params { * @hpb_disabled: flag to check if HPB is disabled * @max_hpb_single_cmd: maximum size of single HPB command * @is_legacy: flag to check HPB 1.0 + * @control_mode: either host or device */ struct ufshpb_dev_info { int num_lu; @@ -663,6 +664,7 @@ struct ufshpb_dev_info { bool hpb_disabled; int 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 1e60772be40c..d45343a00e9f 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -1614,6 +1614,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) @@ -2305,11 +2308,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 b1128b0ce486..7df30340386a 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