From patchwork Fri Mar 29 20:46:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 784402 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A198113BC04 for ; Fri, 29 Mar 2024 20:48:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745337; cv=none; b=R0PuMXGgHjftheocgMqB7G35AEAUSfYfQiV3787fH3qqmw1XlHGWiHmCyvx8SwEXnnJO6u26kdc3QR4AapcJbWLgwxNyzwA+0wNBO5/beYwlrpgglWsihWbr8MMeGQw5U4Iia9qjizSyv0PUJGuimo41OZZmmvspveCHEJEE2Y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745337; c=relaxed/simple; bh=noY0Ok43Br9Lq9vxVD8O578wOnnwfbfMJqrIM3jYkv0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kemgqd2jUIq1X3BzAQb8WSnZciJ3a23+5FxoPwW0iaLXBGhH5AVBPKVkg7BTkHx7tFZrDPVIIMCpMPyrXZZRT3gqBbgEuhSlkHg4GlSZTvz/LrBbZwOy6Uaol/4/jNQ4WvX85XCT29a3MazFhBDcxjpV9+F2t9F69GlzA6rrQ/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LC3784WG; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LC3784WG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711745334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+uex28Uh2UrmMwKWwWQdWkljJkUfVw1qoAdqpkkJAvI=; b=LC3784WGNwHDpgi+e7sSH/tsGMaAc1YW87Wj09DGuIr/+KcBMhM0sTp2ea+R4XebbAnLuc z371yWufDoGjh7ySCoeWtWsCirt3Dqpb+F8nREftmPP+H7+24opDcVXHlK2Ox/QGInemYX QDss2pH2D05aeVXWC8+n6APillYN5Bk= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-0s-tA4UIOe6qP39tY5UcAQ-1; Fri, 29 Mar 2024 16:48:53 -0400 X-MC-Unique: 0s-tA4UIOe6qP39tY5UcAQ-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-698ec7e66e1so12381036d6.2 for ; Fri, 29 Mar 2024 13:48:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711745329; x=1712350129; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+uex28Uh2UrmMwKWwWQdWkljJkUfVw1qoAdqpkkJAvI=; b=Wi5lKccspLIpL4RNA+s8/Xq8YqErCgSGIOXF94zVWrRdBdOnUh5NNQ21vSvJE2PBOv CoUE/3Zn4tPXly1EXSEB2B3vFaqXv01x1UdJ1TRqdPTCPCW8aTGr9cLEGqDmOUNpxwrf OxXEyGe9E4OwuYryg3ssq2tYboaOo6OZTOPhHBIa1g24N2V+jer0PpYvU9mqgfE4NEqd RS652CrPiDoOoJQL/ou7vNjcWoDIIveYY2brqrZlNtJdCcZbzJ0gqlpKEKTQ+1gaVfQe ob+PolegNfxTADaLwtM0nup/CYfeWccOYSFg8pMrCDKTGFLXn+Rqn0FqVatTrnofKF+m ylgA== X-Forwarded-Encrypted: i=1; AJvYcCU/CXLvwxiWUoyZSNFhg9NGx/cczHX4rPjmyw17LflIqFzh2/13vSvlnikCR6fjqVGbi/3RJJNlpTED3CN0Ls7lAEqgP3XTB3IJUw== X-Gm-Message-State: AOJu0YwBbjWklPbIDnb3IfyoY3ZzWq1Ty8hyQZ4+SUwDOtPNivqamcxN Rx8mTY6VgNtdhaSN/q+QKNUN4g/1w1u7kIXlMR1Pe88Q268QxiA3DCYWH4+8UAhWFMNHrAHPiiE XTp87D79uooUD5giB7Amwq/5tR3KBW29kEiJhKpj14PUYAnMg2E094JN+G98= X-Received: by 2002:a0c:b542:0:b0:696:a324:cd9e with SMTP id w2-20020a0cb542000000b00696a324cd9emr3095520qvd.29.1711745328980; Fri, 29 Mar 2024 13:48:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvBfgYmwP1iGTeLUYx8CVUhOtv1wYg6+LYE6N5bTtRV/i7BJo/aa22Q4+l3Q6ah0cplyRTFg== X-Received: by 2002:a0c:b542:0:b0:696:a324:cd9e with SMTP id w2-20020a0cb542000000b00696a324cd9emr3095504qvd.29.1711745328590; Fri, 29 Mar 2024 13:48:48 -0700 (PDT) Received: from x1gen2nano.redhat.com ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id jz10-20020a0562140e6a00b00698f27c6460sm794271qvb.110.2024.03.29.13.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 13:48:45 -0700 (PDT) From: Andrew Halaney To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 02/11] scsi: ufs: qcom: Perform read back after writing REG_UFS_SYS1CLK_1US Date: Fri, 29 Mar 2024 15:46:44 -0500 Message-ID: <20240329-ufs-reset-ensure-effect-before-delay-v5-2-181252004586@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13.0 Currently after writing to REG_UFS_SYS1CLK_1US a mb() is used to ensure that write has gone through to the device. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure the bit hits the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and power optimizations") Reviewed-by: Can Guo Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam --- drivers/ufs/host/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 06859e17b67b..804dc8153e7b 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -501,7 +501,7 @@ static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear, * make sure above write gets applied before we return from * this function. */ - mb(); + ufshcd_readl(hba, REG_UFS_SYS1CLK_1US); } return 0; From patchwork Fri Mar 29 20:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 784401 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B011D58127 for ; Fri, 29 Mar 2024 20:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745345; cv=none; b=DdiphNFYGc/b4/oeGs2lAl3jWNgd5Ll9iyjJ7lQjKcvBD8Hs6rbyM+XfVJuaOF35RhkEnft+4QzODZ9+LeGXYxh1l107iNsy7RWrIRDXWn2RR9DFfi535+JjllUm4ac7f7pz4v/RUY2ydRwvkbGrNYxdKMoUgyNs42YnNd3frK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745345; c=relaxed/simple; bh=O6r7hIkp4pDUEFyTU1K4yQZhhK4XwokMFD5oh2534Uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u2sgowyKyAtx/Uow5v5V0hslXPJzx75tc6KEEbUR2EpFqC8dI+PSarNRR+ucUrFCZVISBprIJP4fvbJI9a3vSrbYSwe7Twwmo8nG2kSybQ4pyEL4AQOLLbCINcNFYg6BKys8eCKUgDGnPXl7q2lNNBS1dkkueovOMJvIat5wGbM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Sh7InM7n; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Sh7InM7n" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711745341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DWQA/2e+hFkNwU2pe5LsnYGd5I3g3WoCTrNziOID4Hc=; b=Sh7InM7nqQpdize4THRmPlTOSWKz8eCYXAryvN5qwUcrP4ucg6jDEePnln0kX2Fe6+0RR8 icZa149ERiFHna+X/CrMlej1JAnrINc7zlLIIAZiaep+sLK+el7A3bnbQEYbvM/ucdUM5X soJb9tcKDjFHaYw1MKzGic092tEKDfY= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-295-IyxP3VGnMzKBjtZHLV90xg-1; Fri, 29 Mar 2024 16:48:59 -0400 X-MC-Unique: IyxP3VGnMzKBjtZHLV90xg-1 Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-6e6864c33e0so2480367a34.0 for ; Fri, 29 Mar 2024 13:48:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711745339; x=1712350139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DWQA/2e+hFkNwU2pe5LsnYGd5I3g3WoCTrNziOID4Hc=; b=ZY053HsILEZQYepVgoWlj2pzckekk7GsDaC2DdU4PHJg7BCzXoVxXEppP7oGKV4yZA JL2+KG3UmW2+zx7nlUmmLYOHBgJpu4myZiqZG7N69RM/POx6umZRgMewdATyw2vjyVSj 3S90LlGOhs7SoQLbkgaaYl6QKC66jh56AubcIl8lOH3DaDHSOcUu/+WOGCyLv8AFGc1b 7R87XOAoz25m2QzLSGQOi3JzxX2QOKC/aGxJL3fZ1gkOWbbaGpSuJmmaVYFfmAQqMSW+ QS04GMdmsbHKsu0gdBFfJzizajOO2cXNzgRBtJo/p24wHs0P0Afur/xTPRFh+m6cO0JU R0pQ== X-Forwarded-Encrypted: i=1; AJvYcCVJukE5Us/Cymg9ulDjS3Gi9Ykj25Ja/WQMFwiTdSLIOQNj3Pj58DpPcIuGxoufiRWW10mdouZxS0cm5jS7rOIGVjDHyOMkdUANdw== X-Gm-Message-State: AOJu0Yy7ZyD2ngmo7d0ytkn60Luak5+SXOjVww0j43bDxioQlWXaroYn UWmS1ONU08TaqG2+X5c/B3w+zLpbdJ6fDeeuitjnSGdJYqv9x/daEeHugSs3YEhQZXXf9LoLWgL mI3TWTY92aiIy4UkyN2YjuIOjNWbJya4Qjh+5cvr0NlvwWQ6lgsSoY7TSmdM= X-Received: by 2002:a05:6830:6f47:b0:6e8:80ad:7053 with SMTP id ef7-20020a0568306f4700b006e880ad7053mr997897otb.22.1711745339265; Fri, 29 Mar 2024 13:48:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdygFKimRtHNOnD4kBIoC+a16ccsbX/L5MSYf1N8IF5y+Qv/ZoWQTsz6gRpJuVnt4/kbzHiA== X-Received: by 2002:a05:6830:6f47:b0:6e8:80ad:7053 with SMTP id ef7-20020a0568306f4700b006e880ad7053mr997882otb.22.1711745338883; Fri, 29 Mar 2024 13:48:58 -0700 (PDT) Received: from x1gen2nano.redhat.com ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id jz10-20020a0562140e6a00b00698f27c6460sm794271qvb.110.2024.03.29.13.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 13:48:58 -0700 (PDT) From: Andrew Halaney To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 04/11] scsi: ufs: qcom: Perform read back after writing unipro mode Date: Fri, 29 Mar 2024 15:46:46 -0500 Message-ID: <20240329-ufs-reset-ensure-effect-before-delay-v5-4-181252004586@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13.0 Currently, the QUNIPRO_SEL bit is written to and then an mb() is used to ensure that completes before continuing. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 But, there's really no reason to even ensure completion before continuing. The only requirement here is that this write is ordered to this endpoint (which readl()/writel() guarantees already). For that reason the mb() can be dropped altogether without anything forcing completion. Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and power optimizations") Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam --- drivers/ufs/host/ufs-qcom.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 649fada24345..66a6c95f5d72 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -278,9 +278,6 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) if (host->hw_ver.major >= 0x05) ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); - - /* make sure above configuration is applied before we return */ - mb(); } /* From patchwork Fri Mar 29 20:46:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 784400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A58B13A246 for ; Fri, 29 Mar 2024 20:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745361; cv=none; b=a6JYhyTmhLTwfL1FK7N9FSvLbcsdQwLyk+fg1Jp4UAfGDMjEi4mP9VI6vpFuDMHdYBT4AQmVSXTvyxJb5gu18XDeDp4KWs/iYj73Pqlb0g6CN6eb3oGglaGHIhNF+dSj+y0TPVJ/8ekCyt1yt63q2o/YwbgFKgo5XnYpqqxlBe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745361; c=relaxed/simple; bh=MqUK4t3jMDCrMMs9Mz5+Qm33rxyXcyDKec2Tc5qngjU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YkcDq7bEIWhwD9bLdUp07CmXoN5v4zSMSTM2PVpmeBu9+g3JurF0p2PAkpbYQV/3qH1CaB93Uoe+VJg7HfkTuiGBWNy11MfHMe0oYQKBIzAcJeDtZ26byZLaqOY9lp3LKt9mGPekw6Q/npaBsLI00qV3whYglbRjzRie4QI2rAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=S/8BiKQs; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="S/8BiKQs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711745359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bbrTh9OZvl0SuHCPomptfMbosBAijok3aL1EimHPcPQ=; b=S/8BiKQsglR8lcLSbSrDsB4qkXbtv5Ff1KhH3ehRrJnzk1oWTwo46oAYVaiYAxUgCoOfK3 q1OPCqtVu9aHgn3pPpj5+FQ9h2nap4JmS8PgCnh4i/x0qv7wYUfEn9kNOj4Ir8ZTSxKgLJ B5Fu4Rjyquuy2gwAjffpObTvChHy9t0= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-YXdEpigyNwKc-VeEVYhjHg-1; Fri, 29 Mar 2024 16:49:15 -0400 X-MC-Unique: YXdEpigyNwKc-VeEVYhjHg-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-696a35b5d38so27573046d6.3 for ; Fri, 29 Mar 2024 13:49:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711745350; x=1712350150; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bbrTh9OZvl0SuHCPomptfMbosBAijok3aL1EimHPcPQ=; b=mCCURvNjNuG8Zk+jWaMgKwOuaIs8MANsU2JlYMgTnbW+55Aet4aK7fl2+ipkB21Oh/ soOPvfBlsiOaLpC1wrTHc6cvMVgBvwFwT/Nu24Zuv/1q9ZdfXS0ps4R45MKzOYdmRXSz k+XK3C7+MKuHr26lUIw2ekbVyy+FOa208DLDys+0XZlGwtmebhn7aJiOcoPnGRcreUnk Tv+sPU+Tk03yjKXVfXZuPokWtv4y92/gnwOb3AVU5FcKFo72U2pebwbZ4BdUNrHBaUmL psb3NxGePCGYW1v8tJquf3jnheS/nqjVPMBYU+QLcVdjHchS8VsD38HmZwcmzg4pZAmQ eGMw== X-Forwarded-Encrypted: i=1; AJvYcCWT/kFA5DoKK/YJWjEBP8rDj/InJEpQorG16DOiOuqEGCE86vpptw00PFeuHNXAxAyNjnQX7GK7xIkPb2glgfEDN+fmeLFPbHFEhw== X-Gm-Message-State: AOJu0Yz/lJ9vuik4AS9lRiaFkiis9gB/IRZ8RpC0xQKfBbEsy5fbZIjG WO4gFiMLL5uFOpmOjDXV9r+BqT0fVBzYESCZuzvegLrvAP6zNIlQlEIkuqpsbRlR7SIL5u+g3zU bm0xYt4xsNMx9XQfe/kmd+Z+WXtKyVuu5X0rUFOGOwSAgwwaiqpZ6RUKolFw= X-Received: by 2002:a0c:d64d:0:b0:696:3a75:2964 with SMTP id e13-20020a0cd64d000000b006963a752964mr3120760qvj.18.1711745350516; Fri, 29 Mar 2024 13:49:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJ88QIcMuVCz52/RQwc9/KpZS2Pszl/Xy5I/f0VraMqB6QDoXwQ9/e4R2qP+NldNZut7x/7w== X-Received: by 2002:a0c:d64d:0:b0:696:3a75:2964 with SMTP id e13-20020a0cd64d000000b006963a752964mr3120749qvj.18.1711745350105; Fri, 29 Mar 2024 13:49:10 -0700 (PDT) Received: from x1gen2nano.redhat.com ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id jz10-20020a0562140e6a00b00698f27c6460sm794271qvb.110.2024.03.29.13.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 13:49:09 -0700 (PDT) From: Andrew Halaney To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v5 06/11] scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV Date: Fri, 29 Mar 2024 15:46:48 -0500 Message-ID: <20240329-ufs-reset-ensure-effect-before-delay-v5-6-181252004586@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13.0 Currently, HCLKDIV is written to and then completed with an mb(). mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure the bit hits the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: d90996dae8e4 ("scsi: ufs: Add UFS platform driver for Cadence UFS") Reviewed-by: Manivannan Sadhasivam Signed-off-by: Andrew Halaney Reviewed-by: Bart Van Assche --- drivers/ufs/host/cdns-pltfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/host/cdns-pltfrm.c b/drivers/ufs/host/cdns-pltfrm.c index bb30267da471..66811d8d1929 100644 --- a/drivers/ufs/host/cdns-pltfrm.c +++ b/drivers/ufs/host/cdns-pltfrm.c @@ -136,7 +136,7 @@ static int cdns_ufs_set_hclkdiv(struct ufs_hba *hba) * Make sure the register was updated, * UniPro layer will not work with an incorrect value. */ - mb(); + ufshcd_readl(hba, CDNS_UFS_REG_HCLKDIV); return 0; } From patchwork Fri Mar 29 20:46:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 784399 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A344148CCD for ; Fri, 29 Mar 2024 20:50:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745438; cv=none; b=sJ5O1KpfExKed2/yawE4PD2ej6VuScWDBq1gHWw7czmgyox9fjxJLTkKqj35h8/g0qDAP5T1nQ5WuX1Klfw1pdaFRezB22CmzIEeSFsmA18Aqy5aISPzMwQ9RYUSAm3tB1nQXtRdIh8XVATO3/LLyVBtClTBz12XLfpNHbAFKgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745438; c=relaxed/simple; bh=rUiFGJENhkjaL5XQk3rVKmNTCac0phrGlXxO+qQgbyw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=erwNqvVoNms4lPJ12Tz/K0dbwc3cVPfYeiBUTN5w1kqGCb+fFL+8JGsGeXmQme8DAVCX7TWOO5B2wZ6bZkvgTzhXZ+7weXN6QgFSFmi1WIfmVtyK0x5FR7p304EH9U+JHSD38BVw5SFkWHjy1YUmQbGXoBIP9XbLbUO/oYfmMJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Rwx9wsfm; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Rwx9wsfm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711745435; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kfliicv5toOd2B87oyO1cEhsCWrclX7x2KOA+OKHojY=; b=Rwx9wsfmQ81+Sm2pfj+F5OwJsfHI0tgP3fkh2nXRXEo8d636Cc3q3dFLZiFfX1jrHHxnzo 6u6qE8zMVSm4rZ+zBlDfpi3oqT/bvhoWRnKI/DaYK+n5q1Zip9onpdNAljtyMIfz06ZMmQ SWpzBjlSiNnS8TpLd1fNmiaxtDoiY+E= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-172-noR1HHE1ORaWqlgxz7XEIw-1; Fri, 29 Mar 2024 16:50:34 -0400 X-MC-Unique: noR1HHE1ORaWqlgxz7XEIw-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-698ec7e66e1so12390356d6.2 for ; Fri, 29 Mar 2024 13:50:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711745433; x=1712350233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kfliicv5toOd2B87oyO1cEhsCWrclX7x2KOA+OKHojY=; b=ncz2cMlpeulnLEN5N0GPiluPDP0auTsixBCslY8nmjM+E1jElfFXil6ZgsIdGJTSt3 QHHElrMsvFTcD36Wj3DZkgxhp1Cl15+qmFdRS0hxMTN9Z1R/Vzwi19izP9+2mxzFyqwj NryKNIvv+G8/GJAl5avBpxjOICQARkaprUI2GVnUAH1misqxqP9JeiFRA7Pr1GsYNCRQ FB58tcmyz5FC0pLPZNDV/pATxBMYmfh5Vi4HXxskQZYEIYjs5ouaYKKrPJGo8jLIwR9/ 0kLAWyYFGLjPa3GA9AfyQMFB5xZqhmZ1aSB0b196mvsF4o5rvYxn8oPDYI2YjBiDqoAb 6gHA== X-Forwarded-Encrypted: i=1; AJvYcCXMeL96lysePA18irwApv+DrlYe8ljRsTUxH5XMi4iPYZGDbIOJsfoK0Ec9kEG/cazAaouBMb4M6hNkbE80IouM4lBi/bxEkxow8g== X-Gm-Message-State: AOJu0Yy+yGxLb/21YjASAx9xQt7m0r4VRRs3KOwIaIbZY5RRGHIljbn+ +IoeAvCN4g+BtrXBI7xVNOHynQarrn2B3grS+ygHlKmr/plgPMS+q2IY2jdtdy0FsjCrzhuzdRh D3j+dA+C7V0X18zu48wdLKZmpD53aUK63EsTm31G6oU3S8lEuR6TXzybfdfs= X-Received: by 2002:a05:6214:190a:b0:696:b095:c429 with SMTP id er10-20020a056214190a00b00696b095c429mr3119259qvb.40.1711745433046; Fri, 29 Mar 2024 13:50:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGSRd/5i8QlyLSkwg85Jxr+u352RMnwF3m/7r26iSWU00W9M/Q4Hw8RMOt9vf05jAbg6L8gpQ== X-Received: by 2002:a05:6214:190a:b0:696:b095:c429 with SMTP id er10-20020a056214190a00b00696b095c429mr3119243qvb.40.1711745432697; Fri, 29 Mar 2024 13:50:32 -0700 (PDT) Received: from x1gen2nano.redhat.com ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id jz10-20020a0562140e6a00b00698f27c6460sm794271qvb.110.2024.03.29.13.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 13:50:31 -0700 (PDT) From: Andrew Halaney To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v5 08/11] scsi: ufs: core: Perform read back after disabling interrupts Date: Fri, 29 Mar 2024 15:46:50 -0500 Message-ID: <20240329-ufs-reset-ensure-effect-before-delay-v5-8-181252004586@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13.0 Currently, interrupts are cleared and disabled prior to registering the interrupt. An mb() is used to complete the clear/disable writes before the interrupt is registered. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring these bits have taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure these bits hit the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: 199ef13cac7d ("scsi: ufs: avoid spurious UFS host controller interrupts") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a89887878d98..268fcfebd7bd 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10616,7 +10616,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) * Make sure that UFS interrupts are disabled and any pending interrupt * status is cleared before registering UFS interrupt handler. */ - mb(); + ufshcd_readl(hba, REG_INTERRUPT_ENABLE); /* IRQ registration */ err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); From patchwork Fri Mar 29 20:46:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 784398 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 899B913AD38 for ; Fri, 29 Mar 2024 20:50:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745451; cv=none; b=beytFl0kTk6hGkTM9iEbmrrv/wXZg7nAXWyFAGcVlYCPsj3bNFqw8AootArCazkbfztbAE4kD/seUXGO97i4pXKCvHFyNy8Qq8KazCtKYBlHJKz6Cm2e1ArGMZSy8hcsfuQAuGtBTSP9XzUhXb1amO2JADqU4BRg3MU0q00smyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711745451; c=relaxed/simple; bh=Zy+bgvSnjLkgq0s4C6zNdmvBRZh1cOH+2n6Swd6Xvls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mLA0cZhG+QXPXO+Y5awDl/h4ezUJxjtxL0Aswbp3mctrhMXITbn4gdP+8Liz0F2xr71xzVR3uDcoji5egAQ8wsXSfqC6fyXz14h5drLixvu84u4JTe5u+vymL4DWMdW9olZbN+39bWauhQalqvaR7yLMGrAvm4dLbkHQDAat0lE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ckrvrsME; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ckrvrsME" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711745448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XPnsustGT4GoUrGTcO/hGoT1b1FUZsTVit4gdTDovY0=; b=ckrvrsMED1h4VCxfnb0ekQzIHI3IiRBdwKT+f6jfs2L0ilDK2Nudf4xEgo0mWeKenCPTcW 0mUzgoUGZRNuBXqX7s06aE9JeE9zsF1uUya5+mdGVx0LxICsY43ye/eBYtXbvXDMJKGgvb FMO+B9jZlCvHTdSkA2xJLRc9HYT2edk= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-sIFnOJscP22zvaz7q82iWg-1; Fri, 29 Mar 2024 16:50:47 -0400 X-MC-Unique: sIFnOJscP22zvaz7q82iWg-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-69655dbec66so23874016d6.3 for ; Fri, 29 Mar 2024 13:50:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711745443; x=1712350243; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XPnsustGT4GoUrGTcO/hGoT1b1FUZsTVit4gdTDovY0=; b=uwnhQErkuOwgPIYI+HprFS1lb9W3Hk9f9ibq9Pme67cV30o93UiQ/1m76MfjoSJGYo 7nnQR3rIhtQjqUikf/mHkGIlzQKcn2oRsSSDpPAErFQmiGlJCwWp8b/W6+xER/cI7HSo anF6klV0JODf+Bf9MGock09nejaYG14NcuXWU3HdsRclofk4I0hlqPU3WTf06XAQ6elV bJm4hAder/Up0IuGsk5r+jQZ8V0Xg1oGnELDR2rO91Byc9LcKVIQvWFk3LK0diXSwbMy 9s/kAhjuBBHKGA1pVb9ry1pAjTYKlpfplDknOVrZO490pD43bsaKlY4KWlvH9yR3NSAL MVwA== X-Forwarded-Encrypted: i=1; AJvYcCXbbDu12lFvE8IXwcN9ew6g+Uq3XdTWFMPo5zo/UGPWYW0PcJey12fCercC6K26V7dgBaXwBDVHMwJuCXABxOAEhk5dDC8OvfR8eQ== X-Gm-Message-State: AOJu0YxItiOFVspqQRt5496PbKvnfIF7ezXiAW7V5i/irmziLXFDhLYq 2k5XVZrvli6JJaqCpFdKWph5Q1BQOZ0zF/BjXZVrnJaLpg8TOfdZntfHZnXlDKvZ2lOrjKEBUTx cvroSmggNlGjLAc8HpluHmTD1mIF66rhz3UpyySziUSshzAk3+1+idORfVsw= X-Received: by 2002:a0c:d646:0:b0:698:f3f0:39dd with SMTP id e6-20020a0cd646000000b00698f3f039ddmr2065508qvj.6.1711745443262; Fri, 29 Mar 2024 13:50:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBLrn+K4mLNtCh2Rz2Xmh067Hv24Kl9mQ40ZdwbQbhkZQb5T0j5S5g1FGjMUP56UzrNARqQA== X-Received: by 2002:a0c:d646:0:b0:698:f3f0:39dd with SMTP id e6-20020a0cd646000000b00698f3f039ddmr2065487qvj.6.1711745442848; Fri, 29 Mar 2024 13:50:42 -0700 (PDT) Received: from x1gen2nano.redhat.com ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id jz10-20020a0562140e6a00b00698f27c6460sm794271qvb.110.2024.03.29.13.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 13:50:39 -0700 (PDT) From: Andrew Halaney To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Janek Kotas , Alim Akhtar , Avri Altman , Bart Van Assche , Can Guo , Anjana Hari Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 10/11] scsi: ufs: core: Remove unnecessary wmb() after ringing doorbell Date: Fri, 29 Mar 2024 15:46:52 -0500 Message-ID: <20240329-ufs-reset-ensure-effect-before-delay-v5-10-181252004586@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> References: <20240329-ufs-reset-ensure-effect-before-delay-v5-0-181252004586@redhat.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.13.0 Currently, the doorbell is written to and a wmb() is used to commit it immediately. wmb() ensures that the write completes before following writes occur, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 But, completion and taking effect aren't necessary to guarantee here. There's already other examples of the doorbell being rung that don't do this. The writel() of the doorbell guarantees prior writes by this thread (to the request being setup for example) complete prior to the ringing of the doorbell, and the following wait_for_completion_io_timeout() doesn't require any special memory barriers either. With that in mind, just remove the wmb() altogether here. Fixes: ad1a1b9cd67a ("scsi: ufs: commit descriptors before setting the doorbell") Signed-off-by: Andrew Halaney Reviewed-by: Manivannan Sadhasivam --- drivers/ufs/core/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index dfa4f827766a..a2f2941450fd 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -7090,10 +7090,7 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, /* send command to the controller */ __set_bit(task_tag, &hba->outstanding_tasks); - ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); - /* Make sure that doorbell is committed immediately */ - wmb(); spin_unlock_irqrestore(host->host_lock, flags);