From patchwork Wed Jun 14 04:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 13279527 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 2ED07EB64D8 for ; Wed, 14 Jun 2023 04:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241048AbjFNElb (ORCPT ); Wed, 14 Jun 2023 00:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234154AbjFNElX (ORCPT ); Wed, 14 Jun 2023 00:41:23 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBF81BEC for ; Tue, 13 Jun 2023 21:41:22 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230614044119epoutp03b45d1335b8be2fcf085b2b299042dbf2~obMsTyujc2829028290epoutp03b for ; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230614044119epoutp03b45d1335b8be2fcf085b2b299042dbf2~obMsTyujc2829028290epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686717679; bh=ihr6uri5JQnq5ljeBYFG+iPe4bTktOiMFmEJJkwqkcE=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=bFPlE49MVJ/RXm2HVHQvxWaqaWjTmvPGMN7J5N2FmhSfJ+k0zt3iiVGVAoLCovJU4 wC4vDQNjfCFIYE7h0azcHdpT4NPPT12Y/zzgwRK/DBg88X9Yims++2I3EwDcI5aG9i /i5UJG8tklvepJEsh454MU9F534glLr+WeW7sp3c= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230614044119epcas2p2c6be1e03c7bd85be9234f36986cdbf7d~obMrsFkGU0401904019epcas2p2B; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.101]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Qgt6Q2j51z4x9Q1; Wed, 14 Jun 2023 04:41:18 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 23.DF.11450.EE449846; Wed, 14 Jun 2023 13:41:18 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1~obMqbRR9G3163231632epcas2p1j; Wed, 14 Jun 2023 04:41:17 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230614044117epsmtrp10e51e4efe1f5fb729a7ab9ef92007ce0~obMqYxv8o3155031550epsmtrp19; Wed, 14 Jun 2023 04:41:17 +0000 (GMT) X-AuditID: b6c32a45-1dbff70000022cba-ce-648944eee364 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 06.77.28392.DE449846; Wed, 14 Jun 2023 13:41:17 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230614044117epsmtip1b9f314395fc3a48df4d04cdcf1ac7d4e~obMqJ4X3P0141301413epsmtip1X; Wed, 14 Jun 2023 04:41:17 +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: [PATCH v3 1/2] ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock Date: Wed, 14 Jun 2023 13:31:55 +0900 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAJsWRmVeSWpSXmKPExsWy7bCmue47l84Ug5/TBCxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZovVix+wWCy6sY3JYtffZiaLrTd2sljc3HKUxeLyrjlsFt3Xd7BZ LD/+j8mi6+4NRoul/96yWGy+9I3FQcDj8hVvj8V7XjJ5TFh0gNHj+/oONo+PT2+xePRtWcXo 8XmTnEf7gW6mAI6obJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUX nwBdt8wcoA+UFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZKqQUpOQXmBXrFibnFpXnpenmp JVaGBgZGpkCFCdkZn+/NYCn4zFcx98oZ1gbGQzxdjJwcEgImEtN3XmXrYuTiEBLYwSixesI8 RgjnE6PEkZkvWSCcz4wSM+ZdZ4VpufrsFxNEYhejxJuuL1AtPxglWpr62EGq2AQ0JZ7enApW JSLwgUni//JtjCAJZgF1iV0TTjCB2MICQRJbZj9iA7FZBFQlzs9fCVbDKxAtsWbjTzaIdXIS N891MoPYnAKWEvu2r2RDZXMA1SzkkDisClHuIjG16xDUpcISr45vYYewpSRe9rexQ5RnS+xZ KAYRrpBYPO0tC4RtLDHrWTsjSAkz0Pnrd+lDV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JO4ea4T rIZTwFJi3/aVYHEhAQuJFcc2MeISn8AosICRYRWjZGpBcW56brFhgVFearlecWJucWleul5y fu4mRnB8aGntYNyz6oPeIUYmDsZDjBIczEoivE812lOEeFMSK6tSi/Lji0pzUosPMUpzsCiJ 817oOhkvJJCeWJKanZpakFoEk2Xi4JRqYJJrNAmKjb5ncvBJi3Zm+Je9k9mmX/Dw1+I46Wey Ynbp//rqE9c2TJ/D66z/4kUQp7PH6yDRxX0JkrzdLTNWqyvotp2zKti64OsHwTn1+ssmnNmY 1bD1c09Xge6tgshOl1nL9W7M5m9/tPyVFdtLF+F/av/jPubqsemaSxs/T9Lt+Df/kVjS/xUf 5k79eiD1pcnkCy23vt35JfPSe7eqp4qfmNiODVKe+pwe+0rPhAolvfQ/bn9aKyH5sdmRB3pf jLWV/K6tmarm71tut6ZlTwTrsYcfYtPXOS/Zr+l+VLbrKveU0kLedztmfr2y0MCy7L5dh+6y 4q4qV21nl4N9ue8U3lz6xntP75nsXelHIUosxRmJhlrMRcWJAFu9BoH+AgAA X-CMS-MailID: 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230614044117epcas2p17e84a99b4cb1ae92a922dea59a5b77a1 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 --- 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 9434328..a89d39a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2457,7 +2457,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, @@ -2484,7 +2483,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; @@ -2493,9 +2491,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); @@ -4180,8 +4176,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 Wed Jun 14 04:31:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 13279528 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 877E2EB64DB for ; Wed, 14 Jun 2023 04:41:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241378AbjFNEld (ORCPT ); Wed, 14 Jun 2023 00:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234163AbjFNElY (ORCPT ); Wed, 14 Jun 2023 00:41:24 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3859E1BEF for ; Tue, 13 Jun 2023 21:41:23 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230614044121epoutp0182ca8cb8ef9d34366df4d40444e694ef~obMtZAx6U2479924799epoutp01S for ; Wed, 14 Jun 2023 04:41:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230614044121epoutp0182ca8cb8ef9d34366df4d40444e694ef~obMtZAx6U2479924799epoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686717681; bh=g9zuD5hWV3D8uTkBVam4nTayIg9/mAMH6WeokaMNnoI=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=Yoepc9TNuV1DNPuj3jaDljfLIfa/9qMhB+I9p5P0XG3jY49Exsk/dYJbNodHulYJl OBKc/A05euXR+K5zPh1Sc6PHWXiTbXcjzM6kdoPDTxk3BkRmvpPDy+FHageA/UADpN HlrljJGdfYrZCkIeLJLq87Nyhf19FwBiCay4t+4U= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20230614044120epcas2p46f3eb503ee2f7c681ae7e6f5e99f6419~obMs5RR192937929379epcas2p46; Wed, 14 Jun 2023 04:41:20 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.102]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Qgt6R5Lgyz4x9Q4; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id BD.E7.44220.FE449846; Wed, 14 Jun 2023 13:41:19 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20230614044119epcas2p19c8bab0dc260312661c7ccedaf7e34fa~obMrvmas13164031640epcas2p1f; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230614044119epsmtrp269770045a8ec578a472a621e46ffbee7~obMruZ1lq1509115091epsmtrp2q; Wed, 14 Jun 2023 04:41:19 +0000 (GMT) X-AuditID: b6c32a48-9f1ff7000000acbc-9b-648944eff892 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 2B.77.28392.FE449846; Wed, 14 Jun 2023 13:41:19 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [10.229.95.128]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230614044119epsmtip197657764673770e2e16f5be93b3c3ad1~obMrfNalu3161231612epsmtip1d; Wed, 14 Jun 2023 04:41:19 +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: [PATCH v3 2/2] ufs: poll HCS.UCRDY before issuing a UIC command Date: Wed, 14 Jun 2023 13:31:56 +0900 Message-Id: <9c7ccbfb8fe05c29ab3e31d9cd14e6b91065b8b0.1686716811.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPJsWRmVeSWpSXmKPExsWy7bCmhe57l84UgyufNSxOPlnDZvFg3jY2 i5c/r7JZHHzYyWIx7cNPZovVix+wWCy6sY3JYtffZiaLrTd2sljc3HKUxeLyrjlsFt3Xd7BZ LD/+j8mi6+4NRoul/96yWGy+9I3FQcDj8hVvj8V7XjJ5TFh0gNHj+/oONo+PT2+xePRtWcXo 8XmTnEf7gW6mAI6obJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUX nwBdt8wcoA+UFMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZKqQUpOQXmBXrFibnFpXnpenmp JVaGBgZGpkCFCdkZ847eYS9Yz1Nx+GQzcwPjXK4uRk4OCQETiXkbTzN1MXJxCAnsYJT4ue8A K4TziVFi6535UJnPjBIHvjQyw7SsedAEVbWLUWLiiZOMIAkhgR+MEu8XqIPYbAKaEk9vTgXr FhH4wCTxf/k2sCJmAXWJXRNOMIHYwgIeEntf/waaysHBIqAq8blHAyTMKxAt0fNpMxPEMjmJ m+c6wRZzClhK7Nu+kg2dLSGwlENiWqcXyBgJAReJy33OEGFhiVfHt7BD2FISn9/tZYMoyZbY s1AMIlwhsXjaWxYI21hi1rN2RpASZqDr1+/Sh6hWljhyiwXidD6JjsN/2SHCvBIdbUIQjcoS vyZNZoSwJSVm3rwDtdNDomX6CRZIOPUwSpy+eolxAqP8LIQFCxgZVzGKpRYU56anFhsVmMBj Ljk/dxMjOKVqeexgnP32g94hRiYOxkOMEhzMSiK8TzXaU4R4UxIrq1KL8uOLSnNSiw8xmgLD cCKzlGhyPjCp55XEG5pYGpiYmRmaG5kamCuJ837sUE4REkhPLEnNTk0tSC2C6WPi4JRqYJrt 6H98ycLPf3/5X1m7oiq0IuNCxi8+3927q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XrD7tRV p/++69XYdCdebvP+qi18ezc0iqasb2z7J2i3UV/9YdCxs5kVfU6GC/zUXoftDNfvUzxWPPXw l+gIcf+OrZxTkv8+TAuvbHRZPG/SfIPO7QJOTF+X345/bWJi+4Xn5Ou5CjllbzU/iK9b2bR2 0oU/B+8sCV0fu+BzTn5erNyjibyOH3pqZ0aW7O5PV7lkwCnPmCNSsYubu5N75uJ5O5YybLEI mCy/VrtYd++F4xUeEhLXtEUvXZ/EWD/9qLYSS3FGoqEWc1FxIgD8MjG6/AIAAA== X-CMS-MailID: 20230614044119epcas2p19c8bab0dc260312661c7ccedaf7e34fa X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230614044119epcas2p19c8bab0dc260312661c7ccedaf7e34fa 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 --- 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 a89d39a..10ccc85 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -2365,7 +2366,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; } /**