From nobody Sun May 10 21:56:56 2026 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 C24A6C433F5 for ; Fri, 22 Apr 2022 13:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447777AbiDVNZB (ORCPT ); Fri, 22 Apr 2022 09:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbiDVNYz (ORCPT ); Fri, 22 Apr 2022 09:24:55 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B451456764 for ; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id c12so10821529plr.6 for ; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4re5OWonUoWdRvSDXbNxViVwfbYtstxFeWpMXUatUMo=; b=qRTRtoPbGwWu7NbWdxinV9rTgVqPvkLpJjqKnPRc1dkhO6LBdwC8c96r5phZCRCVxq 5aeCyO7cZGFvWYg8rHuGdQS1eH6CLLQqJIv8guW7BxlqSgPLdnisheD+0zELrvzLl86d UBtd8CgC0ZwhIrrKjz5mHBT43/MtHoyo71MUVmPGMaoksVfwYCpqByYld0oMoP/uDRo6 39VcweT0yQx25pyNMKbeb6qprLfMdjfKHHBjdCiD6eje9hJoJC+84CEGQrcALgyeWw2Q 2fVPQz5HTR4BtSHR1f6dVX8rjbnvVGGgkV7atsy+lWLc0iouZcYwqQM7yevVHRfLuyn1 FHQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4re5OWonUoWdRvSDXbNxViVwfbYtstxFeWpMXUatUMo=; b=ycQK86xNEYZ01xzqjEDfXS7KJ6A6mG+FXcNmMz4t+zowqMo84GNQRjPWx8YWKPVRA+ A5YwdMX9mQU1zCcx8dDguUajrzjzrSWfYijM2mzfh0fV46qAFAlxOF8639ku/bV/BmgX oZRjZVSdFLtHpNCl7GroafvxGXSU8Iuh15Xt4K7hX0Z9rrHZ6svnp3yOir509gyLsDSP JHnS4I5c1uxoNGNLSEYgdhgrmeXCVGToDhXd38vA33x91S4kXhHkaX25nW8Xpptl3s/b KVflN5dfgBOs7Gd3X6QL4v1NBS+vqM6N3INQxQPS03m5JRc3GHw6tVANoXGi8Annxi0S iQTA== X-Gm-Message-State: AOAM530XemmuBP7BTR8swtZYLQwTStMsnM3LjTO4iCGwun2D94ifVSTX B+LgPnG+v+pxt+IiCxI2oAcT X-Google-Smtp-Source: ABdhPJwIpV2owBIVHmXS11m41XD/92aDrOQLfeuc66hnB4mj8MFIhw5X9cODI7BW/0wPMEkxnIRRUg== X-Received: by 2002:a17:90a:8418:b0:1d2:7c69:e3bf with SMTP id j24-20020a17090a841800b001d27c69e3bfmr16165389pjn.44.1650633722228; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:01 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 1/5] scsi: ufs: qcom: Fix acquiring the optional reset control line Date: Fri, 22 Apr 2022 18:51:36 +0530 Message-Id: <20220422132140.313390-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Qcom UFS platforms, the reset control line seems to be optional (for SoCs like MSM8996 and probably for others too). The current logic tries to mimic the `devm_reset_control_get_optional()` API but it also continues the probe if there is an error with the declared reset line in DT/ACPI. In an ideal case, if the reset line is not declared in DT/ACPI, the probe should continue. But if there is problem in acquiring the declared reset line (like EPROBE_DEFER) it should fail and return the appropriate error code. Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 0d2e950d0865..5db0fd922062 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1002,13 +1002,13 @@ static int ufs_qcom_init(struct ufs_hba *hba) host->hba =3D hba; ufshcd_set_variant(hba, host); =20 - /* Setup the reset control of HCI */ - host->core_reset =3D devm_reset_control_get(hba->dev, "rst"); + /* Setup the optional reset control of HCI */ + host->core_reset =3D devm_reset_control_get_optional(hba->dev, "rst"); if (IS_ERR(host->core_reset)) { err =3D PTR_ERR(host->core_reset); - dev_warn(dev, "Failed to get reset control %d\n", err); - host->core_reset =3D NULL; - err =3D 0; + if (err !=3D -EPROBE_DEFER) + dev_err(dev, "Failed to get reset control %d\n", err); + goto out_variant_clear; } =20 /* Fire up the reset controller. Failure here is non-fatal. */ --=20 2.25.1 From nobody Sun May 10 21:56:56 2026 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 CF939C4332F for ; Fri, 22 Apr 2022 13:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447912AbiDVNZI (ORCPT ); Fri, 22 Apr 2022 09:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447909AbiDVNZB (ORCPT ); Fri, 22 Apr 2022 09:25:01 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE72E58390 for ; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id h12so7147975plf.12 for ; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VJEo0X0uIfdf+jZ7SJyM0RcOsc+vZ/1fj3+IRG98uSo=; b=UuRfAQoJy7K2TBJgQEpJQdV/DyUhoMT+iHugPct0qwKEVM9OSiu64f6/0B9X+WWfiA 3+CM67PnLsbtUmdy8sW9tfWCaZ2G1SUKgdssobL5IhS0BuFrFLsZZfKLRHk4NGcXWOMX jPhSXh2ogF5zWn7nkX1otJt+OucDcCzF4IvQsl3XoZxPh3heMOlBIQDnNdSK0Ck2YdJM ifvTVRFePBfEXQS5SMY3DRDSfsU14tkKS+IFnF+FlvfzVL9GYbMYlqX34GzJA5PY0Tgk WU+iZmC8KM2rV4tuJDe5BJDPq7dskuW3kmRIuJL+oOkAPscewSavvAoXDPpvUgRkR3mq cukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VJEo0X0uIfdf+jZ7SJyM0RcOsc+vZ/1fj3+IRG98uSo=; b=g8VYaXIpxhGtWpV1XyqFFsNUucoHFxKpeUNzPiQ4gSnA4s/5ETUgctntR0K2sSYJCB dJttpdSN2dGcP664b4/0yMpm05d9uUejJJavQz5qF4NIW9FKbf8d2UWIhKfS+IIYT2AH 5v3ZggmL9MusieSFp4ILfw8ISfonahNTYOs5gp6+H7R7cb1gMOkr/6AvJ6j54Z9/RQQJ alj9/rJkAxg74042RPQ16AfXQEP9kRSpv65Efyh52GfwC7GiHgvXF2dO7Gi9Q97klOou 8HqoTwY4SlcJtHX8YJcI5ed7dBs9XLmercqlyB6MBKDsixAkQqnTNxifrQKWcqclwAVh tonw== X-Gm-Message-State: AOAM531G1G3qhy0dMTnKUUyeGWzxwO4EprP2bAaFF+6PwC4nJ1V+m7Ac 2esLIz/2sJWNhkAcRHAM0uCy X-Google-Smtp-Source: ABdhPJxJ88rBQ4fFhIg73VLAJ+s3N5JhHTKd8gfgR2ZdjfcWB/ifpsSKJMAATbIAqEfKugX7B3fOTw== X-Received: by 2002:a17:902:f792:b0:153:1566:18 with SMTP id q18-20020a170902f79200b0015315660018mr4534014pln.115.1650633727467; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:06 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 2/5] scsi: ufs: qcom: Simplify handling of devm_phy_get() Date: Fri, 22 Apr 2022 18:51:37 +0530 Message-Id: <20220422132140.313390-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is no need to call devm_phy_get() if ACPI is used, so skip it. The "host->generic_phy" pointer should already be NULL due to the kzalloc, so no need to set it NULL again. Also, don't print the error message in case of -EPROBE_DEFER and return the error code directly. While at it, also remove the comment that has no relationship with devm_phy_get(). Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5db0fd922062..5f0a8f646eb5 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1022,28 +1022,12 @@ static int ufs_qcom_init(struct ufs_hba *hba) err =3D 0; } =20 - /* - * voting/devoting device ref_clk source is time consuming hence - * skip devoting it during aggressive clock gating. This clock - * will still be gated off during runtime suspend. - */ - host->generic_phy =3D devm_phy_get(dev, "ufsphy"); - - if (host->generic_phy =3D=3D ERR_PTR(-EPROBE_DEFER)) { - /* - * UFS driver might be probed before the phy driver does. - * In that case we would like to return EPROBE_DEFER code. - */ - err =3D -EPROBE_DEFER; - dev_warn(dev, "%s: required phy device. hasn't probed yet. err =3D %d\n", - __func__, err); - goto out_variant_clear; - } else if (IS_ERR(host->generic_phy)) { - if (has_acpi_companion(dev)) { - host->generic_phy =3D NULL; - } else { + if (!has_acpi_companion(dev)) { + host->generic_phy =3D devm_phy_get(dev, "ufsphy"); + if (IS_ERR(host->generic_phy)) { err =3D PTR_ERR(host->generic_phy); - dev_err(dev, "%s: PHY get failed %d\n", __func__, err); + if (err !=3D -EPROBE_DEFER) + dev_err(dev, "Failed to get PHY: %d\n", err); goto out_variant_clear; } } --=20 2.25.1 From nobody Sun May 10 21:56:56 2026 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 DF253C433EF for ; Fri, 22 Apr 2022 13:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447930AbiDVNZN (ORCPT ); Fri, 22 Apr 2022 09:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447914AbiDVNZH (ORCPT ); Fri, 22 Apr 2022 09:25:07 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED4457B27 for ; Fri, 22 Apr 2022 06:22:14 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id g3so6702098pgg.3 for ; Fri, 22 Apr 2022 06:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0aTsYn+fbrLEF70DYT+XvQa13+urwQkivcKboFHg6Ao=; b=BOWeG3zHuKTf7IsyuvqRU3jzy2o2wts7viRFugf1Pq0w96/Km8O4Z+eJ2+lyhol87H +nf+ptgdCfyRAaqddYGbtV4kEO+ytbIsmQeEGqiHBne7/jNBDm67O5iYSFNFrjm7RAsw N6C3S2vmvGkMTEPHkduQOV+yLdG5nxhYV2QHDGaU3OH8ebpGH77AEutetm5R9RavxTKU KEU8uLmduxy72vCwY749LFujpiNd7YHncSrAEYOJdveIC8sDklLoyn5svJGrUBY0AVce pwjP1COoZcqz8dArUevYhB2ccY6+/LThiedXZ1zt/hMTaVEMaAGlX0OsBc2l9td7HRxX VBDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0aTsYn+fbrLEF70DYT+XvQa13+urwQkivcKboFHg6Ao=; b=Oky44QaPJBs16kmDDP94MOLFkozAz7ycP6r1cDNLAQLxDOaT32+nmXANNaSylai7aQ EpA5HwopIpg+lAnmimnziCyQk1W4Xg3nYpR+DLRlmzpZV7UHRvQ34PHYd5qj4p81CdQQ Y1wL3JVpr3w5TnF8bT2vqfqgbsN5I9uq86ATCvr/9aEqyfOeymCQDps9zZAWcu2w2pfv HiHd4H2SvomC7e7cu/2mCk9p/1ilph+Hmk5mMmUHFzWv2V14cNlZsKye97kK7d4xC/yb uW78TGbM78PG/3gaA9uRUNN7BNsno5UJRdEXIyc/ZuFK1IDV4M9yuXmqDwo3lwUEZlPq qB6Q== X-Gm-Message-State: AOAM5322irNDU/ue2jWlQrHW2dtwHLcrt0JqyZXEdnM4XcxB4cZommZh RY7XKJXcavTJzok09VAybzLw X-Google-Smtp-Source: ABdhPJzvnw8o1O07FvEJgfNvXBizaKMHbMO8qkm1OWHXlD40i9elG+wZHzzrDZiNB5lhOGu8ebUopg== X-Received: by 2002:a63:d855:0:b0:39c:e714:c79f with SMTP id k21-20020a63d855000000b0039ce714c79fmr3830235pgj.570.1650633733833; Fri, 22 Apr 2022 06:22:13 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:13 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , stable@vger.kernel.org Subject: [PATCH 3/5] scsi: ufs: qcom: Add a readl() to make sure ref_clk gets enabled Date: Fri, 22 Apr 2022 18:51:38 +0530 Message-Id: <20220422132140.313390-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In ufs_qcom_dev_ref_clk_ctrl(), it was noted that the ref_clk needs to be stable for atleast 1us. Eventhough there is wmb() to make sure the write gets "completed", there is no guarantee that the write actually reached the UFS device. There is a good chance that the write could be stored in a Write Buffer (WB). In that case, eventhough the CPU waits for 1us, the ref_clk might not be stable for that period. So lets do a readl() to make sure that the previous write has reached the UFS device before udelay(). Cc: stable@vger.kernel.org Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and powe= r optimizations") Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5f0a8f646eb5..5b9986c63eed 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -690,6 +690,12 @@ static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_= host *host, bool enable) /* ensure that ref_clk is enabled/disabled before we return */ wmb(); =20 + /* + * Make sure the write to ref_clk reaches the destination and + * not stored in a Write Buffer (WB). + */ + readl(host->dev_ref_clk_ctrl_mmio); + /* * If we call hibern8 exit after this, we need to make sure that * device ref_clk is stable for at least 1us before the hibern8 --=20 2.25.1 From nobody Sun May 10 21:56:56 2026 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 CE37DC433FE for ; Fri, 22 Apr 2022 13:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447940AbiDVNZV (ORCPT ); Fri, 22 Apr 2022 09:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447929AbiDVNZN (ORCPT ); Fri, 22 Apr 2022 09:25:13 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696D358392 for ; Fri, 22 Apr 2022 06:22:19 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id h12so7149052plf.12 for ; Fri, 22 Apr 2022 06:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UmOApO6ixe70PdHEViIKrF0MVsQtQSBHzDTAzdr8K48=; b=RDUmUjJOVCU9Gom6PIQB7Om6auvTkQ8MtrvaaFjuQWx+PPVuYsNATY7Sju+1neEH4U zuFcEHYhQSKPIvjiLdEmRY0wLcoJFpbvpSP+g1JkKek1hjbpsbmDGVm0gDdYMIRC3g1f 1fCIld1KjTLpEtyAbXDrx6KjokXhKep17zeHKLgD27bUW1QjWt7vsEKykUWh9s7eTWdk FcTliAuQJ2Y+lX72APhDhiGKToK1D+rn0M8ipUbEhli2dcC8O5j1jKru2wIJD6GjF50D FyYVhTr+q88S6lNC2I0JyJqZb9LoQ+lsepMfJLddTgYSfS6WbrwyaputeM38AcVtYI7l 5z+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UmOApO6ixe70PdHEViIKrF0MVsQtQSBHzDTAzdr8K48=; b=bZr5ArA+gicHjFqUBWgF7+NAdx+57ODWYQYypbI/Y9ao/ccj7DRIhJfGr8g5G2aljF 1kQpGd1EOsiCm7pdx/FSFw4YgWii5GI9MWwTHS3TpKsLWS/BYByqKCYpm0oDjofRikzV TYPYsL4dX+Ptu51nZBfnqOFHjFgKiOdPHf5oHefx8fMNlGMyKfzyDB4nFZKPNUBNkg/9 5vwopq83jxL2i+XYOzqZ53HAkd3Xix1pcZC0fRijXnj/g/pCUbpqC7vglRaTgsdgsIp0 x0XUtQG0mgmFM1KCifHYVn4zcvUkW/6vvrsY6sDV7Z61HLrIQoEP6CpGV9hzFxeBXsEb hs7w== X-Gm-Message-State: AOAM533MfG1fLAKqOU5ZsPLP7EdPrpxDXJWBpfYC+Otn8eMGwFHUuPfX NVZAMVk7WOF3O6M9fb1vYZ55eYob8Jo9 X-Google-Smtp-Source: ABdhPJyjSvRzPdzCjO9rxGq3kz927rM2kTVx3GjigPQ8cqLCXqTCHKS1iZuURIg4z6JcfYUsv5Hjuw== X-Received: by 2002:a17:90b:3b4b:b0:1d2:e3fe:e1a0 with SMTP id ot11-20020a17090b3b4b00b001d2e3fee1a0mr5427666pjb.78.1650633738937; Fri, 22 Apr 2022 06:22:18 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:18 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 4/5] scsi: ufs: core: Remove redundant wmb() in ufshcd_send_command() Date: Fri, 22 Apr 2022 18:51:39 +0530 Message-Id: <20220422132140.313390-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The wmb() inside ufshcd_send_command() is added to make sure that the doorbell is committed immediately. This leads to couple of expectations: 1. The doorbell write should complete before the function return. 2. The doorbell write should not cross the function boundary. 2nd expectation is fullfilled by the Linux memory model as there is a guarantee that the critical section won't cross the unlock (release) operation. 1st expectation is not really needed here as there is no following read/ write that depends on the doorbell to be complete implicitly. Even if the doorbell write is in a CPUs Write Buffer (WB), wmb() won't flush it. And there is no real need of a WB flush here as well. So let's get rid of the wmb() that seems redundant. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9349557b8a01..ec514a6c5393 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2116,9 +2116,6 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigne= d int task_tag) __set_bit(task_tag, &hba->outstanding_reqs); ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); spin_unlock_irqrestore(&hba->outstanding_lock, flags); - - /* Make sure that doorbell is committed immediately */ - wmb(); } =20 /** --=20 2.25.1 From nobody Sun May 10 21:56:56 2026 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 1F26EC433F5 for ; Fri, 22 Apr 2022 13:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447953AbiDVNZ1 (ORCPT ); Fri, 22 Apr 2022 09:25:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447936AbiDVNZT (ORCPT ); Fri, 22 Apr 2022 09:25:19 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C8158396 for ; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id k14so7368410pga.0 for ; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zSqkX7TcWeywMjVGkDaqt4I0CfnOOWaEQNQoX91yxGM=; b=sBqYuPt0XifDj11KJF2ArYF8kstCldmcCL7PC0qnMZN5P49dGeJEdwY9Il5Nbmigcm vXAl+JKru3xK/8jUDHbzqSn+H80jg3PMAQQdnV4OSgs29xcJ9OVKpENSjCfG8FW5m2+y SWHgrwbdOg/S7h2yLDzoYTK3n6rJGFol1s7zAfLq2BVvCleckLrksxLgFlsqPmiy4sF2 UV9J2EiGTccRVkxHKPvnRfRWBQn4iV3r6w20PkMg9+7pkiKuLrDljST+RrR+g/v8b5F9 EzPK6kBXX454I+61IhfYh3shai7uT7bWal6WUtObQR0UGnW7MRkJkARV22iYTF8Oypw0 njWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zSqkX7TcWeywMjVGkDaqt4I0CfnOOWaEQNQoX91yxGM=; b=6W4weP1OIqw5ushO+c1lS76dOtVvGIWUc1ARKNtNN4uJymb4tG5YopLCR7/IbzXtTi iEPz4K/FqBH1Le7jvqllThxY4hl/GQBgxMREgtLv3gkGyl4qcizmzO0+7BOpFB0s+Xdi 3XZ8vsiphBKX8osbmevOjW9ggjLGnSDMiDInbNcLkNqcc5AEZL3XWjdiKGbvMF3SQZPJ 1f+/q93ip4bmZNvDBAIjBTKkN7e6PVjzQBoiUtv0Q6jMwYRdI6pN9GGnnRpLukPY5LcU gqbi3UhA/0V33PV/e69BPDB4QKQgWdboollBBxJqrwOEsrpnFuoGmMrJTfhOgtbSBIMi j5Uw== X-Gm-Message-State: AOAM533mlchJRR/C7rEVuJIIFK0GuczjSGN2aQnKIaZR4EnVOq4kfVrw /Sw4bxrgoc1cUD8KkgoGgImM X-Google-Smtp-Source: ABdhPJx6Yzon0UefzWSg/IXHpu2HKWdTxoUKSHKl6fEweWwXW51KugE7J+akdjD2lSXiqst2VNTOMQ== X-Received: by 2002:a62:fb0e:0:b0:505:fd9e:9218 with SMTP id x14-20020a62fb0e000000b00505fd9e9218mr5075359pfm.78.1650633744289; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:23 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 5/5] scsi: ufs: qcom: Enable RPM_AUTOSUSPEND for runtime PM Date: Fri, 22 Apr 2022 18:51:40 +0530 Message-Id: <20220422132140.313390-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In order to allow the block devices to enter autosuspend mode during runtime, thereby allowing the ufshcd host driver to also runtime suspend, let's make use of the RPM_AUTOSUSPEND flag. Without this flag, userspace needs to enable the autosuspend feature of the block devices through sysfs. Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5b9986c63eed..bbcaefd44699 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -879,6 +879,7 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba) hba->caps |=3D UFSHCD_CAP_WB_EN; hba->caps |=3D UFSHCD_CAP_CRYPTO; hba->caps |=3D UFSHCD_CAP_AGGR_POWER_COLLAPSE; + hba->caps |=3D UFSHCD_CAP_RPM_AUTOSUSPEND; =20 if (host->hw_ver.major >=3D 0x2) { host->caps =3D UFS_QCOM_CAP_QUNIPRO | --=20 2.25.1