Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1044235pxb; Fri, 26 Feb 2021 00:39:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCYu2r0e4k6sIKGgfEcNVGV2Q0t7fUh6C+6T16PSyAi8sG3n5eKZhjteOu7WlM3ioxb6CE X-Received: by 2002:aa7:c881:: with SMTP id p1mr2079516eds.249.1614328783559; Fri, 26 Feb 2021 00:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614328783; cv=none; d=google.com; s=arc-20160816; b=C3y0+kZXUyWZYIXy2A0OYqPt+5Bg8YZOjKSY+qcJYR0yflq52Udy7bw0Eez0xeeD0L msNEaFhyQmK7dxr4lEGpudwQIdE8qnlxXNZ8kYv3mjlgeDbFRO+Zv73wXPe1KwqqRiyw BhptA3CAGep0p+0HA1RWsQhAuxjnUmMib7zEngRc0GMH72wXNV4YvQgM7xql8PnxncHM Jb20JCKXLf2YZ8d3szsTIQYj09OGts4FNeT49NJ69pmSy9OLHMI1CWPJ30GUMRzclkSK iso0QwExWOHngA81A8HiNav9Lx429GDZu4bVWgmdqZbgJ0e+miq+lV2hsbSJIgc2YZmU 1sQw== 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=YuiWrkKPkaLy1iPNVFm/wqlfFiu0mWc5yw0YGXi8t5k=; b=aCtq9y7uFvqgnjxlwqTV6y4dYS2Pdq6FuEfMXOugj3uIrlvW7hlxL2jksdtYxbm4bn hXz5jMqf9woAR0bUAKDkrL6tFjDqweQgTm+pqMPai28XntatKe6KF4v05y7UTHxeJXpV PSu209g8wwPJCEWzGhQxbrX+Fs0e4hNhKjYxyDRYgHybXdyiRxbkqmrTZuBAeZUQnGOn Ol2+16AJEebR0bTjsSHaKbbpTi3sLunZ7YvtVg54f1sTiPJE8XVgHIXVVHnJ5gEKQ7X2 pC5h/Z9Jyq1S7MewzCiLud6qHkHCeeENAQxqbV4pLmexQxsF1GEEtcnWAOR5HHwvmmlX ZLvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=Wr1Ahlss; 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 ao9si4928683ejc.331.2021.02.26.00.39.20; Fri, 26 Feb 2021 00:39:43 -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=Wr1Ahlss; 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 S230022AbhBZIg6 (ORCPT + 99 others); Fri, 26 Feb 2021 03:36:58 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:52788 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbhBZIfo (ORCPT ); Fri, 26 Feb 2021 03:35:44 -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=1614328543; x=1645864543; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o/fwaHoIdF5RuyvmSwRscwZHOHJtzyQhBfHY/UPlgcY=; b=Wr1AhlssT4l9z8chgjplmQFMHtKxPyxhQsxE9cdcL0n8pV9zgtTb+0K5 wugzf6kHuPkSzJRRVw6jdSvaUZmqUCIWjG9l1fyf5FIdO+hOik9FUBh+s E5yIssgvUfOdEzAyFyaeBHMp4kWITv1oTw5PyyA8cty/l40c+oe7deMUE Un8LdjWZ8M98t4q/i7ou4BLNbqtsW8YuoVFculR54wg58uUHSywTypGaC jX1jhGtDuVYrKgX3abixQvmCa+jV2KtnGtyaHPFZgVvWFRU6DVHaS5Hj+ HiRboI53dFtmIMZINkO9NKTFJmpA82WpbNQ4+mKLtOPSjVR0nfCSP4wLY g==; IronPort-SDR: V2h4FP99P1WTZLuKNgIAdPYrhN3bT3a/g32uBGlMe05UMYtmQ8F4Xe5RCJ2W3kOr5CgRR/ekx9 DuqtBzn0Tr2ySz163GC8XEbd2Gaq35Hsx8yYFUYZnR9/LysLmzbiYcssid+Z1iWCSfR4DmO6kh R+6eYrzvYgYeGe+ZdZcFd35rvsp9vm+MYqZGjEbFfE9PgbTg2at4hiLfnC+ofgqJuiQN0bqUZw z5gIdSxaLJE6kKgaWBJu9P8VbwcjeMDKQ9outmfcpjgd4pV4KM0c/PKtlKfSHMlQEzTNGW8arq JXo= X-IronPort-AV: E=Sophos;i="5.81,208,1610380800"; d="scan'208";a="160859671" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Feb 2021 16:34:36 +0800 IronPort-SDR: QdOzhaGpNd6yZeREt9yMP7T1eTnQ4T5Z5BN9IqL6eD0MVGemTn7UxzvTy2AFsO/VJjcrn2efmg GeAxXLpaISEIRzn2qoy/ZrqFc3K3xb5AhHaYveFIrSS6Gco+hgD9RI27hqUv6d9dwQF94/ggHI RjAWE840u2OJEohGMLwDfKHPNl+PwGnFwdwGXDE8annx2Le13KjPKdZEZXW73Xf1GC2baldHOv l0F4qB9CdL4jeTiU7uu3146yw6uHkPi/1cbPgDHRcgkNsSq1nFEGQm/JCxgjrGB9QPXhmISHbb cgVYmfxcs+yIv8iqiPOgRGYR Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2021 00:17:49 -0800 IronPort-SDR: VZvWwkNlPWjU9W8G4SfPd9X8FFxYyWwl/pfpeqUWsxdkhIs/wVX0JJhy/zbDFXDqIC8TWiR6zs VZnVx+YCyA2JfyXsCz0AVdNoil6Uzcp88XmDp5WtAwEX6NIJILyhys5FhEmDv3CcivueamyQxF UPxbbmbnzgzkvwxPet3rNZzQ1khvCXi/ZGeOwGwa63Wb8rTC6ogVFSLJkzSsFdeTMj6Zdd8FiO E+Y6sG8CQ92FNA/IavjfxlpvpAOpsdL/DtijZoCNiRdhl+PdLBxZHy1Rr2crz0m7bDqnnPpTl8 jt8= WDCIronportException: Internal Received: from bxygm33.sdcorp.global.sandisk.com ([10.0.231.247]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Feb 2021 00:34:32 -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 v4 5/9] scsi: ufshpb: Region inactivation in host mode Date: Fri, 26 Feb 2021 10:32:56 +0200 Message-Id: <20210226083300.30934-6-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210226083300.30934-1-avri.altman@wdc.com> References: <20210226083300.30934-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 I host mode, the host is expected to send HPB-WRITE-BUFFER with buffer-id = 0x1 when it inactivates a region. Use the map-requests pool as there is no point in assigning a designated cache for umap-requests. Signed-off-by: Avri Altman --- drivers/scsi/ufs/ufshpb.c | 14 ++++++++++++++ drivers/scsi/ufs/ufshpb.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c index 44e56a6d7102..cf704b82e72a 100644 --- a/drivers/scsi/ufs/ufshpb.c +++ b/drivers/scsi/ufs/ufshpb.c @@ -908,6 +908,7 @@ static int ufshpb_execute_umap_req(struct ufshpb_lu *hpb, blk_execute_rq_nowait(q, NULL, req, 1, ufshpb_umap_req_compl_fn); + hpb->stats.umap_req_cnt++; return 0; } @@ -1104,6 +1105,12 @@ static int ufshpb_issue_umap_req(struct ufshpb_lu *hpb, return -EAGAIN; } +static int ufshpb_issue_umap_single_req(struct ufshpb_lu *hpb, + struct ufshpb_region *rgn) +{ + return ufshpb_issue_umap_req(hpb, rgn); +} + static int ufshpb_issue_umap_all_req(struct ufshpb_lu *hpb) { return ufshpb_issue_umap_req(hpb, NULL); @@ -1116,6 +1123,10 @@ static void __ufshpb_evict_region(struct ufshpb_lu *hpb, struct ufshpb_subregion *srgn; int srgn_idx; + + if (hpb->is_hcm && ufshpb_issue_umap_single_req(hpb, rgn)) + return; + lru_info = &hpb->lru_info; dev_dbg(&hpb->sdev_ufs_lu->sdev_dev, "evict region %d\n", rgn->rgn_idx); @@ -1861,6 +1872,7 @@ ufshpb_sysfs_attr_show_func(rb_noti_cnt); ufshpb_sysfs_attr_show_func(rb_active_cnt); ufshpb_sysfs_attr_show_func(rb_inactive_cnt); ufshpb_sysfs_attr_show_func(map_req_cnt); +ufshpb_sysfs_attr_show_func(umap_req_cnt); static struct attribute *hpb_dev_stat_attrs[] = { &dev_attr_hit_cnt.attr, @@ -1869,6 +1881,7 @@ static struct attribute *hpb_dev_stat_attrs[] = { &dev_attr_rb_active_cnt.attr, &dev_attr_rb_inactive_cnt.attr, &dev_attr_map_req_cnt.attr, + &dev_attr_umap_req_cnt.attr, NULL, }; @@ -1984,6 +1997,7 @@ static void ufshpb_stat_init(struct ufshpb_lu *hpb) hpb->stats.rb_active_cnt = 0; hpb->stats.rb_inactive_cnt = 0; hpb->stats.map_req_cnt = 0; + hpb->stats.umap_req_cnt = 0; } static void ufshpb_param_init(struct ufshpb_lu *hpb) diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h index 2fbe928ae7fd..b78ccb67b765 100644 --- a/drivers/scsi/ufs/ufshpb.h +++ b/drivers/scsi/ufs/ufshpb.h @@ -186,6 +186,7 @@ struct ufshpb_stats { u64 rb_inactive_cnt; u64 map_req_cnt; u64 pre_req_cnt; + u64 umap_req_cnt; }; struct ufshpb_lu { -- 2.25.1