From patchwork Fri Jul 29 04:52:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C2F7C00144 for ; Fri, 29 Jul 2022 04:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbiG2ExB (ORCPT ); Fri, 29 Jul 2022 00:53:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiG2Ew7 (ORCPT ); Fri, 29 Jul 2022 00:52:59 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A5EB54C9A for ; Thu, 28 Jul 2022 21:52:57 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220729045254epoutp04fe0008aecc1c96d2447bb8c8463b8187~GM7czAWkm2207322073epoutp041 for ; Fri, 29 Jul 2022 04:52:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220729045254epoutp04fe0008aecc1c96d2447bb8c8463b8187~GM7czAWkm2207322073epoutp041 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070374; bh=fsSA4Sh0mG9so9uVC+TBMYuxX7h98OOminCH5vQQ8/A=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=RKBuGzCFkla9p1S4avQMYaiU9zZ/F/xlXe5rVI7tsQ/wS6znIFc5YH7hWaef0+K8Q ROeXnrQo/F2Wva9PMCZQOiOv1/rIsrZV6ZQTXhvQHa0ptIdy69BxX2G2ebIdSEEFu2 614qW5gbw6iNk30WQEZYOMQHlEfFOwPVWKFVzpdA= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220729045253epcas2p1e05e80457c3d97aaec56220731ccd9ce~GM7b5FC-g2692626926epcas2p1i; Fri, 29 Jul 2022 04:52:53 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.70]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4LvFWT1Bglz4x9QH; Fri, 29 Jul 2022 04:52:53 +0000 (GMT) X-AuditID: b6c32a48-9f7ff700000025be-f6-62e367a5147f Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 69.31.09662.5A763E26; Fri, 29 Jul 2022 13:52:53 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 1/6] scsi: ufs: wb: Change wb_enabled condition test Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> Date: Fri, 29 Jul 2022 13:52:52 +0900 X-CMS-MailID: 20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS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ZjPxN/6t3wu3lm60239r5H298l/r971jehma+F +8VV4WUev40ONj3h3ZjAJbpmz5ljYR6dF6b5xhwM9HiycdNVi2M1FleFHNvsWgPPqU3gqZ3v xVnE8l1UaL337fPWZpNCnd9rGk3jCT1nHNV8l5GraKN28wW/PAmvaJEg2SW/QzImdPa9W/Mo POfPt7nv+1qbP21LUY8Nq7CoTt3RWOPKd9LFWYmlOCPRUIu5qDgRACtJtd0yBAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Changed to improve readability. As implemented in ufshcd_wb_togle_flush(), the conditional test is modified in the same way. Reviewed-by: Avri Altman Reviewed-by: Bean Huo Signed-off-by: Jinyoung Choi Reviewed-by: Bart Van Assche Reviewed-by: Stanley Chu --- drivers/ufs/core/ufshcd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8f11f118c30e..bbf12aa6a5ae 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -5730,10 +5730,8 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable) { int ret; - if (!ufshcd_is_wb_allowed(hba)) - return 0; - - if (!(enable ^ hba->dev_info.wb_enabled)) + if (!ufshcd_is_wb_allowed(hba) || + hba->dev_info.wb_enabled == enable) return 0; ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_EN); From patchwork Fri Jul 29 04:54:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 596A4C00144 for ; Fri, 29 Jul 2022 04:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234017AbiG2Eyk (ORCPT ); Fri, 29 Jul 2022 00:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiG2Eyh (ORCPT ); Fri, 29 Jul 2022 00:54:37 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C5F7AB0B for ; Thu, 28 Jul 2022 21:54:36 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220729045435epoutp03af465d29c0617c07f55ed834434afd61~GM86g-A0A1168911689epoutp03t for ; Fri, 29 Jul 2022 04:54:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220729045435epoutp03af465d29c0617c07f55ed834434afd61~GM86g-A0A1168911689epoutp03t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070475; bh=QDiYBDTeTdIYKBU1cs/MPkuOSczpiCApYohCod9JSmE=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=L6GQkFuuu2Ks1BorW32XwQ5GjslGgzzsljtP1K1AtLyXwVpZfLNMmIKOy8bkYt1Xn Ar0y5hzd71PjaVQ0p/Wzp3976C5JnIc0Rs1jOwwdLzZX9OJmGB5f5WmMPmoOZpzXlU dseCpP1fbrrQ0PPcSzAttrqeTVe5ll5l/vxqJDlQ= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220729045434epcas2p3495ed2b92f2be067dadd9f4c671e2832~GM85hLFnv2727027270epcas2p3t; Fri, 29 Jul 2022 04:54:34 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.89]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4LvFYP47kxz4x9QC; Fri, 29 Jul 2022 04:54:33 +0000 (GMT) X-AuditID: b6c32a48-9f7ff700000025be-b9-62e36809031e Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 33.42.09662.90863E26; Fri, 29 Jul 2022 13:54:33 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 2/6] scsi: ufs: wb: Change functions name and modify parameter name Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> Date: Fri, 29 Jul 2022 13:54:33 +0900 X-CMS-MailID: 20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDJsWRmVeSWpSXmKPExsWy7bCmuS5nxuMkg4+n5S1OPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8fkwOVx+Yq3x+I9L5k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Qf Tn36ddqmxTNld3gqTX2wh+2PFMvl5idJ7qyXlFiKMxINtZiLihMBt6ztyi8EAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The parameter name of ufshcd_wb_toggle_flush_during_h8() has been changed in the same as other toggle functions. Function names were ambiguous. So changed to suit the meaning. Reviewed-by: Avri Altman Signed-off-by: Jinyoung Choi --- drivers/ufs/core/ufshcd.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index bbf12aa6a5ae..a14d3fe39570 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -265,8 +265,9 @@ static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on); static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, struct ufs_vreg *vreg); static int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag); -static void ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set); -static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable); +static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, + bool enable); +static void ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable); static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba); @@ -286,16 +287,16 @@ static inline void ufshcd_disable_irq(struct ufs_hba *hba) } } -static inline void ufshcd_wb_config(struct ufs_hba *hba) +static void ufshcd_wb_set_default_flags(struct ufs_hba *hba) { if (!ufshcd_is_wb_allowed(hba)) return; ufshcd_wb_toggle(hba, true); - ufshcd_wb_toggle_flush_during_h8(hba, true); + ufshcd_wb_toggle_buf_flush_during_h8(hba, true); if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) - ufshcd_wb_toggle_flush(hba, true); + ufshcd_wb_toggle_buf_flush(hba, true); } static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba) @@ -5748,22 +5749,23 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable) return ret; } -static void ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set) +static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, + bool enable) { int ret; - ret = __ufshcd_wb_toggle(hba, set, + ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_BUFF_FLUSH_DURING_HIBERN8); if (ret) { dev_err(hba->dev, "%s: WB-Buf Flush during H8 %s failed: %d\n", - __func__, set ? "enable" : "disable", ret); + __func__, enable ? "enable" : "disable", ret); return; } dev_dbg(hba->dev, "%s WB-Buf Flush during H8 %s\n", - __func__, set ? "enabled" : "disabled"); + __func__, enable ? "enabled" : "disabled"); } -static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable) +static void ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable) { int ret; @@ -5813,9 +5815,9 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, static void ufshcd_wb_force_disable(struct ufs_hba *hba) { if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) - ufshcd_wb_toggle_flush(hba, false); + ufshcd_wb_toggle_buf_flush(hba, false); - ufshcd_wb_toggle_flush_during_h8(hba, false); + ufshcd_wb_toggle_buf_flush_during_h8(hba, false); ufshcd_wb_toggle(hba, false); hba->caps &= ~UFSHCD_CAP_WB_EN; @@ -8212,7 +8214,9 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params) */ ufshcd_set_active_icc_lvl(hba); - ufshcd_wb_config(hba); + /* Enable UFS Write Booster if supported */ + ufshcd_wb_set_default_flags(hba); + if (hba->ee_usr_mask) ufshcd_write_ee_control(hba); /* Enable Auto-Hibernate if configured */ From patchwork Fri Jul 29 04:56:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DD4AC00144 for ; Fri, 29 Jul 2022 04:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234035AbiG2E4G (ORCPT ); Fri, 29 Jul 2022 00:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiG2E4F (ORCPT ); Fri, 29 Jul 2022 00:56:05 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB3B46D548 for ; Thu, 28 Jul 2022 21:56:03 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220729045601epoutp01a5bed11097a55ef01f9154c764a216df~GM_LJsPNj0445404454epoutp01j for ; Fri, 29 Jul 2022 04:56:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220729045601epoutp01a5bed11097a55ef01f9154c764a216df~GM_LJsPNj0445404454epoutp01j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070561; bh=Qvj+FjBZQ2kYi8uDEb/na+Sp3kglKa834J/4CaXXPjs=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=FzBdpK/LwipzPdpQZNl8Q+SM4vEkTp5n9GeQ5ijLHwxf6IoT55lczLfOlJGdkZyMi GDA8DIi/zjaS6yg681nhplBpAKvsqchUtK0+wrsCbzz5zqQlcGaOB2rYsHfIUvLnOj alWYYQJHh8mGtcppMBHNo8we7xGy9iwufW1Kj3S4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220729045601epcas2p3585e66e5eb57a184fff29a5640276d80~GM_Kp_UEU2566625666epcas2p3F; Fri, 29 Jul 2022 04:56:01 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.100]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LvFb46m4dz4x9Q1; Fri, 29 Jul 2022 04:56:00 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-69-62e3686067df Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2D.80.09650.06863E26; Fri, 29 Jul 2022 13:56:00 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 3/6] scsi: ufs: wb: Add explicit flush sysfs attribute Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce@epcms2p4> Date: Fri, 29 Jul 2022 13:56:00 +0900 X-CMS-MailID: 20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmqW5CxuMkg31vNCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8fkwOVx+Yq3x+I9L5k8 Jiw6wOjxfX0Hm8fHp7dYPPq2rGL0+LxJzqP9QDdTAEdUtk1GamJKapFCal5yfkpmXrqtkndw vHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0IlKCmWJOaVAoYDE4mIlfTubovzSklSFjPzi Elul1IKUnALzAr3ixNzi0rx0vbzUEitDAwMjU6DChOyMP3PmMxZsM6p4cP0AUwPjN80uRk4O CQETie4Xy5m7GLk4hAR2MEpMXPGHpYuRg4NXQFDi7w5hkBphAU+Jma/2MYHYQgJKEufWzGIE KREWMJC41WsOEmYT0JP4uWQGG8gYEYGzzBILH05hgpjPKzGj/SkLhC0tsX35VkYQm1PAT6J9 8wI2iLiGxI9lvcwQtqjEzdVv2WHs98fmM0LYIhKt985C1QhKPPi5GyouKXHo0Fc2kHskBPIl NhwIhAjXSLxdfgCqRF/iWsdGsBN4BXwlTh09AbaWRUBVovXoAmaIVheJE8/AXmEWkJfY/nYO WJhZQFNi/S59iApliSO3WGB+atj4mx2dzSzAJ9Fx+C9cfMe8J0wQrWoSi5qMIMIyEl8Pz2ef wKg0CxHIs5CsnYWwdgEj8ypGsdSC4tz01GKjAiN4vCbn525iBCdULbcdjFPeftA7xMjEwXiI UYKDWUmEVyDgcZIQb0piZVVqUX58UWlOavEhRlOgfycyS4km5wNTel5JvKGJpYGJmZmhuZGp gbmSOK9XyoZEIYH0xJLU7NTUgtQimD4mDk6pBqZgI/OfjtHGlYXvXORWaW988vPGNx+1xAd/ l3oonXy6oUNcJVppXsOh+ZtumuWvDTViZj01+biPsO2OY7PYO/5M4Va+d2P5AZPbZwP73p48 6brUbN33Hac4a7t1W6fcYm/wOu7g1838alrcAceNbBePPHVuadswd5q52hnN23lbjolt5Nv1 RjrWfmf2xCtqHHVt3pJc1exrL77/vKX+2vNSbb/Jm1IiX7GztxxYMvvbqW/1r3f3e6gv5GKP yzuiZlNlrfpcvu5cT24b9/O3joZP579iWHOsgNMv02h30a5GofWRG+6uOdwn/thMMeL0R4uN u261LWmovvz6Ib+XxerolnamU/XNP52EDC9Zmu9WYinOSDTUYi4qTgQAz3x4zTEEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There is the following quirk to bypass "WB Flush" in Write Booster. - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL If this quirk is not set, there is no knob that can control "WB Flush". There are three flags that control Write Booster Feature. 1. WB ON/OFF 2. WB Hibern Flush ON/OFF (implicitly) 3. WB Flush ON/OFF (explicit) The sysfs attribute that controls the WB was implemented. (1) In the case of "Hibern Flush", it is always good to turn on. Control may not be required. (2) Finally, "Flush" may be necessary because the Auto-Hibern8 is not supported in a specific environment. So the sysfs attribute that controls this is necessary. (3) Reviewed-by: Avri Altman Signed-off-by: Jinyoung Choi --- Documentation/ABI/testing/sysfs-driver-ufs | 10 +++++ drivers/ufs/core/ufs-sysfs.c | 45 ++++++++++++++++++++++ drivers/ufs/core/ufshcd.c | 9 +++-- include/ufs/ufshcd.h | 1 + 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 6b248abb1bd7..7e9e1db55d60 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -1417,6 +1417,16 @@ Description: This node is used to set or display whether UFS WriteBooster is platform that doesn't support UFSHCD_CAP_CLK_SCALING, we can disable/enable WriteBooster through this sysfs node. +What: /sys/bus/platform/drivers/ufshcd/*/wb_buf_flush_en +What: /sys/bus/platform/devices/*.ufs/wb_buf_flush_en +Date: July 2022 +Contact: Jinyoung Choi +Description: This node is used to set or display whether WriteBooster + buffer flusing is enabled. The data written in the WriteBooster + Buffer can be flushed by an explicit host command or + implicitly while in hibernate (HIBERN8) state. We can control + the explicit flushing through this sysfs node. + What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/hpb_version What: /sys/bus/platform/devices/*.ufs/device_descriptor/hpb_version Date: June 2021 diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 0a088b47d557..920094665f4d 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -254,6 +254,49 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, return res < 0 ? res : count; } +static ssize_t wb_buf_flush_en_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", hba->dev_info.wb_buf_flush_enabled); +} + +static ssize_t wb_buf_flush_en_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + unsigned int wb_buf_flush_en; + ssize_t res; + + if (!ufshcd_is_wb_allowed(hba) || + (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) { + dev_warn(dev, "It is not allowed to configure WB buf flush!\n"); + return -EOPNOTSUPP; + } + + if (kstrtouint(buf, 0, &wb_buf_flush_en)) + return -EINVAL; + + if (wb_buf_flush_en != 0 && wb_buf_flush_en != 1) + return -EINVAL; + + down(&hba->host_sem); + if (!ufshcd_is_user_access_allowed(hba)) { + res = -EBUSY; + goto out; + } + + ufshcd_rpm_get_sync(hba); + res = ufshcd_wb_toggle_buf_flush(hba, wb_buf_flush_en); + ufshcd_rpm_put_sync(hba); +out: + up(&hba->host_sem); + return res < 0 ? res : count; +} + static DEVICE_ATTR_RW(rpm_lvl); static DEVICE_ATTR_RO(rpm_target_dev_state); static DEVICE_ATTR_RO(rpm_target_link_state); @@ -262,6 +305,7 @@ static DEVICE_ATTR_RO(spm_target_dev_state); static DEVICE_ATTR_RO(spm_target_link_state); static DEVICE_ATTR_RW(auto_hibern8); static DEVICE_ATTR_RW(wb_on); +static DEVICE_ATTR_RW(wb_buf_flush_en); static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_rpm_lvl.attr, @@ -272,6 +316,7 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_spm_target_link_state.attr, &dev_attr_auto_hibern8.attr, &dev_attr_wb_on.attr, + &dev_attr_wb_buf_flush_en.attr, NULL }; diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a14d3fe39570..36d4708eaee0 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -267,7 +267,6 @@ static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, static int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag); static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, bool enable); -static void ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable); static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba); @@ -5765,25 +5764,27 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, __func__, enable ? "enabled" : "disabled"); } -static void ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable) +int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable) { int ret; if (!ufshcd_is_wb_allowed(hba) || hba->dev_info.wb_buf_flush_enabled == enable) - return; + return 0; ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN); if (ret) { dev_err(hba->dev, "%s WB-Buf Flush %s failed %d\n", __func__, enable ? "enable" : "disable", ret); - return; + return ret; } hba->dev_info.wb_buf_flush_enabled = enable; dev_dbg(hba->dev, "%s WB-Buf Flush %s\n", __func__, enable ? "enabled" : "disabled"); + + return ret; } static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 7fe1a926cd99..94bcfec98fb8 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1211,6 +1211,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, enum query_opcode desc_op); int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable); +int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable); int ufshcd_suspend_prepare(struct device *dev); int __ufshcd_suspend_prepare(struct device *dev, bool rpm_ok_for_spm); void ufshcd_resume_complete(struct device *dev); From patchwork Fri Jul 29 04:56:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A36DC00144 for ; Fri, 29 Jul 2022 04:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234037AbiG2E5D (ORCPT ); Fri, 29 Jul 2022 00:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234027AbiG2E5C (ORCPT ); Fri, 29 Jul 2022 00:57:02 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F1287B795 for ; Thu, 28 Jul 2022 21:57:00 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220729045658epoutp02134bd5dbcc151d77a0a90c8d21b7611e~GM-ACiXxN0801408014epoutp02_ for ; Fri, 29 Jul 2022 04:56:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220729045658epoutp02134bd5dbcc151d77a0a90c8d21b7611e~GM-ACiXxN0801408014epoutp02_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070618; bh=gW7j82RhlhznlAP4QTs59f+Tb5vwBEAzdSOhNq4apdk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=BWegHYhXI2qrzsl3iUTt5sa45WC6fCtz53W2W4Iuum57RlVEU7zZginU98lh2da4T GxbqkOHaK1FP7Ig53dinRVFn5Gm3ZCtlANtXAdYS5UZQ6B245+WjVH9MGG0y6vX+lI +qs0iynAke+qnnF6vN4ixEMlQ83W8M9z1XQTVIwc= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220729045657epcas2p1c2447fe304552907a3ea0ec4c05574f4~GM__2Ndvl1958819588epcas2p1j; Fri, 29 Jul 2022 04:56:57 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.92]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4LvFc85zYGz4x9Q8; Fri, 29 Jul 2022 04:56:56 +0000 (GMT) X-AuditID: b6c32a48-9f7ff700000025be-e8-62e36898d73c Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 09.63.09662.89863E26; Fri, 29 Jul 2022 13:56:56 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 4/6] scsi: ufs: wb: Add ufshcd_is_wb_buf_flush_allowed() Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045656epcms2p1e6912ae09ca2122d4d04854878e19b2c@epcms2p1> Date: Fri, 29 Jul 2022 13:56:56 +0900 X-CMS-MailID: 20220729045656epcms2p1e6912ae09ca2122d4d04854878e19b2c X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmhe6MjMdJBn/vaVmcfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBYvD2laLLqxjcni8q45bBbd13ewWSw//o/Jgcvj8hVvj8V7XjJ5 TFh0gNHj+/oONo+PT2+xePRtWcXo8XmTnEf7gW6mAI6obJuM1MSU1CKF1Lzk/JTMvHRbJe/g eOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoBOVFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnF JbZKqQUpOQXmBXrFibnFpXnpenmpJVaGBgZGpkCFCdkZszf/Zi74LFwx+fBRtgbGiYJdjJwc EgImEpP+bGbrYuTiEBLYwSjx/M9Jxi5GDg5eAUGJvzuEQWqEBbwlus60s4PYQgJKEufWzAIr ERYwkLjVaw4SZhPQk/i5ZAbYGBGBs8wSCx9OYYKYzysxo/0pC4QtLbF9+VZGEJtTwE9izYSZ zBBxDYkfy3qhbFGJm6vfssPY74/NZ4SwRSRa752FqhGUePBzN1RcUuLQoa9sIPdICORLbDgQ CBGukXi7/ABUib7EtY6NLBBf+Ups/hgPEmYRUJWY9mwJK0SJi8Tnh9/ApjMLyEtsfzuHGaSc WUBTYv0ufYjhyhJHbrHA/NSw8Tc7OptZgE+i4/BfuPiOeU+YIFrVJBY1GUGEZSS+Hp7PPoFR aRYikGchWTsLYe0CRuZVjGKpBcW56anFRgUm8HhNzs/dxAhOqFoeOxhnv/2gd4iRiYPxEKME B7OSCK9AwOMkId6UxMqq1KL8+KLSnNTiQ4ymQA9PZJYSTc4HpvS8knhDE0sDEzMzQ3MjUwNz JXFer5QNiUIC6YklqdmpqQWpRTB9TBycUg1MdfZFS6derjDkPJQVPyH87sUJc3b2P36n9vP3 Ed3T5W0+/MEb/q7tbn51e27osey+02dkv75M53vYrfA3gWXuwVgnLWnOS2ImlbkLe/d4xV+c Oqeu/Z2A7n79tS5v/oVFMxo9apn3+bW0ZOnPdfe8GV6UdbCu2ckjqpkoUn3FlW3fx7MLNnYx nLyzYO6pDz9Mo/nvFpi6LdFlZeoOW/LOcsVtU8u+O5FrHwsZqP0JOxpnEtJw2PaPxdzayk1l 62oYuT5qN33YHORszV/AxPqXfdecn/r+7SG+vjukhT8+uRnq/fY5S9fmjFW85etv3avmCnta rvM48VNsyKmrXZYv54cuFlCxX/aHyz7w3b51SizFGYmGWsxFxYkA5sFQwDEEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce@epcms2p4> <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The explicit flushing should check the following. - UFSHCD_CAP_WB_EN - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL Changed to improve readability. Acked-by: Bean Huo Reviewed-by: Avri Altman Signed-off-by: Jinyoung Choi Reviewed-by: Bart Van Assche --- drivers/ufs/core/ufs-sysfs.c | 3 +-- drivers/ufs/core/ufshcd-priv.h | 6 ++++++ drivers/ufs/core/ufshcd.c | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 920094665f4d..63b02b2541c8 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -271,8 +271,7 @@ static ssize_t wb_buf_flush_en_store(struct device *dev, unsigned int wb_buf_flush_en; ssize_t res; - if (!ufshcd_is_wb_allowed(hba) || - (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) { + if (!ufshcd_is_wb_buf_flush_allowed(hba)) { dev_warn(dev, "It is not allowed to configure WB buf flush!\n"); return -EOPNOTSUPP; } diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h index 8f67db202d7b..d00dba17297d 100644 --- a/drivers/ufs/core/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -26,6 +26,12 @@ static inline u8 ufshcd_wb_get_query_index(struct ufs_hba *hba) return 0; } +static inline bool ufshcd_is_wb_buf_flush_allowed(struct ufs_hba *hba) +{ + return ufshcd_is_wb_allowed(hba) && + !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL); +} + #ifdef CONFIG_SCSI_UFS_HWMON void ufs_hwmon_probe(struct ufs_hba *hba, u8 mask); void ufs_hwmon_remove(struct ufs_hba *hba); diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 36d4708eaee0..584e246c769a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -294,7 +294,8 @@ static void ufshcd_wb_set_default_flags(struct ufs_hba *hba) ufshcd_wb_toggle(hba, true); ufshcd_wb_toggle_buf_flush_during_h8(hba, true); - if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) + + if (ufshcd_is_wb_buf_flush_allowed(hba)) ufshcd_wb_toggle_buf_flush(hba, true); } @@ -5815,7 +5816,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, static void ufshcd_wb_force_disable(struct ufs_hba *hba) { - if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) + if (ufshcd_is_wb_buf_flush_allowed(hba)) ufshcd_wb_toggle_buf_flush(hba, false); ufshcd_wb_toggle_buf_flush_during_h8(hba, false); From patchwork Fri Jul 29 04:57:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31829C00144 for ; Fri, 29 Jul 2022 04:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234150AbiG2E6X (ORCPT ); Fri, 29 Jul 2022 00:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234096AbiG2E6V (ORCPT ); Fri, 29 Jul 2022 00:58:21 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E285B7B798 for ; Thu, 28 Jul 2022 21:58:19 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220729045817epoutp048f203075eb3a9fe00afce541c5c3796d~GNAJZN3zK2522325223epoutp04- for ; Fri, 29 Jul 2022 04:58:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220729045817epoutp048f203075eb3a9fe00afce541c5c3796d~GNAJZN3zK2522325223epoutp04- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070697; bh=C+qSLm27xL/o9+bgBetSUvgtuKdhEToUNH31soKQtxs=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=cyi5z6S+dJNaAAcZAD8EIUkR27xhBe96YXAfBnH1P4DScTkM+2Nt1fGJIpUTMq+sV d2yH8n/YFlxiQDqAqLraWUBlW8YC4vIc4xKM74+MY946xTAnk9x22IqHlyWDe5/Q22 dkCkmUFhGF6s2U8eRMJOrpzNXfLd5UINn6NA/8bs= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20220729045817epcas2p3c3b6e7d56f8b7d37d5a9342fe5289bc8~GNAJAv0k01591215912epcas2p3B; Fri, 29 Jul 2022 04:58:16 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.69]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4LvFdh4KBMz4x9QR; Fri, 29 Jul 2022 04:58:16 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-91-62e368d49efd Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 3F.81.09650.4D863E26; Fri, 29 Jul 2022 13:57:57 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 5/6] scsi: ufs: wb: Modify messages Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045656epcms2p1e6912ae09ca2122d4d04854878e19b2c@epcms2p1> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045756epcms2p40a1baa2c6bf17772023ccec20aef3f0a@epcms2p4> Date: Fri, 29 Jul 2022 13:57:56 +0900 X-CMS-MailID: 20220729045756epcms2p40a1baa2c6bf17772023ccec20aef3f0a X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLJsWRmVeSWpSXmKPExsWy7bCmme6LjMdJBusfKVicfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBYvD2laLLqxjcni8q45bBbd13ewWSw//o/Jgcvj8hVvj8V7XjJ5 TFh0gNHj+/oONo+PT2+xePRtWcXo8XmTnEf7gW6mAI6obJuM1MSU1CKF1Lzk/JTMvHRbJe/g eOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoBOVFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnF JbZKqQUpOQXmBXrFibnFpXnpenmpJVaGBgZGpkCFCdkZh3fvYCy4L1nx50xJA+NHkS5GTg4J AROJu3dPsnUxcnEICexglDgzaxJzFyMHB6+AoMTfHcIgNcICZhI71+1hBbGFBJQkzq2ZxQhS IixgIHGr1xwkzCagJ/FzyQywMSICZ5klFj6cwgQxn1diRvtTFghbWmL78q2MIDangJ/E018L GCHiGhI/lvUyQ9iiEjdXv2WHsd8fmw9VIyLReu8sVI2gxIOfu6HikhKHDn1lA7lHQiBfYsOB QIhwjcTb5QegSvQlrnVsBDuBV8BXYt/dJUwg5SwCqhLH5kFd5iLx6s1GsIuZBeQltr+dAw4E ZgFNifW79CGGK0scucUC81PDxt/s6GxmAT6JjsN/4eI75j1hgmhVk1jUZAQRlpH4eng++wRG pVmIQJ6FZO0shLULGJlXMYqlFhTnpqcWGxUYwaM1OT93EyM4nWq57WCc8vaD3iFGJg7GQ4wS HMxKIrwCAY+ThHhTEiurUovy44tKc1KLDzGaAv07kVlKNDkfmNDzSuINTSwNTMzMDM2NTA3M lcR5vVI2JAoJpCeWpGanphakFsH0MXFwSjUwCU44LBPgvuRi+cKM3hnhOW999q5mUVabWyCa //Ie/85v1tW72a6vKs6ynVd5ZgHDczc/Bft4Tz9Wj2zXpNIZYRn+SxK/ZRnbfryy7H6g1d0d jrHCsz6EG7Md631U9+fsY4PKXqt9H5Y0v7PUKJjpN8vofYDY627R+c+7tSSf/bltfGrBFINV HKKaSjODC7tOPFSMWSxQXB3x9YyV7JqQz7LOvzdWeEjeik0/L1a4aOlPTbnfbBcmK6y+8q35 a3nB9d1RNVymzT/LzKs7OJ8c/7o/dAXvnR9V3lMO9f6fHmGgEie48MvNow9c73y5Z13M9Y/5 mdTvO7XfmXlO7jdyd5UrOxvMGXhOSnX5Px5eJZbijERDLeai4kQAgfNBmjAEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045656epcms2p1e6912ae09ca2122d4d04854878e19b2c@epcms2p1> <20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce@epcms2p4> <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Messages are modified to fit the format of others. Reviewed-by: Avri Altman Signed-off-by: Jinyoung Choi --- drivers/ufs/core/ufs-sysfs.c | 2 +- drivers/ufs/core/ufshcd.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 63b02b2541c8..35e4f0056de6 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -230,7 +230,7 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, * If the platform supports UFSHCD_CAP_CLK_SCALING, turn WB * on/off will be done while clock scaling up/down. */ - dev_warn(dev, "To control WB through wb_on is not allowed!\n"); + dev_warn(dev, "It is not allowed to configure WB!\n"); return -EOPNOTSUPP; } diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 584e246c769a..309f93122078 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -5737,13 +5737,13 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable) ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_EN); if (ret) { - dev_err(hba->dev, "%s Write Booster %s failed %d\n", + dev_err(hba->dev, "%s: Write Booster %s failed %d\n", __func__, enable ? "enable" : "disable", ret); return ret; } hba->dev_info.wb_enabled = enable; - dev_info(hba->dev, "%s Write Booster %s\n", + dev_info(hba->dev, "%s: Write Booster %s\n", __func__, enable ? "enabled" : "disabled"); return ret; @@ -5761,7 +5761,7 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, __func__, enable ? "enable" : "disable", ret); return; } - dev_dbg(hba->dev, "%s WB-Buf Flush during H8 %s\n", + dev_info(hba->dev, "%s: WB-Buf Flush during H8 %s\n", __func__, enable ? "enabled" : "disabled"); } @@ -5775,14 +5775,13 @@ int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable) ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN); if (ret) { - dev_err(hba->dev, "%s WB-Buf Flush %s failed %d\n", __func__, + dev_err(hba->dev, "%s: WB-Buf Flush %s failed %d\n", __func__, enable ? "enable" : "disable", ret); return ret; } hba->dev_info.wb_buf_flush_enabled = enable; - - dev_dbg(hba->dev, "%s WB-Buf Flush %s\n", + dev_info(hba->dev, "%s: WB-Buf Flush %s\n", __func__, enable ? "enabled" : "disabled"); return ret; @@ -5800,7 +5799,7 @@ static bool ufshcd_wb_presrv_usrspc_keep_vcc_on(struct ufs_hba *hba, QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE, index, 0, &cur_buf); if (ret) { - dev_err(hba->dev, "%s dCurWriteBoosterBufferSize read failed %d\n", + dev_err(hba->dev, "%s: dCurWriteBoosterBufferSize read failed %d\n", __func__, ret); return false; } @@ -5885,7 +5884,7 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba) QUERY_ATTR_IDN_AVAIL_WB_BUFF_SIZE, index, 0, &avail_buf); if (ret) { - dev_warn(hba->dev, "%s dAvailableWriteBoosterBufferSize read failed %d\n", + dev_warn(hba->dev, "%s: dAvailableWriteBoosterBufferSize read failed %d\n", __func__, ret); return false; } From patchwork Fri Jul 29 04:59:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12931933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6CA5C00144 for ; Fri, 29 Jul 2022 04:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbiG2E7R (ORCPT ); Fri, 29 Jul 2022 00:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234091AbiG2E7R (ORCPT ); Fri, 29 Jul 2022 00:59:17 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C95237B7A2 for ; Thu, 28 Jul 2022 21:59:15 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220729045914epoutp01367b0b70d1fa82da8fdf7e489d4f8240~GNA_XwrAM0800408004epoutp01U for ; Fri, 29 Jul 2022 04:59:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220729045914epoutp01367b0b70d1fa82da8fdf7e489d4f8240~GNA_XwrAM0800408004epoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659070754; bh=YaD5HG56b5yJxD/KEWPhhO1TGGVsj5lqfE49GcpKrwE=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=js8RYgJ2yhX7Ifk5muuaVnw5rR7ahfersrIwj7Ct1WiL2YXTytrjT++GQQEqrR++z XJJ5nBT2nbVHzdM8oUnZIiBgeU/wtEOToqm5Ta86Ou+zeVCehH39SKcR8e//mMnsS5 7mnk5uqAsBEqKbmX4tVU5PAgQDyac2nO4EgKSPXc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220729045913epcas2p1e58c1bbde95037ae2bf7db225f737423~GNA94mBC40569905699epcas2p1w; Fri, 29 Jul 2022 04:59:13 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.101]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LvFfn3GCQz4x9Py; Fri, 29 Jul 2022 04:59:13 +0000 (GMT) X-AuditID: b6c32a46-0a3ff700000025b2-05-62e36921e021 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 8B.42.09650.12963E26; Fri, 29 Jul 2022 13:59:13 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v5 6/6] scsi: ufs: wb: Move the comment to the right position Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI From: Jinyoung CHOI To: ALIM AKHTAR , "avri.altman@wdc.com" , "bvanassche@acm.org" , "jejb@linux.ibm.com" , "martin.petersen@oracle.com" , "beanhuo@micron.com" , "adrian.hunter@intel.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220729045756epcms2p40a1baa2c6bf17772023ccec20aef3f0a@epcms2p4> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20220729045913epcms2p598edffb67d42db84526acce0a5a9ce5d@epcms2p5> Date: Fri, 29 Jul 2022 13:59:13 +0900 X-CMS-MailID: 20220729045913epcms2p598edffb67d42db84526acce0a5a9ce5d X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmha5i5uMkg1+PJSxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8fkwOVx+Yq3x+I9L5k8 Jiw6wOjxfX0Hm8fHp7dYPPq2rGL0+LxJzqP9QDdTAEdUtk1GamJKapFCal5yfkpmXrqtkndw vHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0IlK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: 20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368 References: <20220729045756epcms2p40a1baa2c6bf17772023ccec20aef3f0a@epcms2p4> <20220729045656epcms2p1e6912ae09ca2122d4d04854878e19b2c@epcms2p1> <20220729045600epcms2p45c0f8a5a0a76c7fe85b0961570de89ce@epcms2p4> <20220729045433epcms2p77ff2cdde6ddffd9ab0b0810ebe84f0e5@epcms2p7> <20220729045252epcms2p7fee5c1cdca5e4bef02a833e40f80649b@epcms2p7> <20220729045045epcms2p8caf00317889ed4da8531b7466ec6e368@epcms2p8> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The location of the comment is wrong. so fix it. Reviewed-by: Avri Altman Signed-off-by: Jinyoung Choi Reviewed-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 309f93122078..4120617ff7a6 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1298,9 +1298,10 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up) } } - /* Enable Write Booster if we have scaled up else disable it */ downgrade_write(&hba->clk_scaling_lock); is_writelock = false; + + /* Enable Write Booster if we have scaled up else disable it */ ufshcd_wb_toggle(hba, scale_up); out_unprepare: