From patchwork Tue Aug 2 08:03:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934365 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 7590DC00140 for ; Tue, 2 Aug 2022 08:03:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234777AbiHBIDv (ORCPT ); Tue, 2 Aug 2022 04:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233907AbiHBIDu (ORCPT ); Tue, 2 Aug 2022 04:03:50 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 489411208E for ; Tue, 2 Aug 2022 01:03:48 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220802080346epoutp013b1da5644cf0f125cf41f3e447d39dd3~HeHPeq2N32055220552epoutp01G for ; Tue, 2 Aug 2022 08:03:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220802080346epoutp013b1da5644cf0f125cf41f3e447d39dd3~HeHPeq2N32055220552epoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427426; bh=wVOPOUxiNLaJA3Ek+mRYptXK+j9kErlnygcOfRzp26c=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Ek4jXdpXmKsPDHdmClONNcTDXXjdLK7Bbz4LLQAjkJ0gYocYF6yO3ZomBMW6/lC2d 0TlkpHk34tGNJKVFXo29VvF5bIMf8YUAmGWbnAWvodghFaDi3qvnDaH852BLYnip55 6TE4z+P3Exp9RcEjH665uI2jiLS3lPyxL9zgBpA4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20220802080346epcas2p2b976ddc37fbfad80061bbd719912e8fd~HeHPC6OsW2861328613epcas2p2I; Tue, 2 Aug 2022 08:03:46 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.99]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LxnYs5Sy4z4x9Py; Tue, 2 Aug 2022 08:03:45 +0000 (GMT) X-AuditID: b6c32a47-5e1ff700000025aa-65-62e8da618fae Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 59.D1.09642.16AD8E26; Tue, 2 Aug 2022 17:03:45 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802080345epcms2p3c503408ed9064c87833922b8d7fca2a5@epcms2p3> Date: Tue, 02 Aug 2022 17:03:45 +0900 X-CMS-MailID: 20220802080345epcms2p3c503408ed9064c87833922b8d7fca2a5 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CP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+/f8I1fcjkyQrbWdZykQuOeeydKp3+reeZ/V2fH4Z9+x qt1GEpyd8vU101ld1PZYK1x/UTnbJ6e7rLih+JPajQmHJrwyDJ+2ROvoc01LKxbu5IrEr3JT T23vX7kh6WbrHumaBcfPvXCsduF6NI9dvtmbWbibb9X2f0erk3Q3ye6Yv4Wj503WzdXZHn9a 717QWOxw89i1u8Zyv+bZiU7N+jeJqTtRcrXnFNdlZ+4f0P6hxFKckWioxVxUnAgAh0DelToE AAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 Reviewed-by: Bart Van Assche Reviewed-by: Stanley Chu Signed-off-by: Jinyoung Choi --- 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 0dc6437e956a..b7e7c0c4eb75 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 Tue Aug 2 08:05:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934366 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 A50DCC00140 for ; Tue, 2 Aug 2022 08:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236403AbiHBIFv (ORCPT ); Tue, 2 Aug 2022 04:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236372AbiHBIFk (ORCPT ); Tue, 2 Aug 2022 04:05:40 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92547192A5 for ; Tue, 2 Aug 2022 01:05:33 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220802080531epoutp0226f5283847d6430f6df975a6b36ca3b4~HeIw5ViHc1260712607epoutp025 for ; Tue, 2 Aug 2022 08:05:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220802080531epoutp0226f5283847d6430f6df975a6b36ca3b4~HeIw5ViHc1260712607epoutp025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427531; bh=SVmoLXbtKUB1vIM53WZ3qocmh/3HbPud77tuqhLKnLY=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=M/ZjmKuey0Nagm7wYbYbzBUiZGu5xn1x7C+JI040TqhFpAdxB/g2Ya6X3yOmgUFam gOOU45GMpOhFpn7wr5V/ERVuV9zM6mvU0zyyPLYdm6aV3ZQ5LEHYlB7xJ7X9uNyCy2 sViMSZugmTP34RQ73dxVV+4iAwlVQBtxOio5Theo= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220802080530epcas2p1a9b3fd9447d870098239e5c7f2e4364c~HeIwgqFGD0375803758epcas2p1R; Tue, 2 Aug 2022 08:05:30 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.70]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Lxnbt2RQhz4x9Q9; Tue, 2 Aug 2022 08:05:30 +0000 (GMT) X-AuditID: b6c32a47-5e1ff700000025aa-6c-62e8daca4b19 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 92.33.09642.ACAD8E26; Tue, 2 Aug 2022 17:05:30 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802080530epcms2p8a9bb540dc6f21957148088b7a9b8b6f4@epcms2p8> Date: Tue, 02 Aug 2022 17:05:30 +0900 X-CMS-MailID: 20220802080530epcms2p8a9bb540dc6f21957148088b7a9b8b6f4 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJsWRmVeSWpSXmKPExsWy7bCmhe6pWy+SDM71ClqcfLKGzeLBvG1s Fi9/XmWzOPiwk8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uOfzi/fbHTB5fhG8WpLlvK6nW/Fnp6DRv0o76JQeXvzh6zvxOZkxGmqHStoUuk2N+Piov TQhknPFRWrzlMr+SyjIXD/UpOvaNa5q9dH6XVSXdvPDjhRJLcUaioRZzUXEiADD6BPY4BAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 Reviewed-by: Bart Van Assche --- 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 b7e7c0c4eb75..df00441f89a1 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_configure_wb(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_configure_wb(hba); + if (hba->ee_usr_mask) ufshcd_write_ee_control(hba); /* Enable Auto-Hibernate if configured */ From patchwork Tue Aug 2 08:07:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934368 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 43525C00140 for ; Tue, 2 Aug 2022 08:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236362AbiHBIHq (ORCPT ); Tue, 2 Aug 2022 04:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236360AbiHBIHp (ORCPT ); Tue, 2 Aug 2022 04:07:45 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452C219283 for ; Tue, 2 Aug 2022 01:07:43 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220802080741epoutp0204c9547b202512ebe2b0ce8036314638~HeKqVNbrH1279012790epoutp02i for ; Tue, 2 Aug 2022 08:07:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220802080741epoutp0204c9547b202512ebe2b0ce8036314638~HeKqVNbrH1279012790epoutp02i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427661; bh=J8oz7SvYuq/cVltUXxXmeGSSf6xdti5kDUnkXIW6RE4=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=ZCrgD2ertiNZwuGL1Lz98lZH2xTq/mgT26elxmguRnL7HPG5oTpGbp7J079Cya3os FDb0p3wt2YJJ4AlFnOvA2g5qvdAeGfp4leIXhOBsdcGF/KGPyLlfDcXkwLtjp5tmGU g7RpxIdv3S46Svvwyfi7STH3L+Sr5tvlPdunWDtw= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220802080741epcas2p4891b9a178d4a2b44847449b3193af78c~HeKp5mFfU0715207152epcas2p4f; Tue, 2 Aug 2022 08:07:41 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.88]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4LxnfN5qvWz4x9Q4; Tue, 2 Aug 2022 08:07:40 +0000 (GMT) X-AuditID: b6c32a45-45bff700000025c2-59-62e8db4c096d Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 99.6B.09666.C4BD8E26; Tue, 2 Aug 2022 17:07:40 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802080740epcms2p3893fd9cfb765d4addbbfe58c68cf5af3@epcms2p3> Date: Tue, 02 Aug 2022 17:07:40 +0900 X-CMS-MailID: 20220802080740epcms2p3893fd9cfb765d4addbbfe58c68cf5af3 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOJsWRmVeSWpSXmKPExsWy7bCmqa7P7RdJBi+n61qcfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBYvD2laLLqxjcni8q45bBbd13ewWSw//o/JYunWm4wO3B6Xr3h7 LN7zksljwqIDjB4tJ/ezeHxf38Hm8fHpLRaPvi2rGD0+b5LzaD/QzRTAGZVtk5GamJJapJCa l5yfkpmXbqvkHRzvHG9qZmCoa2hpYa6kkJeYm2qr5OIToOuWmQN0rJJCWWJOKVAoILG4WEnf zqYov7QkVSEjv7jEVim1ICWnwLxArzgxt7g0L10vL7XEytDAwMgUqDAhO2Pzv6/sBV8MKw7u +MvWwLhXs4uRg0NCwETi5z7DLkYuDiGBHYwSvZtPsYHEeQUEJf7uEAYxhQU8Jd5PD+li5AQq UZI4t2YWI0TYQOJWrzlImE1AT+LnkhlsIFNEBNpYJI51bmUGSUgI8ErMaH/KAmFLS2xfvpUR xOYU8JOYeOMDVI2GxI9lvVC2qMTN1W/ZYez3x+YzQtgiEq33zkLVCEo8+LkbKi4pcejQVzaI T/IlNhwIhAjXSLxdfgCqRF/iWsdGsBN4BXwlth95BRZnEVCVuPZmO1SNi8TirsNgNrOAvMT2 t3OYQUYyC2hKrN+lDzFdWeLILRaYpxo2/mZHZzML8El0HP4LF98x7wkTRKuaxKImI4iwjMTX w/PZJzAqzUIE8iwka2chrF3AyLyKUSy1oDg3PbXYqMAQHq3J+bmbGMEpVst1B+Pktx/0DjEy cTAeYpTgYFYS4b3j8jxJiDclsbIqtSg/vqg0J7X4EKMp0MMTmaVEk/OBST6vJN7QxNLAxMzM 0NzI1MBcSZzXK2VDopBAemJJanZqakFqEUwfEwenVAMT16T6KdUrvnBOvB5vWbBf81/n4gsb D23xvq5ftunQB8+vN6e+DilbsuGey4V1jRmvDlwzCG1ofOt9uufbw92H5ZK1Pt+4mX1DWW7J 55XbDsp0PnHlm7p4wxIXuQVXbs++zhbjuW9602+2jtdvN5bY/7ogIb7HNF1t7ZbZvB8O3Hsl yXG6ddW/01uTSo563Apk1LGqnfjtd9qjbYKtURMmRnGvvvJZ8h5PkfOj9IQ3oSL83llaXx2s +k9afIjfZbp0p/qP6vun5/OU/6noE+H0X2lQuFzgX7tszIX4U1o/o9+4V6YpMzYo35U9wXRD zXhJt84ftoeNwnM3La0w+fMhPOt76dGbe75Or3Xacnler7ISS3FGoqEWc1FxIgB721FAOgQA AA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 | 9 +++++ drivers/ufs/core/ufs-sysfs.c | 46 ++++++++++++++++++++++ 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..1255cbda0ac9 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -1417,6 +1417,15 @@ 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 entry shows the status of WriteBooster buffer flushing + and it can be used to allow or disallow the flushing. + If the flushing is allowed, the device executes the flush + operation when the command queue is empty. + 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..69cc9b26c762 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -254,6 +254,50 @@ 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 flushing!\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 +306,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 +317,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 df00441f89a1..b7b8efd17659 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 Tue Aug 2 08:08:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934369 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 59B14C00140 for ; Tue, 2 Aug 2022 08:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236383AbiHBIIi (ORCPT ); Tue, 2 Aug 2022 04:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236388AbiHBIIg (ORCPT ); Tue, 2 Aug 2022 04:08:36 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0BE4D4DB for ; Tue, 2 Aug 2022 01:08:34 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220802080832epoutp044136d017b440933e0ca9109ecd8bb932~HeLZ9jeI40240202402epoutp040 for ; Tue, 2 Aug 2022 08:08:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220802080832epoutp044136d017b440933e0ca9109ecd8bb932~HeLZ9jeI40240202402epoutp040 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427712; bh=oszOItcMjMeNHkWQ68yMN7/6C0T1+pTNlDcShYoGYbg=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=J1vG3ytQMIun0b3JMQZrHmzmUeDCS8F8sRXn0wVc1Qa3Gpf63qpe7+xF93s8uQK+X 1ZJ/UfVxgJEdgod8UmsMGCi4QdCggvbs6b3pAQSDTmjX+OQXzBZ908BBE6Fonj8KPO oHTaCm+zVjBHLwRnLL/h2MSo0ay625U/cm8WNWVo= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20220802080832epcas2p293fd0586ea433a8e1e69772c24da0566~HeLZuprL00074300743epcas2p2B; Tue, 2 Aug 2022 08:08:32 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.68]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4LxngN0QZ9z4x9Pw; Tue, 2 Aug 2022 08:08:32 +0000 (GMT) X-AuditID: b6c32a47-5e1ff700000025aa-ef-62e8db7f677a Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 30.06.09642.F7BD8E26; Tue, 2 Aug 2022 17:08:31 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802080831epcms2p2c2b9f94e2f450a6a772a193d9720b650@epcms2p2> Date: Tue, 02 Aug 2022 17:08:31 +0900 X-CMS-MailID: 20220802080831epcms2p2c2b9f94e2f450a6a772a193d9720b650 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJJsWRmVeSWpSXmKPExsWy7bCmhW797RdJBgt6zS1OPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 Fu95yeQxYdEBRo+Wk/tZPL6v72Dz+Pj0FotH35ZVjB6fN8l5tB/oZgrgjMq2yUhNTEktUkjN S85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAE6VkmhLDGnFCgUkFhcrKRv Z1OUX1qSqpCRX1xiq5RakJJTYF6gV5yYW1yal66Xl1piZWhgYGQKVJiQndH++xNzwUKRivN/ d7I2MO4U7GLk5JAQMJHYs62dpYuRi0NIYAejxJkNbaxdjBwcvAKCEn93CIPUCAt4S3QvPcUK YgsJKEmcWzOLEaREWMBA4lavOUiYTUBP4ueSGWwgY0QE2lgkjnVuZYaYzysxo/0pC4QtLbF9 +VZGEJtTwE9i4o0PUDUaEj+W9ULZohI3V79lh7HfH5vPCGGLSLTeOwtVIyjx4OduqLikxKFD X9lA7pEQyJfYcCAQIlwj8Xb5AagSfYlrHRvBTuAV8JWYNeEmWJxFQFVi9+dmJogaF4ltHR/B XmQWkJfY/nYOM8hIZgFNifW79CGmK0scucUC81TDxt/s6GxmAT6JjsN/4eI75j1hgmhVk1jU ZAQRlpH4eng++wRGpVmIUJ6FZO0shLULGJlXMYqlFhTnpqcWGxUYwyM2OT93EyM4zWq572Cc 8faD3iFGJg7GQ4wSHMxKIrx3XJ4nCfGmJFZWpRblxxeV5qQWH2I0BXp4IrOUaHI+MNHnlcQb mlgamJiZGZobmRqYK4nzeqVsSBQSSE8sSc1OTS1ILYLpY+LglGpgaly+/qapt5/p/tTvJ7lD NHTPaU9mEJi7cc3Nk1Gydh2H30vlpQpsiOiaZ/vHQlG3XKD/SvMrlbXxJ9+eentc0aEnf71M ZcH+qbMexz6/6VPydOfxxB8+W/eEL5G/cW1jranu/2dKxRdZX07/Kbonm/2QkX7okp8BR5dV L13zXHj9lTsXvFo7F/Grqz+0PXRpn9qhyj+bQ9cfcdG8afLfSzvSdNvsp9M/7DbWtvnf/f1+ CKvhh8MaO0X6Dv5Kt7jp0GyZf57X19hMsDh4H8db1v4/i1Zx+Z7gPzL5nfEEqeQXvCtVt147 3fs0Pu/Hy8Kgd55v/D0FhUu+cpRsfd+cHa7ctcZificD+9fJ/FMObVFiKc5INNRiLipOBAA6 UzIIPAQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 Reviewed-by: Bart Van Assche Signed-off-by: Jinyoung Choi Reviewed-by: Stanley Chu --- 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 69cc9b26c762..2c0b7f45de4b 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 flushing!\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 b7b8efd17659..5099d161f115 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -294,7 +294,8 @@ static void ufshcd_configure_wb(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 Tue Aug 2 08:09:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934370 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 B7B61C3F6B0 for ; Tue, 2 Aug 2022 08:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236356AbiHBIJc (ORCPT ); Tue, 2 Aug 2022 04:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232948AbiHBIJb (ORCPT ); Tue, 2 Aug 2022 04:09:31 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980D3192B2 for ; Tue, 2 Aug 2022 01:09:29 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220802080928epoutp0293d320e8e0549a0772ee21007f2db39b~HeMNXVT4w1505515055epoutp02d for ; Tue, 2 Aug 2022 08:09:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220802080928epoutp0293d320e8e0549a0772ee21007f2db39b~HeMNXVT4w1505515055epoutp02d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427768; bh=3jLix4T4XgSy7myOUsJb8gZNbmWtNDyABXmcfSgtTyM=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Sa/6jJcnkcSvqnxRFQaZ8EChCJBVIVs6VZOv7kptHjbv8drbX0TWe/eeTXU61Wa3W lyzoEHRpfDfRXQ1g723Xvnk5UsIm2XNlEdBsXwQF1tSjN5B3XuwbB5XREFEx7Oc2Oh IqtS26WcxTUM6AZvQ83ondOQolmROwV/Zr13BgH8= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220802080927epcas2p12304cfdf89a96bbe75b6859fda206d29~HeMM8a6I_0083000830epcas2p1b; Tue, 2 Aug 2022 08:09:27 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.68]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4LxnhR2Fymz4x9Q2; Tue, 2 Aug 2022 08:09:27 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-62-62e8dbb7ef20 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id B4.D7.09650.7BBD8E26; Tue, 2 Aug 2022 17:09:27 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802080927epcms2p1d0d89c32a9bd07c07f233801bb954807@epcms2p1> Date: Tue, 02 Aug 2022 17:09:27 +0900 X-CMS-MailID: 20220802080927epcms2p1d0d89c32a9bd07c07f233801bb954807 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBJsWRmVeSWpSXmKPExsWy7bCmqe722y+SDB63CFqcfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBYvD2laLLqxjcni8q45bBbd13ewWSw//o/JYunWm4wO3B6Xr3h7 LN7zksljwqIDjB4tJ/ezeHxf38Hm8fHpLRaPvi2rGD0+b5LzaD/QzRTAGZVtk5GamJJapJCa l5yfkpmXbqvkHRzvHG9qZmCoa2hpYa6kkJeYm2qr5OIToOuWmQN0rJJCWWJOKVAoILG4WEnf zqYov7QkVSEjv7jEVim1ICWnwLxArzgxt7g0L10vL7XEytDAwMgUqDAhO2PTvJOsBWtlK46/ esLYwPhRvIuRk0NCwETi2ObtjF2MXBxCAjsYJa4dW8rUxcjBwSsgKPF3hzBIjbCAmcTO41PY QGwhASWJc2tmMYKUCAsYSNzqNQcJswnoSfxcMoMNZIyIQBuLxLHOrcwQ83klZrQ/ZYGwpSW2 L9/KCGJzCvhJTLzxAapGQ+LHsl4oW1Ti5uq37DD2+2PzGSFsEYnWe2ehagQlHvzcDRWXlDh0 6CsbyD0SAvkSGw4EQoRrJN4uPwBVoi9xrWMj2Am8Ar4SJ2Y2soOUswioSixYIwdR4iLRfrKF FcRmFpCX2P52DjNICbOApsT6XfoQw5UljtxigfmpYeNvdnQ2swCfRMfhv3DxHfOeMEG0qkks ajKCCMtIfD08n30Co9IsRCDPQrJ2FsLaBYzMqxjFUguKc9NTi40KjODxmpyfu4kRnGS13HYw Tnn7Qe8QIxMH4yFGCQ5mJRHeOy7Pk4R4UxIrq1KL8uOLSnNSiw8xmgL9O5FZSjQ5H5jm80ri DU0sDUzMzAzNjUwNzJXEeb1SNiQKCaQnlqRmp6YWpBbB9DFxcEo1MG38O+FLp7uImajknkeH t7kuP/vpQbWBRZ157h/bFmnZJZc1a1Wj+cOTmhYWKCe7mR/+ON/x+yENieRfO48cEWrI+da9 yOrTIiX3+E/7q6pcuKb3HTB4mKTy/hKH/6+TC7kcu6Qcu2d+D6+9kKhXnd24zobHpJfz1Mqa m7uKtwfGZFVxGOxdq6Hgs5pzncWbya8maL/+sfNGR3CCnGWv+e5I4R3vP384M/nLbEGbgnI2 Zv+n934dvXSjsWqJ01nfb8fquy/XbD7/yHTRCZuz0xNO7mN9nssqvHKi0vS0uXM0/6jONV3z gZsteZOkYfznMzkzD8ldu1l058z9Pon3239PlvzA7sHoKXT42uaMllwlluKMREMt5qLiRADr C0cbOwQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 Reviewed-by: Bart Van Assche Signed-off-by: Jinyoung Choi --- drivers/ufs/core/ufs-sysfs.c | 2 +- drivers/ufs/core/ufshcd.c | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index 2c0b7f45de4b..117272cf7d61 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 5099d161f115..dcd7f03db2a2 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", - __func__, enable ? "enable" : "disable", ret); + dev_err(hba->dev, "%s: Write Booster %s failed %d\n", + __func__, enable ? "enabling" : "disabling", 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; @@ -5757,11 +5757,11 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, 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__, enable ? "enable" : "disable", ret); + dev_err(hba->dev, "%s: WB-Buf Flush during H8 %s failed %d\n", + __func__, enable ? "enabling" : "disabling", 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__, - enable ? "enable" : "disable", ret); + dev_err(hba->dev, "%s: WB-Buf Flush %s failed %d\n", + __func__, enable ? "enabling" : "disabling", 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 Tue Aug 2 08:10:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12934371 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 B0A80C00140 for ; Tue, 2 Aug 2022 08:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236426AbiHBIKs (ORCPT ); Tue, 2 Aug 2022 04:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236427AbiHBIKp (ORCPT ); Tue, 2 Aug 2022 04:10:45 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C80712AE5 for ; Tue, 2 Aug 2022 01:10:43 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220802081040epoutp03f43d874068e71ac125a873ebe6ef8321~HeNQzZL010277302773epoutp03d for ; Tue, 2 Aug 2022 08:10:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220802081040epoutp03f43d874068e71ac125a873ebe6ef8321~HeNQzZL010277302773epoutp03d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659427840; bh=WfYURiMfxdscvV155kuVfTOog8MwJWRdwgn+ujFV3oI=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=HSO3lBN8Knyuz9LR0pqvUTKnL8zh0PD4KIMeU9ybibMXxrnL5Zpzou03ZxhcLMW2S fYYxYcD0NehWCppejmWmg4sQKNyAD0qqo3pCNG42UIPMqe4N3IGbgu10d5lvIvTixI HGsCvuEefUfV/ASWt7YXtcNLATFJR5j7GLWMjvZo= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220802081039epcas2p1f09accf349a68b375b6248729253e809~HeNQO46uS2809228092epcas2p1F; Tue, 2 Aug 2022 08:10:39 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.98]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lxnjq40Xbz4x9Px; Tue, 2 Aug 2022 08:10:39 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-b2-62e8dbff4c7a Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 6D.E8.09650.FFBD8E26; Tue, 2 Aug 2022 17:10:39 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v6 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" , "stanley.chu@mediatek.com" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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: <20220802081039epcms2p68dbe18151e04103d10bf28751f9ace4e@epcms2p6> Date: Tue, 02 Aug 2022 17:10:39 +0900 X-CMS-MailID: 20220802081039epcms2p68dbe18151e04103d10bf28751f9ace4e X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJJsWRmVeSWpSXmKPExsWy7bCmhe7/2y+SDFoOy1icfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBYvD2laLLqxjcni8q45bBbd13ewWSw//o/JYunWm4wO3B6Xr3h7 LN7zksljwqIDjB4tJ/ezeHxf38Hm8fHpLRaPvi2rGD0+b5LzaD/QzRTAGZVtk5GamJJapJCa l5yf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DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce References: <20220802080146epcms2p24b86bfce3d3c09c79b91d861cb3b2cce@epcms2p2> 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 Reviewed-by: Bart Van Assche Signed-off-by: Jinyoung Choi Reviewed-by: Stanley Chu --- 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 dcd7f03db2a2..196f964c0877 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: