From patchwork Mon Sep 4 01:30:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 720084 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 A9613C83F2D for ; Mon, 4 Sep 2023 01:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350357AbjIDBmB (ORCPT ); Sun, 3 Sep 2023 21:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350282AbjIDBmB (ORCPT ); Sun, 3 Sep 2023 21:42:01 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807D8FE for ; Sun, 3 Sep 2023 18:41:54 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230904014150epoutp04f3c178a34bf702f5b9a692e38a8e02dd~BjpYx5hVt2370123701epoutp047 for ; Mon, 4 Sep 2023 01:41:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230904014150epoutp04f3c178a34bf702f5b9a692e38a8e02dd~BjpYx5hVt2370123701epoutp047 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693791710; bh=UpLDeUFH71BALzHr+pVoGyqIUenCPnb/EuSkSo/gxIA=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=UFTI4BKpqChkfr+DwGZArS63JOhPtQu1a/2Qksnn9bQQl3y4PcjRMzs6TZjkfEvv1 0ynIwycbrxQJig4gaGUtHFdNVH7tz6MugxnTQLJfuiTfO7cU+O2Io0HElKWvAW8ctp TDP53yWx3E4jyMAWA46qzsrarmddXtP0tjIl3azY= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230904014150epcas2p4c8ecae68e589f5b674a4ef01a7125a29~BjpYeOMUS1199211992epcas2p4q; Mon, 4 Sep 2023 01:41:50 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.92]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4RfBFT3LrHz4x9Px; Mon, 4 Sep 2023 01:41:49 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 9E.43.09693.DD535F46; Mon, 4 Sep 2023 10:41:49 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230904014148epcas2p1c49a727b427f2e6cc3d3933b1885776f~BjpXJqPRa2921929219epcas2p1G; Mon, 4 Sep 2023 01:41:48 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230904014148epsmtrp271828b8ff2ec93ae720bfd82a4b1815b~BjpXIlbJB0621306213epsmtrp2e; Mon, 4 Sep 2023 01:41:48 +0000 (GMT) X-AuditID: b6c32a45-abbfd700000025dd-26-64f535dd2a6b Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 38.E0.18916.CD535F46; Mon, 4 Sep 2023 10:41:48 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230904014148epsmtip1dc16ae67ebdf62493a8cb40cdf399c55~BjpW3a5Cu1092710927epsmtip1P; Mon, 4 Sep 2023 01:41:48 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, kwangwon.min@samsung.com, junwoo80.lee@samsung.com, wkon.kim@samsung.com Cc: Kiwoong Kim Subject: [RESEND PATCH v3 1/2] ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock Date: Mon, 4 Sep 2023 10:30:44 +0900 Message-Id: <782ba5f26f0a96e58d85dff50751787d2d2a6b2b.1693790060.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMJsWRmVeSWpSXmKPExsWy7bCmqe5d068pBsfWilmcfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBarFz9gsVh0YxuTxa6/zUwWW2/sZLG4ueUoi8XlXXPYLLqv72Cz WH78H5NF190bjBZL/71lsdh86RuLg4DH5SveHov3vGTymLDoAKPH9/UdbB4fn95i8ejbsorR 4/MmOY/2A91MARxR2TYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkou PgG6bpk5QB8oKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVUgtScgrMC/SKE3OLS/PS9fJS S6wMDQyMTIEKE7IzLt1ezlbwma9iwZTdTA2Mh3i6GDk5JARMJH7+fMrWxcjFISSwg1HiyM1l UM4nRokPTSsRnPX7lzPCtLSd3sEKkdjJKLH48GYo5wejxLwlncwgVWwCmhJPb05lAkmICHxg kvi/fBtYO7OAusSuCSeYQGxhgUiJy1NPgtksAqoSV9f9YAWxeQWiJdbMmsgEsU5O4uY5iKGc ApYSHz7dYUFlcwHVzOWQaJ2xnBWiwUXi0OfZzBC2sMSr41vYIWwpic/v9gI9xA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EEUIKDQ1ggXOLwK22QMIuAqsTVdT/AlvEKREusmTWRCWKBnMTNc53M IDangKXEh093WCAOspBYs+Y7Cy7xCYwCCxgZVjGKphYU56bnJhcY6hUn5haX5qXrJefnbmIE x4RW0A7GZev/6h1iZOJgPMQowcGsJMIrp/0pRYg3JbGyKrUoP76oNCe1+BCjNAeLkjivck5n ipBAemJJanZqakFqEUyWiYNTqoEplO+ezbxS7wSuvGk3HJva9t8095nHti1s2xrOuLCn88OW Tolo+RG4++T1L0cO9DocOmyz9Mwv/50JPVM/vuKyjszaLCxjU/2aZ75Uwr7CR6JvfYs+vc2d camnQt1xBvtqne+Wrh8mP2tRb3v5U09v9bnlDlOyU77+6zBbMK/o0IWyi8dUk2u9dyvurKjJ V0lQmuK1zLrslVtD8mbuRakFMz74Hsx/UtT76/7uZ50v9B3WLw+XTPfQCUh/rj9HKzLmhLra R75lPz421xxusdpim3TA/Pm+mdUCNvMmqfaJ97zlv/mqQHRC5+rAk1x3v3K+tYzyE/UJ/3Zz 6Q4VJ6aYheoTH/1p/xWb8NtSt8BYiaU4I9FQi7moOBEAjFrxZvgCAAA= X-CMS-MailID: 20230904014148epcas2p1c49a727b427f2e6cc3d3933b1885776f X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230904014148epcas2p1c49a727b427f2e6cc3d3933b1885776f References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org __ufshcd_send_uic_cmd is wrapped uic_cmd_mutex and its related contexts are accessed within the period wrappted by uic_cmd_mutex. Thus, wrapping with host_lock is redundant. Signed-off-by: Kiwoong Kim Reviewed-by: Bart Van Assche Reviewed-by: Junwoo Lee Reviewed-by: Chanwoo Lee --- drivers/ufs/core/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 27e1a49..6300ed6 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2414,7 +2414,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, bool completion) { lockdep_assert_held(&hba->uic_cmd_mutex); - lockdep_assert_held(hba->host->host_lock); if (!ufshcd_ready_for_uic_cmd(hba)) { dev_err(hba->dev, @@ -2441,7 +2440,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) { int ret; - unsigned long flags; if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD) return 0; @@ -2450,9 +2448,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) mutex_lock(&hba->uic_cmd_mutex); ufshcd_add_delay_before_dme_cmd(hba); - spin_lock_irqsave(hba->host->host_lock, flags); ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true); - spin_unlock_irqrestore(hba->host->host_lock, flags); if (!ret) ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd); @@ -4161,8 +4157,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) wmb(); reenable_intr = true; } - ret = __ufshcd_send_uic_cmd(hba, cmd, false); spin_unlock_irqrestore(hba->host->host_lock, flags); + ret = __ufshcd_send_uic_cmd(hba, cmd, false); if (ret) { dev_err(hba->dev, "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n", From patchwork Mon Sep 4 01:30:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 721447 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 8E335C83F2C for ; Mon, 4 Sep 2023 01:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350360AbjIDBmC (ORCPT ); Sun, 3 Sep 2023 21:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350349AbjIDBmB (ORCPT ); Sun, 3 Sep 2023 21:42:01 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E33FA for ; Sun, 3 Sep 2023 18:41:54 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230904014151epoutp040a2ac182fe5407f36314f3e77b6365c3~BjpZzIFFN2224122241epoutp04k for ; Mon, 4 Sep 2023 01:41:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230904014151epoutp040a2ac182fe5407f36314f3e77b6365c3~BjpZzIFFN2224122241epoutp04k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693791711; bh=m6tNa1euH0CrBZM8YLUI+1xoSFOzw2Hl6DICf1W0u3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=D/po5D8g9Qy58xCa2XMn5j3b/vg5hU+cmMBRkRWSwZKG3rWwjo9OaEYpmAZh1PxYc BZn/4pxOZPRJl/+pYt+1oPoXTG751zaL0WZYNdjKH7Kv0lmCSmh1cGKudgi/3UWBY6 i/sTQE4v7XnokhRvNQbFk8Jo9+6NRaeZfDqjXhZ8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230904014151epcas2p40465a203ed390b7d781e56715986275d~BjpZb8g-c1199211992epcas2p4u; Mon, 4 Sep 2023 01:41:51 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.89]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4RfBFV3V1dz4x9QG; Mon, 4 Sep 2023 01:41:50 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id AA.7B.08583.ED535F46; Mon, 4 Sep 2023 10:41:50 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20230904014150epcas2p251f19c2220ec8938559bc2873e8e265a~BjpYOi5FV1919219192epcas2p2P; Mon, 4 Sep 2023 01:41:50 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230904014149epsmtrp2edda104effb058a4cb656c67c313a18f~BjpYNvK400621306213epsmtrp2f; Mon, 4 Sep 2023 01:41:49 +0000 (GMT) X-AuditID: b6c32a43-6f7ff70000002187-86-64f535deede6 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 9F.DF.08742.DD535F46; Mon, 4 Sep 2023 10:41:49 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230904014149epsmtip1fc51cc73d9cdae55403127b1af1ed537~BjpX_jc6c1092710927epsmtip1Q; Mon, 4 Sep 2023 01:41:49 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, adrian.hunter@intel.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com, kwangwon.min@samsung.com, junwoo80.lee@samsung.com, wkon.kim@samsung.com Cc: Kiwoong Kim Subject: [RESEND PATCH v3 2/2] ufs: poll HCS.UCRDY before issuing a UIC command Date: Mon, 4 Sep 2023 10:30:45 +0900 Message-Id: <550484ffb66300bdcec63d3e304dfd55cb432f1f.1693790060.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIJsWRmVeSWpSXmKPExsWy7bCmue49068pBqsmS1qcfLKGzeLBvG1s Fi9/XmWzOPiwk8Vi2oefzBarFz9gsVh0YxuTxa6/zUwWW2/sZLG4ueUoi8XlXXPYLLqv72Cz WH78H5NF190bjBZL/71lsdh86RuLg4DH5SveHov3vGTymLDoAKPH9/UdbB4fn95i8ejbsorR 4/MmOY/2A91MARxR2TYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkou PgG6bpk5QB8oKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVUgtScgrMC/SKE3OLS/PS9fJS S6wMDQyMTIEKE7IzrjxtZS54ylPx4NMBtgbGc1xdjBwcEgImEg8m8XQxcnEICexglGi7cpIF wvnEKPHz/1dmCOcbUOb9DLYuRk6wjtmfl0Il9jJKTOvrYgZJCAn8YJTo3M8DYrMJaEo8vTmV CaRIROADk8T/5dsYQRLMAuoSuyacYAKxhQUCJW69Oc4OYrMIqEqs2DyXFcTmFYiWWPjoKhPE NjmJm+c6wRZwClhKfPh0hwWVzQVUs5RD4mfLYRaIBheJnyuOMkPYwhKvjm9hh7ClJD6/28sG 8XS2xJ6FYhDhConF095CtRpLzHrWzghSwgz0wPpd+hDVyhJHbrFAXM8n0XH4LztEmFeio00I olFZ4tekyYwQtqTEzJt3oHZ6SCxs/sMOCaoeRoklR9azTmCUn4WwYAEj4ypGsdSC4tz01GSj AkN43CXn525iBKdVLecdjFfm/9M7xMjEwXiIUYKDWUmEV077U4oQb0piZVVqUX58UWlOavEh RlNgME5klhJNzgcm9rySeEMTSwMTMzNDcyNTA3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5Nnfmi3vfY09N8tiXLN l52rTu7zXbU1YM2xj2pRtewZygd9zl7XnRYj982W9d8XfbGNwd/cRJPrbb/vlJ28fJN52tPQ 7HizRZc3HKv8danQM2L9hRtH7d/nKpzQrrRne6uSf6tbVO3h4t2nTWyN1sgIdPIt6F/993/v 9wNvyq/V8nJrvHtQ3HV+UsiB7ywye9esft5Z+jEiqmZPsP/he151a7Ijfnz8+6xyZcWEI4/z A7ftcpylzXVYR5j5Pp/b7vYl20VqhIvmSBVMFlDtZHc5+WvO8hUajxnNPvxzzZb48NEh+grH PEal532X3opMrply3mnRNo6tZ98aJk7MLzNVYinOSDTUYi4qTgQATHfpoP0CAAA= X-CMS-MailID: 20230904014150epcas2p251f19c2220ec8938559bc2873e8e265a X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230904014150epcas2p251f19c2220ec8938559bc2873e8e265a References: Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org With auto hibern8 enabled, UIC could be working for a while to process a hibern8 operation and HCI reports UIC not ready for a short term through HCS.UCRDY. And UFS driver can't recognize the operation. UFSHCI spec specifies UCRDY like this: whether the host controller is ready to process UIC COMMAND The 'ready' could be seen as many different meanings. If the meaning includes not processing any request from HCI, processing a hibern8 operation can be 'not ready'. In this situation, the driver needs to wait until the operations is completed. Signed-off-by: Kiwoong Kim Reviewed-by: Adrian Hunter --- drivers/ufs/core/ufshcd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 6300ed6..7bc3fc4 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -2322,7 +2323,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) */ static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba) { - return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY; + u32 val; + int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY, + 500, UIC_CMD_TIMEOUT * 1000, false, hba, + REG_CONTROLLER_STATUS); + return ret == 0 ? true : false; } /**