From patchwork Thu Aug 4 07:49:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936172 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 814D4C19F2C for ; Thu, 4 Aug 2022 07:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239231AbiHDHtf (ORCPT ); Thu, 4 Aug 2022 03:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiHDHtd (ORCPT ); Thu, 4 Aug 2022 03:49:33 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFA4061D90 for ; Thu, 4 Aug 2022 00:49:31 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220804074930epoutp012473b8d9075737ae912e516a14331e2a~IFNWIPu511214812148epoutp01r for ; Thu, 4 Aug 2022 07:49:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220804074930epoutp012473b8d9075737ae912e516a14331e2a~IFNWIPu511214812148epoutp01r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599370; bh=wVOPOUxiNLaJA3Ek+mRYptXK+j9kErlnygcOfRzp26c=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=uPKHVP3cHElmhaAXng6OFkJ6GbCHvrsi73VEOkUGMX+YYGLVrSwLT7d61pdJwUVMI JzmGv6urX6g7RRW6GUSXr08CsjinU1a70V2JyfffmBDa6a93nK9E8gpkyYdH2ckRA9 5YgK0fjHG5C6yrKEfplnCa0P1w+IXYU5qB61vHVg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220804074929epcas2p4b909a08e306a765d9d74bddb9f7ebe87~IFNVtEqkX2674526745epcas2p4g; Thu, 4 Aug 2022 07:49:29 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.98]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lz18S728Lz4x9Pw; Thu, 4 Aug 2022 07:49:28 +0000 (GMT) X-AuditID: b6c32a48-9e1ff700000025be-46-62eb7a08a30a Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 33.F6.09662.80A7BE26; Thu, 4 Aug 2022 16:49:28 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@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: <20220804074928epcms2p86582693a39597501b491400a28543a92@epcms2p8> Date: Thu, 04 Aug 2022 16:49:28 +0900 X-CMS-MailID: 20220804074928epcms2p86582693a39597501b491400a28543a92 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-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jV+6w95d ljmU/enmwb9lS/jVRIMmGiquPWf4S+X+ElYD3ylr52V4bjl0RvR7S9Qj79kMR1u8yiV9JDKW Xvv1/NhdkbIlVc9ktl1rX54j2Xzi0LLP9vcn/RCcfSbP/zbLtJO2m9ycI/+41sYmbA3yVahO dMlRWZDWZbLDQjPKyLqXp85iaSn3TKHGJ9H6lS4Jl6dPV2Ipzkg01GIuKk4EADQvNCE5BAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866 References: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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 Thu Aug 4 07:50:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936173 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 5E1FAC19F2C for ; Thu, 4 Aug 2022 07:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232333AbiHDHvE (ORCPT ); Thu, 4 Aug 2022 03:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiHDHvC (ORCPT ); Thu, 4 Aug 2022 03:51:02 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7162B2AC5A for ; Thu, 4 Aug 2022 00:51:01 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220804075059epoutp012d03960d2b61f66e019fd5c4d274487a~IFOp2o4y-1306813068epoutp01r for ; Thu, 4 Aug 2022 07:50:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220804075059epoutp012d03960d2b61f66e019fd5c4d274487a~IFOp2o4y-1306813068epoutp01r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599459; bh=mmkQk1MvcKM6LM6o3wuPJ6XeZO8ObXnjiobggSDJbjc=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Irdx4ssLeg/UDv5nOqj3rGQOabR/dA1fP9Rt1qTGiLViF8wvhFcXiWuOfiWNxqQhd XT2YpelPoKo2d7wRgM7oSsrmyWspN6tfW5z27+ThWypr/TH7dR+bTbsIPOLtQYK3nW cXvpgIFC4LT8Xdo68kcXzme3WfB6d4/f6q/KGEZg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220804075059epcas2p4ed93af3e4205706b189f842167a382ef~IFOpZzh5X2016720167epcas2p4Z; Thu, 4 Aug 2022 07:50:59 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.98]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Lz1BB6Xdcz4x9Q4; Thu, 4 Aug 2022 07:50:58 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-57-62eb7a623ccd Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 9B.51.09650.26A7BE26; Thu, 4 Aug 2022 16:50:58 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074928epcms2p86582693a39597501b491400a28543a92@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: <20220804075058epcms2p550c578d743fe0a94888b3d71cc9076d4@epcms2p5> Date: Thu, 04 Aug 2022 16:50:58 +0900 X-CMS-MailID: 20220804075058epcms2p550c578d743fe0a94888b3d71cc9076d4 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOJsWRmVeSWpSXmKPExsWy7bCmmW5S1eskg7lTTCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 F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mdc/bO23nJUuR+Kwl z6d6FAhLM7j+jne+pbSpy1g+32CdyY15F1bYLlbjvqTTnaLEUpyRaKjFXFScCACQz8ehOgQA AA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866 References: <20220804074928epcms2p86582693a39597501b491400a28543a92@epcms2p8> <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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 Reviewed-by: Bart Van Assche 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 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 Thu Aug 4 07:53:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936182 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 1811DC19F2C for ; Thu, 4 Aug 2022 07:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239051AbiHDHyA (ORCPT ); Thu, 4 Aug 2022 03:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238903AbiHDHx7 (ORCPT ); Thu, 4 Aug 2022 03:53:59 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700F265551 for ; Thu, 4 Aug 2022 00:53:57 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220804075355epoutp0283e28056daf1e4bf824fc47895ca8ebd~IFRNuk6z83268732687epoutp024 for ; Thu, 4 Aug 2022 07:53:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220804075355epoutp0283e28056daf1e4bf824fc47895ca8ebd~IFRNuk6z83268732687epoutp024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599635; bh=2Aj9LQQGUiSL9my/m380DKw4bgy1r+fQHsa+dspiku8=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=Hkhr1Uzs6POLGNtfG8kHRp0v+mqhYLC2vbGsbQrsNQqh2XRlQYYC1QQqqsjhgSWbz +jFd7by94IpfWkIy1wmiJ7Qi+9DcU2kLMQX64rdRC1gTsng331YL1D6+sDR7VIIV05 JqnHktqL8U9Xfa5rYOmvg7VvrdtSZRqgomL81DVY= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20220804075355epcas2p2bdc5cd7790be0bd52e970ac4147bc438~IFRNPy55O0044800448epcas2p21; Thu, 4 Aug 2022 07:53:55 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.101]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lz1Fb088Nz4x9Q9; Thu, 4 Aug 2022 07:53:55 +0000 (GMT) X-AuditID: b6c32a46-0b9ff700000025b2-be-62eb7b12a2b7 Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 9E.F3.09650.21B7BE26; Thu, 4 Aug 2022 16:53:54 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@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: <20220804075354epcms2p8c21c894b4e28840c5fc651875b7f435f@epcms2p8> Date: Thu, 04 Aug 2022 16:53:54 +0900 X-CMS-MailID: 20220804075354epcms2p8c21c894b4e28840c5fc651875b7f435f X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmqa5Q9eskg/cbrCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 Fu95yeQxYdEBRo+Wk/tZPL6v72Dz+Pj0FotH35ZVjB6fN8l5tB/oZgrgjMq2yUhNTEktUkjN S85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAE6VkmhLDGnFCgUkFhcrKRv Z1OUX1qSqpCRX1xiq5RakJJTYF6gV5yYW1yal66Xl1piZWhgYGQKVJiQnbHv/mSWgjlGFS9f LWRpYHym2cXIySEhYCJxvLePrYuRi0NIYAejxOSOPpYuRg4OXgFBib87hEFqhAU8JX5vucMG YgsJKEmcWzOLEaREWMBA4lavOUiYTUBP4ueSGWAlIgJtLBLrT7NDjOeVmNH+lAXClpbYvnwr WCungJ/E/cNZEGENiR/LepkhbFGJm6vfssPY74/NZ4SwRSRa752FqhGUePBzN1RcUuLQoa9s ICMlBPIlNhwIhAjXSLxdfgCqRF/iWsdGsAt4BXwlZh5fBzaGRUBVYtaHXkaIVheJ7S+DQcLM AvIS29/OYQYJMwtoSqzfpQ9RoSxx5BYLzEsNG3+zo7OZBfgkOg7/hYvvmPeECaJVTWJRkxFE WEbi6+H57BMYlWYhgngWkrWzENYuYGRexSiWWlCcm55abFRgBI/V5PzcTYzgBKvltoNxytsP eocYmTgYDzFKcDArifCusHydJMSbklhZlVqUH19UmpNafIjRFOjficxSosn5wBSfVxJvaGJp YGJmZmhuZGpgriTO65WyIVFIID2xJDU7NbUgtQimj4mDU6qBSUWbTbnxpMS6sjXm2x3TPKX0 CiK3hm7fIuQYWWL45YrCCU9/3R1hEhUZB0W5zy/7OuFdbOW/Wx/1z71MK7ysNnnrqeU75umG u5pEHz0lFPX7/7GuF+wXll59rHbO/Hzw2V9bFk669jNf4KnAoesqe5eb/Pi/r31JdqfciwNz JacxJWxOYNiU4aJwYO/J92e4mrgnzL336snkGxsfNTFpiC6aPSdh6Z0aLhapDiHWsgz+aWEX Zj5M5rjtvad84+TWnSFV7lt7RGXDrNRr/20+9vz7cfsyAbvepVc7j22PzF6Xefc1X84hUS3O /wEO73lrXXN63snF2uw3mFXv+8C4kV10S+RdoS+ev/uKGoM/dymxFGckGmoxFxUnAgBS9V2E OQQAAA== DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866 References: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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..91de786f9a71 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/*/enable_wb_buf_flush +What: /sys/bus/platform/devices/*.ufs/enable_wb_buf_flush +Date: July 2022 +Contact: Jinyoung Choi +Description: This entry shows the status of WriteBooster buffer flushing + and it can be used to enable or disable the flushing. + If flushing is enabled, 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..8fe3d6e51cc8 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 enable_wb_buf_flush_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 enable_wb_buf_flush_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + unsigned int enable_wb_buf_flush; + 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, &enable_wb_buf_flush)) + return -EINVAL; + + if (enable_wb_buf_flush != 0 && enable_wb_buf_flush != 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, enable_wb_buf_flush); + 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(enable_wb_buf_flush); 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_enable_wb_buf_flush.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 Thu Aug 4 07:54:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936183 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 320CEC19F2C for ; Thu, 4 Aug 2022 07:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239323AbiHDHyt (ORCPT ); Thu, 4 Aug 2022 03:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238750AbiHDHys (ORCPT ); Thu, 4 Aug 2022 03:54:48 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A2F65559 for ; Thu, 4 Aug 2022 00:54:47 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220804075446epoutp037a51aab86026f7cb7e8837465567f2c4~IFR8p4AAJ1747317473epoutp03V for ; Thu, 4 Aug 2022 07:54:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220804075446epoutp037a51aab86026f7cb7e8837465567f2c4~IFR8p4AAJ1747317473epoutp03V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599686; bh=XtcvaO1W4P081UtJnWgJw6I/Hch0C2TTlWxmPi8S/Xk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=RWgP1TqKnWF6elriirVU5LZMenyZcEIq+valjRGjpktx3TTcPQTYsYEHbIGV5PeNT x9idTQV/Q66si6KJKjLQ7hzoLmXpwf4kRtjoGieDWPAmQBwfbkizNd24BPyM3YIf5p pa5VywcArpSyybQAg/yypjbgh/TRL+aGTpOn+PDA= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220804075445epcas2p1a84995558f7bcb8cf7e0f3f711b9677a~IFR8R95840340303403epcas2p1u; Thu, 4 Aug 2022 07:54:45 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.98]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Lz1GY2PV4z4x9QB; Thu, 4 Aug 2022 07:54:45 +0000 (GMT) X-AuditID: b6c32a47-5e1ff700000025aa-84-62eb7b45b081 Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id FB.84.09642.54B7BE26; Thu, 4 Aug 2022 16:54:45 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 4/6] scsi: ufs: wb: Introduce ufshcd_is_wb_buf_flush_allowed() to improve readability 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@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: <20220804075444epcms2p4a0520880262281f02be65ce0fe50602d@epcms2p4> Date: Thu, 04 Aug 2022 16:54:44 +0900 X-CMS-MailID: 20220804075444epcms2p4a0520880262281f02be65ce0fe50602d X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmma5r9eskg3nbeCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 Fu95yeQxYdEBRo+Wk/tZPL6v72Dz+Pj0FotH35ZVjB6fN8l5tB/oZgrgjMq2yUhNTEktUkjN S85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAE6VkmhLDGnFCgUkFhcrKRv Z1OUX1qSqpCRX1xiq5RakJJTYF6gV5yYW1yal66Xl1piZWhgYGQKVJiQnfHn2We2gnsiFbfu FjQwfhTsYuTkkBAwkTjZdJG5i5GLQ0hgB6PEtY1r2boYOTh4BQQl/u4QBqkRFsiSuPq+gw3E FhJQkji3ZhYjSImwgIHErV5zkDCbgJ7EzyUzwEpEBNpYJNafZocYzysxo/0pC4QtLbF9+Vaw Vk4BP4n7h7MgwhoSP5b1MkPYohI3V79lh7HfH5vPCGGLSLTeOwtVIyjx4OduqLikxKFDX8EO lhDIl9hwIBAiXCPxdvkBqBJ9iWsdG8Eu4BXwlZj85gXYGBYBVYnfR9azQdS4SDQ9PwQWZxaQ l9j+dg4zyEhmAU2J9bv0IaYrSxy5xQLzU8PG3+zobGYBPomOw3/h4jvmPWGCaFWTWNRkBBGW kfh6eD77BEalWYgwnoVk7SyEtQsYmVcxiqUWFOempxYbFRjDYzU5P3cTIzjBarnvYJzx9oPe IUYmDsZDjBIczEoivCssXycJ8aYkVlalFuXHF5XmpBYfYjQFengis5Rocj4wxeeVxBuaWBqY mJkZmhuZGpgrifN6pWxIFBJITyxJzU5NLUgtgulj4uCUamDKfxWt/yiddaXFzOUui8/HLNB7 IM/iHtwcvmhR5EfLRda8wZkeUlFpM8rvGkw9lSfx0GH61raenqsf6zZIyjhMDC2N2Nmqf2Se 12XlTWdzRCbNKFdguMW1OHbJhqU5OXqLzpmcivCZuXr3shd5T3vfl03LfPnruO20ORcW6bjd V0v56/dImimq8VbC+gXcl+OPsh44zfMgRC9RYq3BiXs9WxUSvrR8WyndeaWIfa/LtdOOu/Qm rDJbecRB406Ua8qv4kUTtr9vPZfC016u6nU5YNkaln8pJ969krY8HjgheqvnI7OGx4rdq6Mv LK6dWmFwsoaTy3ryJ6+uU5MkNGJtEmfdbHVqvlyYMas0Z7+MEktxRqKhFnNRcSIAs49IeTkE AAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866 References: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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 Reviewed-by: Stanley Chu Signed-off-by: Jinyoung Choi --- 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 8fe3d6e51cc8..5a571960c93a 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -271,8 +271,7 @@ static ssize_t enable_wb_buf_flush_store(struct device *dev, unsigned int enable_wb_buf_flush; 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 Thu Aug 4 07:55:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936184 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 64645C19F2C for ; Thu, 4 Aug 2022 07:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239404AbiHDHzb (ORCPT ); Thu, 4 Aug 2022 03:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239351AbiHDHzX (ORCPT ); Thu, 4 Aug 2022 03:55:23 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79D046394 for ; Thu, 4 Aug 2022 00:55:22 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220804075520epoutp02b7359aabad1ea087c6163212b1001dc1~IFSc6BqT-0265102651epoutp02N for ; Thu, 4 Aug 2022 07:55:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220804075520epoutp02b7359aabad1ea087c6163212b1001dc1~IFSc6BqT-0265102651epoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599720; bh=mRoo2+RxB2FCJcuy7yBWNotnojgpEK0MxUVIWL+IP08=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=VzIVcW+59r59qvgcArd2WecbWhyCNWnqzAtO+oGiYTRwaSmsEuN8t3CnthDuJZuyL Yx5ibqysJVAaFB+AOmOp/Rc7ksb79/fp39Sx7gYFKg5M2RbPkYhuvo2SNTNrZSR1PF hUoglK1yfcDuu/axxC3LAoKsdvq6MItlcSTQfG04= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220804075520epcas2p4af89c0e99659108a6869eb9419155928~IFSchrjLM0583705837epcas2p4D; Thu, 4 Aug 2022 07:55:20 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.69]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Lz1HD17C0z4x9QD; Thu, 4 Aug 2022 07:55:20 +0000 (GMT) X-AuditID: b6c32a45-471ff700000025c2-d7-62eb7b68d7c6 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id F4.94.09666.86B7BE26; Thu, 4 Aug 2022 16:55:20 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@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: <20220804075519epcms2p148b6ae956b172925b26304b50d6a0da9@epcms2p1> Date: Thu, 04 Aug 2022 16:55:19 +0900 X-CMS-MailID: 20220804075519epcms2p148b6ae956b172925b26304b50d6a0da9 X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJsWRmVeSWpSXmKPExsWy7bCmuW5G9eskg1tH2CxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 Fu95yeQxYdEBRo+Wk/tZPL6v72Dz+Pj0FotH35ZVjB6fN8l5tB/oZgrgjMq2yUhNTEktUkjN S85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAE6VkmhLDGnFCgUkFhcrKRv Z1OUX1qSqpCRX1xiq5RakJJTYF6gV5yYW1yal66Xl1piZWhgYGQKVJiQndFwcwtzwSrZitZ5 xxgbGN+JdzFycEgImEgcXKnRxcjFISSwg1Fi2apJLCBxXgFBib87hLsYOTmEBcwkvj1exwZi CwkoSZxbM4sRpERYwEDiVq85SJhNQE/i55IZYCUiAm0sEutPs4PYEgK8EjPan7JA2NIS25dv BWvlFPCTuH84CyKsIfFjWS8zhC0qcXP1W3YY+/2x+YwQtohE672zUDWCEg9+7oaKS0ocOvSV DeKRfIkNBwIhwjUSb5cfgCrRl7jWsRHsAl4BX4k/MxaDxVkEVCWmv14ANdJFouHBAlYQm1lA XmL72znMICOZBTQl1u/Sh5iuLHHkFgvMTw0bf7Ojs5kF+CQ6Dv+Fi++Y94QJolVNYlGTEURY RuLr4fnsExiVZiHCeBaStbMQ1i5gZF7FKJZaUJybnlpsVGAIj9Xk/NxNjOAEq+W6g3Hy2w96 hxiZOBgPMUpwMCuJ8K6wfJ0kxJuSWFmVWpQfX1Sak1p8iNEU6OGJzFKiyfnAFJ9XEm9oYmlg YmZmaG5kamCuJM7rlbIhUUggPbEkNTs1tSC1CKaPiYNTqoGJZT/nobV2xRs2uxTVM/jxBjDM 2PwmQXRfqfP7Qim74Pi6DR/CNV92ZYu77/3wyDn+6JK9USEG0fxPV/W4/cpW8U3KfiHQYfN9 y8fD5i5Rhjz6m4MDrtS9T9uivWv+01TrG/bPpts4KiSE73mSvsTsQZpG4tytSx8WKkQyrna4 6tf9Ma3fcv5hoDOrdLav8Be8s5kv0vKZQ4P+Vam9xpXn90jGx3xXZzXLXlN4Z5PcsV0fu3Ln FyTGmC/pTTW6lOSqZnD+3d9o8cn12j5XFh8JvfX8wl6bCxb3Mtc5lZ4yE/oXVSqydmvTQkm/ fYybDTN3+nocsY4zkPscLP1hnUBW91aja2/OrZrWl6dhpsRSnJFoqMVcVJwIAKiu7fo5BAAA DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866 References: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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 5a571960c93a..efdfa74b4c1b 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..6460e3c643fa 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_dbg(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_dbg(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_dbg(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 Thu Aug 4 07:55:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinyoung Choi X-Patchwork-Id: 12936185 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 EC1DBC19F2B for ; Thu, 4 Aug 2022 07:56:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239417AbiHDH4p (ORCPT ); Thu, 4 Aug 2022 03:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbiHDH4Q (ORCPT ); Thu, 4 Aug 2022 03:56:16 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC416583C for ; Thu, 4 Aug 2022 00:56:02 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220804075600epoutp047091e7a4c18aed2e0226eb719b14a17f~IFTCE3-JM2473924739epoutp04D for ; Thu, 4 Aug 2022 07:56:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220804075600epoutp047091e7a4c18aed2e0226eb719b14a17f~IFTCE3-JM2473924739epoutp04D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1659599760; bh=YaUFXrkk/2TN02SnQTghhwfTl7I5ajrem/rsP/HXG7c=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=uPZ/1XMxGOCIBW8nSzcBZe98Rw/G6bHPqxaoqcs6THHCHOO3A7Otu94DplQ9TMTGr Tuf1XU32dXp07nnnAXY8vAn7KTvUDlLCnT3jHYfEmuZnkXQ/vMdly2wp44hDe7v9ob FG81vlrcmmisoBzazlicZwqzMYhgepc05hahQksw= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20220804075600epcas2p4b4ffb9a6c1e387c762aded9bd4b4f857~IFTBt3pkd2939529395epcas2p45; Thu, 4 Aug 2022 07:56:00 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.89]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Lz1Hz5kyDz4x9QK; Thu, 4 Aug 2022 07:55:59 +0000 (GMT) X-AuditID: b6c32a47-5e1ff700000025aa-0a-62eb7b8f3123 Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 96.85.09642.F8B7BE26; Thu, 4 Aug 2022 16:55:59 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v7 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" , "stanley.chu@mediatek.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@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: <20220804075559epcms2p8018c0a90eb2200713ad521942715a33f@epcms2p8> Date: Thu, 04 Aug 2022 16:55:59 +0900 X-CMS-MailID: 20220804075559epcms2p8018c0a90eb2200713ad521942715a33f X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-CPGSPASS: Y CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOJsWRmVeSWpSXmKPExsWy7bCmhW5/9eskg3ePNS1OPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZouXhzQtFt3YxmRxedccNovu6zvYLJYf/8dksXTrTUYHbo/LV7w9 Fu95yeQxYdEBRo+Wk/tZPL6v72Dz+Pj0FotH35ZVjB6fN8l5tB/oZgrgjMq2yUhNTEktUkjN S85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAE6VkmhLDGnFCgUkFhcrKRv Z1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ed981718a9cab23866 References: <20220804074224epcms2p18f0ac2f92073aeed981718a9cab23866@epcms2p1> 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 Reviewed-by: Stanley Chu Signed-off-by: Jinyoung Choi --- 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 6460e3c643fa..8217a05f6f3a 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: