From patchwork Thu Dec 21 19:09:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp631490dyi; Thu, 21 Dec 2023 11:11:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHqjsDh2iHtb5jqoPNgU4VsTjvNxT8pJAPV80RU9v1Ai5LhR45J7I93HjRxu1EjDo7Fbx1 X-Received: by 2002:a17:906:25d:b0:a26:98ff:6464 with SMTP id 29-20020a170906025d00b00a2698ff6464mr126507ejl.17.1703185873378; Thu, 21 Dec 2023 11:11:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185873; cv=none; d=google.com; s=arc-20160816; b=r7g7RS4lilwnUmx2VIlJNd7jydqrdeTB3KfFLhs40pFNSn1PUAkDn2Fu9TC+ocKBwt jMRNIAapp2hlUGqKz/Eh8pbPanjFWKpUhOCuZliX8M+iRuQ9hqqhsE0YTbqVz5j4QN9B aUVvblIU8mcE1+0MBOys+9zYH8lc/vlZOGvIZuOmaDLdWa6SLw6vduTR+/EVTLm8DZEC 7b0Tesnc8Xe5c8m8nvEpbSyKmsmb+glQsjPY1sSIA0vpNxoiBpSin32o5KbMf24LmeZy yFEIqHcShi01mAhY+7vsYMpgY5Zmw0xPAmC+XCd5Il9qyDWSBDL7LE+Qhk1hzk2aeXwh e7oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nPTRfp6XgPJwYrXbStNGHlrTw26cplB52DVfER92OzE=; fh=sZjr1X209RpV6CW6bF47/guNu/E4ZUOEtACd37gRznE=; b=u3jQZF+1TTA/GnRWozb8yBoc1ib7DBybgcs72ezsOREwfe25VoD0rnP0T8NP78CfiD 0M3m2TDxPhJ3UEuulWupVdsNogqiE7hvzT4e4S9FaH3k7iS0eD+BCq7It21tS6fRK1gJ TpTM+SCQOtUS3JVCSqDiQmJOlBwzEbGByDueJH+FLuQecDtGMZgIYpU3BZeDtETwQFuh A2s+zr0JIoTeVT66azFNPl77FX9owKNv+iG0Eg4lpeMnmzwc182htuwFYJsatl/hGDpR UVoMm40HL+faP8JUAcZtFkQdAk8+ph9OPT+7pi0fB6aLIl8CrSZc8M5eWZhhQWu4dPey 8zWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tw7aH+eS; spf=pass (google.com: domain of linux-kernel+bounces-8979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8979-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z10-20020a1709064e0a00b00a089f01d380si1112547eju.559.2023.12.21.11.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Tw7aH+eS; spf=pass (google.com: domain of linux-kernel+bounces-8979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8979-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D5D881F223A2 for ; Thu, 21 Dec 2023 19:11:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 73E5F76099; Thu, 21 Dec 2023 19:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Tw7aH+eS" X-Original-To: linux-kernel@vger.kernel.org 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 73A35651B3 for ; Thu, 21 Dec 2023 19:10:34 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185833; 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=nPTRfp6XgPJwYrXbStNGHlrTw26cplB52DVfER92OzE=; b=Tw7aH+eS6mn1oGdWZSFzfzvxRgu0Oo2EGHydNOXHT6YmmeVqOU6mbEFHy8X6eX2t2iya7g Rl0LTR3HRoJLof+JZtAmw9uJlJg3b62vXCqi8UcO8a+J3oWSYAVH4MDWYLufrvGnrisqT7 MobdRkhOUkqb0HMj9PkBUNMLfv4lA98= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-625-Eop6SLygOmKuvzHm3Ezn8Q-1; Thu, 21 Dec 2023 14:10:31 -0500 X-MC-Unique: Eop6SLygOmKuvzHm3Ezn8Q-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7811b42ac40so137421585a.0 for ; Thu, 21 Dec 2023 11:10:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185830; x=1703790630; 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=nPTRfp6XgPJwYrXbStNGHlrTw26cplB52DVfER92OzE=; b=SSeDaPFKND+fInjcmj+0LcD99uXDMIqMBPG+2vFaPZ3gH4tJ14OuPxoVtsHqmGZgtG fXUyw4V8CG8PnZKPyr/4AzFgrTkJh3WhU2NEXArsxZQmgcOAv8uk5zjFADl1q6pAusRM HkCdKPuPbSBOzpO0xhmIzQMs7rY2GLnoJ9qQRLUlpJm5soTLz09b+5bEfRkueeWI1vKv tU2OzCclpEU4Hb0zhMXjwbSiwIUTK4klHHlZxOHol2wH8hPncLJx034Z+b88w8IFB5mD yu18wB0AzkgiSq8RpXBIVDLwEKSowhtasXrV23Fz/w6WNHl9JDiL2KUzixWHxszO2lzI AZMg== X-Gm-Message-State: AOJu0Yyfg71Lj1R1NNEsKpEZcD2ZmW8Cvp7fRlOwT6V9NtxZDraLdOSH jAlowUxNIM1BXgv2PJRNY7dqVG73yIBBJSGlKysLztX+pMxAvGMVKw/c3RDIOUkPoEHc2EAg2wG D4VbbgDWqaguHsgVWbXq/9LwZUWVzuw7u X-Received: by 2002:a05:620a:40d2:b0:781:1d86:730e with SMTP id g18-20020a05620a40d200b007811d86730emr409220qko.46.1703185830372; Thu, 21 Dec 2023 11:10:30 -0800 (PST) X-Received: by 2002:a05:620a:40d2:b0:781:1d86:730e with SMTP id g18-20020a05620a40d200b007811d86730emr409201qko.46.1703185830108; Thu, 21 Dec 2023 11:10:30 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:29 -0800 (PST) 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 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 RFC v3 01/11] scsi: ufs: qcom: Perform read back after writing reset bit Date: Thu, 21 Dec 2023 13:09:47 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-1-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919830286852621 X-GMAIL-MSGID: 1785919830286852621 Currently, the reset bit for the UFS provided reset controller (used by its phy) is written to, and then a mb() happens to try and ensure that hit the device. Immediately afterwards a usleep_range() occurs. 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. By doing so and guaranteeing the ordering against the immediately following usleep_range(), the mb() can safely be removed. Fixes: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms") Reviewed-by: Manivannan Sadhasivam Signed-off-by: Andrew Halaney Reviewed-by: Can Guo --- drivers/ufs/host/ufs-qcom.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h index 9dd9a391ebb7..b9de170983c9 100644 --- a/drivers/ufs/host/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -151,10 +151,10 @@ static inline void ufs_qcom_assert_reset(struct ufs_hba *hba) ufshcd_rmwl(hba, UFS_PHY_SOFT_RESET, UFS_PHY_SOFT_RESET, REG_UFS_CFG1); /* - * Make sure assertion of ufs phy reset is written to - * register before returning + * Dummy read to ensure the write takes effect before doing any sort + * of delay */ - mb(); + ufshcd_readl(hba, REG_UFS_CFG1); } static inline void ufs_qcom_deassert_reset(struct ufs_hba *hba) @@ -162,10 +162,10 @@ static inline void ufs_qcom_deassert_reset(struct ufs_hba *hba) ufshcd_rmwl(hba, UFS_PHY_SOFT_RESET, 0, REG_UFS_CFG1); /* - * Make sure de-assertion of ufs phy reset is written to - * register before returning + * Dummy read to ensure the write takes effect before doing any sort + * of delay */ - mb(); + ufshcd_readl(hba, REG_UFS_CFG1); } /* Host controller hardware version: major.minor.step */ From patchwork Thu Dec 21 19:09:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp631718dyi; Thu, 21 Dec 2023 11:11:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnUOqN60ZxVWISG//MaVTLTRux+DvCxbChxFFHzWFyKAXH8/Gu9TmQdlXXSRjqM9WGqdN5 X-Received: by 2002:a19:914f:0:b0:50b:f2e0:4991 with SMTP id y15-20020a19914f000000b0050bf2e04991mr32063lfj.106.1703185896316; Thu, 21 Dec 2023 11:11:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185896; cv=none; d=google.com; s=arc-20160816; b=KUDPXx/pnCqX7fw8seXXqgvL0ZbrefY/YI2/WOyqz8/5299bPS3iiqTX0Tl6AbE0OH GzrCjvFsNuzfTM9RS9psGMY6V9TiyqdXToM6/zhSF8edaU/yH819Njh2TmCT+gLYgPSU lW71BNgisjjutf0TPnCzWrIznP4EIP5VBZzkdfvEm+0MrhKv5n4r076O1xobQ/FZtOvO 8HsKnbl2yQ7siHLIDecL5m7QmMEKcVPyxelmyA/CBttB4N5cOOvpox/s6mEKOIheYnDL kzt/UFwVJpUP/jn24MhmSEl2crKYaVf5ihuQMnP6dkJa2UsR2lIdk5YdT4I6WFYiqF+G 7ikg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=V5DIcTT5Lroakb0MY1T0EdVJKAtxjaPCe5FVxbyPj6I=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=wwZ2htK8dzvjdyOBhbWjKfCPzFPv3KkpMCb8euGms8JeauAX50isKQmukP4pig/4tl qobmgfblqBNzjE8gwg1gMOJjv14grOkCndce4GnIrxrRSO06RqxLqHlt4B0oKWIsWYFR VLhJBG7PotvJBgyv+uk8VkNQX9CFy6Sa1c1vUB6/2uYyl0MvKFaYsdaIhP+cgLZeZ8WZ FaSCitJqCKTiKZoRuxhk8TUsIKqqQJYqjamAd0qa9f9Wtl3WNImLXN1AvmT3kC1HI9RZ a9RGug75y/Nv+fq2bJIQ6gXTRbeiu0sBbwC8u+LImZTHEV1Vxd8g1iwp73rpDV8QHb6V vS1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I7gIckPs; spf=pass (google.com: domain of linux-kernel+bounces-8980-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8980-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v21-20020a50d595000000b005538ad08b5dsi1103202edi.611.2023.12.21.11.11.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8980-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=I7gIckPs; spf=pass (google.com: domain of linux-kernel+bounces-8980-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8980-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DBBC91F245DF for ; Thu, 21 Dec 2023 19:11:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BC77768EF; Thu, 21 Dec 2023 19:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="I7gIckPs" X-Original-To: linux-kernel@vger.kernel.org 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 5D0BF760B2 for ; Thu, 21 Dec 2023 19:10:42 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185841; 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=V5DIcTT5Lroakb0MY1T0EdVJKAtxjaPCe5FVxbyPj6I=; b=I7gIckPsdRnHZO2ome4C9cC1jclhK2+ZneF3su2t9oZoOV7bCQsNDa9EVeEHgadGgxtiFx u/f5sniFfKoEAqZPJGuXUoE8CmTqDvBlTnwhUjfkUcBs07dCp+NrOpzlAIh7i/nDww2XTy i56AdMaQfgwbcwyhUsXGe0cEEVM3anE= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-PNP2VNmEOJW-sfcoSDgJVw-1; Thu, 21 Dec 2023 14:10:40 -0500 X-MC-Unique: PNP2VNmEOJW-sfcoSDgJVw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-77f4b757646so99385085a.2 for ; Thu, 21 Dec 2023 11:10:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185835; x=1703790635; 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=V5DIcTT5Lroakb0MY1T0EdVJKAtxjaPCe5FVxbyPj6I=; b=RO81dB0+PUr6tZM55GlW4UTVMWcXxYf2BjO5F1nFt7D+mMsbtYyj3il9RKEHRrO2nd ZlUXi0asVTxX2ClmTLdByJS7sjSUb7pv6EGqwxCNWwZ7jlkdXGxf0ogSKyqNL2PdLJzf V/uK8d31gokt6UUxc2oz/9qoljmBs4J5pmMbenEHvPTLo/ovqINXHmOeBgAkDNX9PbuK kMSA4rfLH4FFRSLWqFbli85EnRKPRiM9hmHWoUjCBVgU9lFq+kEsaxJxkWakG7s4uyN1 d2dQMSQANnyygxdEu2fdxmqppV9Qos3YUc1bPARUd5I/mqs4u+CaXvMVge6W/W3XD8X6 8xIQ== X-Gm-Message-State: AOJu0YxbxH4XUrwAMWj11BsVkqMzNJihRCAulqP0YvEhhKks4ADvttJL wyj3MwBEfjc2lJ8LdyyUL1O7YQo7J9pMV0R8khEPudYM6Wq6ueF0hJ/JYgWXZXSbSCZBi9Wywmj RJdvgrJGyvhOPPMaWyClKbiK2/sywccL9 X-Received: by 2002:a05:620a:ed0:b0:77e:fba3:a799 with SMTP id x16-20020a05620a0ed000b0077efba3a799mr242443qkm.119.1703185835165; Thu, 21 Dec 2023 11:10:35 -0800 (PST) X-Received: by 2002:a05:620a:ed0:b0:77e:fba3:a799 with SMTP id x16-20020a05620a0ed000b0077efba3a799mr242430qkm.119.1703185834841; Thu, 21 Dec 2023 11:10:34 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:34 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 02/11] scsi: ufs: qcom: Perform read back after writing REG_UFS_SYS1CLK_1US Date: Thu, 21 Dec 2023 13:09:48 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-2-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919854431890289 X-GMAIL-MSGID: 1785919854431890289 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") Signed-off-by: Andrew Halaney Reviewed-by: Can Guo --- 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 480787048e75..4c15c8a1d058 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 Thu Dec 21 19:09:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632616dyi; Thu, 21 Dec 2023 11:13:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBHiE9nb/oW/ZbyOTwqm6fGYUTV0RMvZN8lYYHtQpPY4lLfhnvHw+hsc9H/CJJwTe8Tsef X-Received: by 2002:a05:6a20:ba82:b0:194:c6d3:1bda with SMTP id fb2-20020a056a20ba8200b00194c6d31bdamr147158pzb.120.1703185988177; Thu, 21 Dec 2023 11:13:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185988; cv=none; d=google.com; s=arc-20160816; b=gBDdPGAN0g72qO69u3/Z7Yu0r3EBLwRH3V/ZYoaixHNqM/D9wNGXQSMYYsjvJ6ljcF 0ykl+NKtnQjgIA/nCS+MnN3XAmRQr+TCwNOUrP/dfrVQeZvoje+kEYabWnGC9q+5lsjC r9gGiqux6y+ghkuC+0L+zeHvFHvvNv6QmKZCoJrkVJsUItak+fUg6CEJqvKS8pF0uAiT VMsH1o93ANxJ1yC5RPuzQ68zpfCsoRabdtXfPAv1yW00RfqVuXJ8aLMYMhowMPxDYXhL npXvnM2ZclqvLuH3Fc1xy4a8+tFKeb+J8d8WTW7SyuY0jjkcStAqlXv8w2PvKJ0n9jj2 Y20Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n1l5xZhbao6yyLMAHMlDGMBOyE+StA4U3ea1c7HAYjQ=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=W8rU2edD9bxAmKj2BdKS+2QFI1r7Xh+egpPoamwRExp0AiDFKoq90rCe3qSWyGfWYi Iug/ExC7lrqBiMfG3xIdqIUjaqmc95QU1IlUvejTs4wpeFhtzCg5xvWaMYkSY9ma/yEP X8SrN4CJWWZiWGtxOxP7Cnc5OfuHrGC3Jp647mWpjtvxZ1fwxJU8TUnqwYIdEUr3aArm cOIuQGra3rR5sparr2fYimioKUy0fzlxmk1iYG6Rpn7VejChQmziU2CtDI3YdEpUe71C hnI55dImk/yiSJPKJzan1l+QbSfd8WnDhZMs5Q8zD6KDMXoz7Rgv7OrIPuiA7waZXrRL C95Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cCNfxIPG; spf=pass (google.com: domain of linux-kernel+bounces-8985-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8985-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ca27-20020a056a02069b00b005cde4163a66si1778783pgb.354.2023.12.21.11.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:13:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8985-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cCNfxIPG; spf=pass (google.com: domain of linux-kernel+bounces-8985-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8985-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 964A5B23687 for ; Thu, 21 Dec 2023 19:13:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD35377F0D; Thu, 21 Dec 2023 19:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cCNfxIPG" X-Original-To: linux-kernel@vger.kernel.org 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 E1A82651BB for ; Thu, 21 Dec 2023 19:11:06 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185866; 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=n1l5xZhbao6yyLMAHMlDGMBOyE+StA4U3ea1c7HAYjQ=; b=cCNfxIPG/IIKkaPjEZu/pQqCgH6l5us8P2bfuuTBZJg09XmYWthH06sVbZYMmmx1ZXSDsT lrUvd3Qac1cdpOyTvYKy6gFwwm0Hgs1MJYeAYxDBo2BJhr9wpjUvHMoKxNwduJIcIvndBw K8wPZteN9ZJMVv6iM2nokpKoD7Ebocs= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-461-p7CO16_yMb-bn8DaF0X76A-1; Thu, 21 Dec 2023 14:11:04 -0500 X-MC-Unique: p7CO16_yMb-bn8DaF0X76A-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-77f54424077so142099185a.3 for ; Thu, 21 Dec 2023 11:11:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185840; x=1703790640; 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=n1l5xZhbao6yyLMAHMlDGMBOyE+StA4U3ea1c7HAYjQ=; b=HwL7xJhkokIEsGBPIOz0UkDZmzDs8lrQaFfQ3k2WHt+w5FFBH5Q3m7bccvypv3PLuG Vbq8FVrnyNCaOdzrrhK80bs8nAsqoy873KY3JyYFidG9dbjCrEWuK3kHRoPbN0I7Aa7N er2EixKkhuBGCUjfoMeKkkjf/ZXDc5M0BK3XfcW6rNNGlGix0JitW1M+CUvC/0p8OloC InQbYwdmfD+F9+DMQVZdSpCDI56vnK9+jV2XHf+aJOZzXertXF3SUxP85T7waDq77uN1 01vBHfT8/zh3RWVxJj3/nb8KipuS3aKkm+vsVWdyJnWyv1gpQZbShXXRNDqa76MkazN9 vakg== X-Gm-Message-State: AOJu0YzJlmECZiFdZ2ITnSLbeaORu7XM52XC26Z7i08DeEO+YtkbqBYh VtnT6SgAGNG61XMddiSUQ7wzDk3fytW0RrxyWcwt6+DNZteJOIDxAypE7PXiO6fhAiWNZSsW+ts Noq5A/05aYT2yPq59iymjj16qWnXkbN29 X-Received: by 2002:a05:620a:4892:b0:77f:3d4a:6dcc with SMTP id ea18-20020a05620a489200b0077f3d4a6dccmr391380qkb.8.1703185839990; Thu, 21 Dec 2023 11:10:39 -0800 (PST) X-Received: by 2002:a05:620a:4892:b0:77f:3d4a:6dcc with SMTP id ea18-20020a05620a489200b0077f3d4a6dccmr391370qkb.8.1703185839745; Thu, 21 Dec 2023 11:10:39 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:37 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 03/11] scsi: ufs: qcom: Perform read back after writing testbus config Date: Thu, 21 Dec 2023 13:09:49 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-3-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919950789370970 X-GMAIL-MSGID: 1785919950789370970 Currently, the testbus configuration is written and 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: 9c46b8676271 ("scsi: ufs-qcom: dump additional testbus registers") Signed-off-by: Andrew Halaney Reviewed-by: Can Guo --- drivers/ufs/host/ufs-qcom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 4c15c8a1d058..6df2ab3b6f23 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1332,6 +1332,9 @@ static void ufs_qcom_enable_test_bus(struct ufs_qcom_host *host) ufshcd_rmwl(host->hba, UFS_REG_TEST_BUS_EN, UFS_REG_TEST_BUS_EN, REG_UFS_CFG1); ufshcd_rmwl(host->hba, TEST_BUS_EN, TEST_BUS_EN, REG_UFS_CFG1); + + /* dummy read to ensure this has been enabled prior to returning */ + ufshcd_readl(host->hba, REG_UFS_CFG1); } static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host) @@ -1429,11 +1432,6 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) (u32)host->testbus.select_minor << offset, reg); ufs_qcom_enable_test_bus(host); - /* - * Make sure the test bus configuration is - * committed before returning. - */ - mb(); return 0; } From patchwork Thu Dec 21 19:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp631923dyi; Thu, 21 Dec 2023 11:11:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkjdwLNHzvG+f1DTUdK3P/UE+9r4SlXvpn1KDxderPThtG2D9v+8MF6XGKZSVZnThvgae5 X-Received: by 2002:a05:620a:5625:b0:77d:cc40:252e with SMTP id vv5-20020a05620a562500b0077dcc40252emr307725qkn.51.1703185918045; Thu, 21 Dec 2023 11:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185918; cv=none; d=google.com; s=arc-20160816; b=huMntFk2pzAWAADBHVDACQT6pQuD49TDTNN4ohMm0hOFod1fMrKKI5Vk7hoKn/6v3Q 9JySyYiJ0QdDqhG1CjGZBP9/amQykVQVyHXd/ti+xmzrEo+AFBZCfnFINLwLVGWnzpvC Ox65U8gwTEtE4hR9xqhqxCFHTrxG/1VS6rA3/i73igUhlb174Rpcq4MiMlpiamfThCM5 M2YP4zVzHmXgeVOl6RlsxOjYx9Hrn3alcjdzuFiHhBb6NGhvnAhgfVr8mvCj+Ji8SyaX RbxMDDRGMUjBqBFJb26pK8IRuWUXldDOOVXqBHC7g+N3X2KyeP2Ulps6tJ36/lHq+dN9 w+0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4219KYM+Lx5MIoMXHlnouIE3ETSXouTN4mLohiWEzAY=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=gdus1x7Nm6Eosb2F9W3g3LuF5eSwyA8YQY5fr3/b0Pl79aoVV19Rsgmx6OHvCdHYgO R0VbLPEZDfxbVY0mkVWqs09R+lNaahBLiZcf9wG7uIU5yNXaaQldtgH/mLCU8sWny22P vQGjqAEeanrLMqH5pP2VD8Mg4sg4i/mgo0XoF0fZ0Z3wCjfONxPK8jtbRAvwmnqdqREx Ix/e6Lmm6762GN4BdGFBQQFlOrdzKXvinJYw4VHYJbNEFsZUy0EztLP3pkCfEQq8BEFx ewnR1gTKpXjY/qCd5NWw1RspSIumhr8fYWvf1SFjSz6U+o1sLjU5GMFKl3241RcqGHet DLIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cVqiZ/qE"; spf=pass (google.com: domain of linux-kernel+bounces-8981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8981-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bp7-20020a05620a458700b007811c55e1efsi2554688qkb.111.2023.12.21.11.11.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="cVqiZ/qE"; spf=pass (google.com: domain of linux-kernel+bounces-8981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8981-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C422A1C23EDC for ; Thu, 21 Dec 2023 19:11:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BCAB768FE; Thu, 21 Dec 2023 19:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cVqiZ/qE" X-Original-To: linux-kernel@vger.kernel.org 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 A65C0768EA for ; Thu, 21 Dec 2023 19:10:51 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185850; 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=4219KYM+Lx5MIoMXHlnouIE3ETSXouTN4mLohiWEzAY=; b=cVqiZ/qE973zKIjMx/mGBXZe6j6jFQtUnlaeYsrPHGY624nS5FaJcj9JpFl+Cgy9KxqQNX nS3Vv15qSFaCeKne8MJSpM/t7qEoTzd6G4xs0ljQl3fRifSbHsFcftoNQyzPlDtfdIZNvz bYDPM+X6FH001fDnzCK/of728PY/tVM= 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-351-lS_LYUlEMH-KRpaPAKRgoQ-1; Thu, 21 Dec 2023 14:10:48 -0500 X-MC-Unique: lS_LYUlEMH-KRpaPAKRgoQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-67f6f0992fcso14607296d6.2 for ; Thu, 21 Dec 2023 11:10:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185845; x=1703790645; 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=4219KYM+Lx5MIoMXHlnouIE3ETSXouTN4mLohiWEzAY=; b=XPEiAzqR6dGgKBijnV6Mop2t14MSHQiQ/OeXFPBSP+/lXG6t0eLtmZRWsQUUOf2nh5 ayTgtFDWRzmBC02mvayYVI1Z5C6H/kf//wxr72Cq4tK49a9T2DIXxhv6bHvjElI2cdEM a7TBvbWvOxV+F8DSeuK85PPDg9iN8Hf0Bdp9EPnSIHL2rE+eC5e2bJqMovVAvdFbkFtW cO/uB74HA2sJQG252YoryuaHKKy+VBhqqZyUshQeMVov1YkWc8Z/dIzlmPVuhHt1Jo2n 765d5A0JPQaju20wArsu5rfFTLKQ9iWbkBptrge7Td2Ka9qn/et2L0VYJ+5q/BjmlnMe Opuw== X-Gm-Message-State: AOJu0YwK2MEsqaaKi/EqAG5ONmLrscdJCfyiFWaTooVWW5GENvtIGabq r6Qr9Igy80F9g3zO7aF9u15BbRznqnjZrGOPCWz3fGeWyNLa24ixcaDS5ofEgOfZn8qzegQnfJu UTjFSKWh6F9PMxCGr+XVaDfhCeqa7qn2Y X-Received: by 2002:a37:c209:0:b0:77f:11d4:f58e with SMTP id i9-20020a37c209000000b0077f11d4f58emr286554qkm.148.1703185845042; Thu, 21 Dec 2023 11:10:45 -0800 (PST) X-Received: by 2002:a37:c209:0:b0:77f:11d4:f58e with SMTP id i9-20020a37c209000000b0077f11d4f58emr286537qkm.148.1703185844782; Thu, 21 Dec 2023 11:10:44 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:42 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 04/11] scsi: ufs: qcom: Perform read back after writing unipro mode Date: Thu, 21 Dec 2023 13:09:50 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-4-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919877239660461 X-GMAIL-MSGID: 1785919877239660461 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 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") Signed-off-by: Andrew Halaney Reviewed-by: Can Guo --- 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 6df2ab3b6f23..ab1ff7432d11 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -280,7 +280,7 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); /* make sure above configuration is applied before we return */ - mb(); + ufshcd_readl(host->hba, REG_UFS_CFG1); } /* From patchwork Thu Dec 21 19:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632121dyi; Thu, 21 Dec 2023 11:12:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IG868iJPfcMluQYzMkVJVmfmzKbTUIo4j0AqGXcqhcVpuCikySqa4QDDu6ad9jh1UYQ+u6/ X-Received: by 2002:ad4:5747:0:b0:67f:4653:1b5c with SMTP id q7-20020ad45747000000b0067f46531b5cmr199881qvx.19.1703185936095; Thu, 21 Dec 2023 11:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185936; cv=none; d=google.com; s=arc-20160816; b=laLYhO5uOUojhO80tTAQdlNxia7lgzgnQBdKxpVCrwkiochSlNaTnwh/VE4ogTpl+F AS3+KlijMUyeS3twh0wmAuzv7tFZCN3wI5rh8eA1RTQvCvDmBlWWt1Kcq3TJYA1z7j2R usOWkW5jznEh+UPjmvIyEu7D+Zl7/IAHhHxa7W+VECRqg6LgOKv37AgX6NF4WcfQGtpt kAdXmM6sFMA/qN8rCJbpVTFqWOtQqhnsjFacYTmb/4xKkX0NFqnJKSrTOCnqSE0sMFcG UKnVHEil3QQhPTQafV4PrzQJ4cCEVJNaDzASu4Uz04XGYDS0topsFnn58wRq+s5iJMeb ENVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oX0CWwSSb/xcfXKSUEFguRgCx8LqXafuU1W5XbBtf6I=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=fKF448h0k2h1EMIdvrbyZi+6oE5bQfBe+JxpnrSF1zBq8NKogDsquDZaFCLyG+wU42 V/9V6YcIZAyWTPzzktMhQR2b6LpfnRoFHMX9UbNxPVoAiZXajfath4w4+wYF8MIF/XG+ 7eV0WaAy1pzp6Rcqv40VugOnC2JtVdFdkbbXRqnkBUpbjgf8Rc51wWaxAl3ZWd5ke6XD 1IQvilPQKNU8t+D+JETzOMRl4lsZ5amVnjXePtBpXetlA4sUUU0xdx4noGi6p1fZxQQo BCQRKZPH9STHUkS51S5cFz2YLB3M0GD39qg99AckwrgL8/EHzc/wRMMEoxga8dwQ5bni mE0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UN4fTdHd; spf=pass (google.com: domain of linux-kernel+bounces-8982-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8982-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g13-20020a0ce4cd000000b0067f9111b539si447107qvm.506.2023.12.21.11.12.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:12:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8982-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UN4fTdHd; spf=pass (google.com: domain of linux-kernel+bounces-8982-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8982-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DC0861C23D5D for ; Thu, 21 Dec 2023 19:12:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29CCC76DC0; Thu, 21 Dec 2023 19:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UN4fTdHd" X-Original-To: linux-kernel@vger.kernel.org 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 4D9EF76DA6 for ; Thu, 21 Dec 2023 19:10:57 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185856; 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=oX0CWwSSb/xcfXKSUEFguRgCx8LqXafuU1W5XbBtf6I=; b=UN4fTdHdMSca8LN5B1rtxO8eUr5Sx+EdFWIIT8owFUpMRE5F4IDH3sWshnYqfZoVfXsHqt iSNR8dlQwcRT9jv0QHNCt6+EZrRzU/8nMKck0dhsYdSwkxWKau5omYhmArca1egpF7rrI4 +vwhBNro8jc0Qm/aocHR0VLufPEVSDw= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-uysadmXcNMO9HK9bqpcOuw-1; Thu, 21 Dec 2023 14:10:54 -0500 X-MC-Unique: uysadmXcNMO9HK9bqpcOuw-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-781293a471fso24537885a.3 for ; Thu, 21 Dec 2023 11:10:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185850; x=1703790650; 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=oX0CWwSSb/xcfXKSUEFguRgCx8LqXafuU1W5XbBtf6I=; b=XcIBJIHLP0HtqM4e3dYTI1EQTGXP09aX69QuEPLnvg3FgIE5jQqnuSPUMuy8JbmQdn JlaFi6QduJQTUXPbTMoQXZBx/qirXneJIdUjZZC+7VcI2nXCZ0IHBhoN+zX8+0Cc/sDQ 5Hk5glulXZnTN05NW5QSn5lCwf7t1Ah7oSdkASCf3pqB+lJUxLcJXCGMyD4G+NkooOwY KnQlVGsBpQwcxxOt2TaPk+2qAlKnzpWRrSI06E5/YEsEnOpoHXEnOOV4hPyL9mM6rl3U W78NHjVWJy1/Urd+S0OJbrY3Lrq2rEesSlV6viG3iEUSlPTSDq5XNCGzES6FfMNTjW3h HF0g== X-Gm-Message-State: AOJu0Ywy5WMFK7raM69/8ERccOFccs0tTlg7p5inFOGqtFUF2tJ9dHVS yXDtm9r6lfy/qPLD0PbVgDyh7DRP5IEB1DqUJzAE4z0VYez2ipcXeyxgDPX7xxTtgqCRoqZ5IKq WtnjGnhkG/UP2e8zRj6xvCiRxNwRqQ+cg X-Received: by 2002:a05:620a:2914:b0:77f:92f:fcc0 with SMTP id m20-20020a05620a291400b0077f092ffcc0mr328946qkp.24.1703185850241; Thu, 21 Dec 2023 11:10:50 -0800 (PST) X-Received: by 2002:a05:620a:2914:b0:77f:92f:fcc0 with SMTP id m20-20020a05620a291400b0077f092ffcc0mr328927qkp.24.1703185849959; Thu, 21 Dec 2023 11:10:49 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:48 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 05/11] scsi: ufs: qcom: Perform read back after writing CGC enable Date: Thu, 21 Dec 2023 13:09:51 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-5-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919896262222889 X-GMAIL-MSGID: 1785919896262222889 Currently, the CGC enable bit is written 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 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: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms") Signed-off-by: Andrew Halaney Reviewed-by: Can Guo --- 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 ab1ff7432d11..3db19591d008 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -409,7 +409,7 @@ static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba *hba) REG_UFS_CFG2); /* Ensure that HW clock gating is enabled before next operations */ - mb(); + ufshcd_readl(hba, REG_UFS_CFG2); } static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, From patchwork Thu Dec 21 19:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632271dyi; Thu, 21 Dec 2023 11:12:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZdiT2klImvAprGMYvxzH335TJnspH8WisBkzelM9hutxOg4p4gA22b3n3QrXHSgu8mlF3 X-Received: by 2002:a05:6a20:9756:b0:18b:e692:8f01 with SMTP id hs22-20020a056a20975600b0018be6928f01mr156970pzc.5.1703185953274; Thu, 21 Dec 2023 11:12:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185953; cv=none; d=google.com; s=arc-20160816; b=Rt03Y7onC2AOPDUJr6cmMBHbaigaWzh3bfuDHFVpHPmSx4KqZ34l9QSgKl1nBEhmb3 IqgGt4wNUbrZHiZOYcv4xicYdL4VnxuQkL2uBeZXPa+um9uLATeHikdb08LwezvL0Tff 4geZ2FEzUoUNUcneNS6xO46zUoC0yEv3Qhotbr6eXzA4ysuz4BrtriselGdMniQJL4kK OUHn1LzxtwEgCANeIyjUTKdQDrivpNVH9vG82TKJjhmGxW6nrcYnBZY8Y2GoNO19aWXW 38x8oWJKlLHShifSwT5oPqNHN07zyMaP3TMT8uguueFjP8nei6n/tc1/kUseux3NjvsP +PvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hFXXGAQMvAtKWxVkRcpFMTchD2fzgAOU8dNzT5bz2Wo=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=K/yMWRJJuVTGKHa7mTBaOu4TXrUZr8qjQt1Mzms1uYwl2WUGGHP7Yg5jOUvO/S8V/p 3aixBr41vsZpp3ZePgUhTe5HAgHWlCEayia+IKZT3CSJ2M/MnNz2OT/NVjiT7Pfy0VX7 n+WrhxG2ibMsXA1bEpah0o3pg89t58IUmdf/04g9LvVdoKa02WoHMN4sPqM2+5pmdZlO 3pvJfhdSijgfin8o9gUYRP2TtyygafFvHE0f5RqnTDH2z13hAv8qbEgI3ZYV6BwdsybX 4nUjnehVv7FbE4UG8r7JtwCoQmN/g6XPQt7lbY+FGDA9KFj6D7hr6IXKSazNmo/ZXJT5 H9xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HJrMMIj8; spf=pass (google.com: domain of linux-kernel+bounces-8983-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8983-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h8-20020a17090acf0800b0028b77fe22eesi2104993pju.146.2023.12.21.11.12.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:12:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8983-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HJrMMIj8; spf=pass (google.com: domain of linux-kernel+bounces-8983-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8983-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 29868B231EC for ; Thu, 21 Dec 2023 19:12:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19B7E7762A; Thu, 21 Dec 2023 19:11:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HJrMMIj8" X-Original-To: linux-kernel@vger.kernel.org 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 222A276DB3 for ; Thu, 21 Dec 2023 19:10:59 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185859; 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=hFXXGAQMvAtKWxVkRcpFMTchD2fzgAOU8dNzT5bz2Wo=; b=HJrMMIj8ijjkAU0W3Fpl2KSU5GcoLJa5PBnosWzeqVj3hbiqWZKa+o6I7r0tR2xE8j77mB uRZvGfRcgA6OtIh+yRUX/ezKFYb5bLio+5XoXviA0hIf/k3OdMILPaNJ5pJE3jRKgF3gCO AsuNiIth/ku3sM4BFDz8Jd4mKGKayi0= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-249-kxH2cFqRNRe48UumBXxBPQ-1; Thu, 21 Dec 2023 14:10:57 -0500 X-MC-Unique: kxH2cFqRNRe48UumBXxBPQ-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7812afaaed7so1079085a.3 for ; Thu, 21 Dec 2023 11:10:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185855; x=1703790655; 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=hFXXGAQMvAtKWxVkRcpFMTchD2fzgAOU8dNzT5bz2Wo=; b=O6nuRadg+nGKnnSPvfRw9ZQ9aZHeNH+dbU5g/vz2LSngnwYnTpV+Z2ZCqrmvC6diCN RhMKEqzfTJBCoOkYh75iKkzQSrzHukdUM1a5PZ6YH3dtWaM0CPQB90/S/zYaGZMAAsTq nVX+RlVKhXx87Ivv2nqBEksP9mhmxqtk89Cy3kwB08HPgwyK8msa81+e64Q6Q3ZoeSsQ IHQJGGKI3XBZ3lzzr/uj/8mu1IGU73NpexKRmWKFi9nG0d4yl/Xz0VE3xkKRORrAazFN 5ba4nphpaXjUA1O2VxGh33PW+os5364W51dS4QsZQpn+BMezh6byLeHwUkK9LjnySMbz CLJg== X-Gm-Message-State: AOJu0Yw2ZeqvD3ZHsZXYc4IxWIG0Lkxq9eT8R0QV4BDoV5ZGyOjUMMd9 thJ99gYgdL0ifD+u1B7a9SNYwkUMTffAB6bgoU0vr5kRih0Iw9vNPad6ezKQeKZbU0GvBzwsp0V Eb8m1hewfbFs6W6WUnGLncHyCCtyjDQSYbvT5cUKM X-Received: by 2002:a37:c40c:0:b0:781:1c42:5d90 with SMTP id d12-20020a37c40c000000b007811c425d90mr241286qki.132.1703185854952; Thu, 21 Dec 2023 11:10:54 -0800 (PST) X-Received: by 2002:a37:c40c:0:b0:781:1c42:5d90 with SMTP id d12-20020a37c40c000000b007811c425d90mr241267qki.132.1703185854718; Thu, 21 Dec 2023 11:10:54 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:52 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 06/11] scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV Date: Thu, 21 Dec 2023 13:09:52 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-6-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919913932026496 X-GMAIL-MSGID: 1785919913932026496 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") Signed-off-by: Andrew Halaney --- 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 Thu Dec 21 19:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632543dyi; Thu, 21 Dec 2023 11:13:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjVG1RFrbQJga9e/FBkTKEXiFmTW22AHm6sU7PDC2DAp9YeCy+fMx5WMwr4wD6lugR8wTJ X-Received: by 2002:a05:6a00:4b51:b0:6d9:35c3:e7b2 with SMTP id kr17-20020a056a004b5100b006d935c3e7b2mr178915pfb.11.1703185982620; Thu, 21 Dec 2023 11:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703185982; cv=none; d=google.com; s=arc-20160816; b=RiT7Qx3MFe9EgCuVcbQmIuRZM7LjySzKFOpnnX+EJL3o9R5XsrgN7vl1AoDGU07Ewe uoYAjZZPO5thUt1eclQkmdKM0ZtK77feifr7EYmdZ30ClT38IxDokvQLI8gM9Dq28Ms8 EI1jnDsu3WnyzGNHBD4Tx+ISyIO4HSCwgKMsVRlnV4YKGkfDRiBLMx4dUpSH8z/WUCep 3riIX2alVDeZ10gzK7RoWRtrK3lhTjO5p1i7Nftz6TQQXwbvwnTn4iNyuUHU8syzS8uv J4gEf9PQPo0zS1JNwZnaUOgYhQqdjgFKjMK7nwjKOv17rNljXw1mE4Zm4cnjxr5hoMJ/ OSig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xUUJuT608SRhCl6+0/SpXWAx7Kuk//nvBAACeA7YhJo=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=O3qjtvm3S9ihwOp7rgmePRopAJBBqq8V8IpuDCxJiA/c0fACIXPjRQsyStxLH7W3XT AUqiiQy2UvhPyKvgz8otOkjum8GcOrepFOJltB2RRhzcCvC6S2yEl+XOVTP+cffedUEr R8y5iO4/pJayu75qOWilAFE69C0Y3fHJMQYNA57EQVXsgCyR9rqrCif7DtC0rwPlHxJF bCyc6oiTKWPM1y9rgLLQIjLEz/cgl0hcgOcb4qN4QlYnVafgagIDOxynEfBlD6hWks3u R9M5jTHLvmYkOWM1wedRy/j6dEU80/HjtmMy9vm8MB9LzdFRXBasrdzNTxqsiShDO8Z7 wn8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YhwbzY80; spf=pass (google.com: domain of linux-kernel+bounces-8984-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8984-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 11-20020a63104b000000b005c662419214si2037350pgq.229.2023.12.21.11.13.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:13:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8984-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YhwbzY80; spf=pass (google.com: domain of linux-kernel+bounces-8984-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8984-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3FD3B286843 for ; Thu, 21 Dec 2023 19:13:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A00E77F03; Thu, 21 Dec 2023 19:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YhwbzY80" X-Original-To: linux-kernel@vger.kernel.org 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 90E71697A6 for ; Thu, 21 Dec 2023 19:11:06 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185865; 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=xUUJuT608SRhCl6+0/SpXWAx7Kuk//nvBAACeA7YhJo=; b=YhwbzY80QbppRP6SpROhl81wCQTtvg8UhuB0sbOJC3nlUa6KwfW+XPYsP6jQDeLHr8Rgsa u9KWjf2xTmRF7ol3kazrGgkuvveQYuuiz9OQy9i5UbMc+ATYLWpgVFYm9sltyt9WnTtsfs 17Qe9pI+Gy0/sYnRwDSeoeFYg718mDg= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-t7WcWc0bPM2BErT_4bApMw-1; Thu, 21 Dec 2023 14:11:03 -0500 X-MC-Unique: t7WcWc0bPM2BErT_4bApMw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78118a0bf69so137140585a.0 for ; Thu, 21 Dec 2023 11:11:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185859; x=1703790659; 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=xUUJuT608SRhCl6+0/SpXWAx7Kuk//nvBAACeA7YhJo=; b=PN8HQOvY5sPlqkdzYicq9Cl8tZuyXqE64Gq2ctLyoANvzDGfv5/tTX8BowrwaG9RPS T3nHMRYbyZ+yReq0+BJwcQ4L6PADZ34vszL7sEfNFMx3M5JTndZhdgTCO1UouAJSPKzs +WckXC14zZQ4zCaShTA8oXyqaJZyT0TfzzaGaXcCtZOQrfzi2T7lmaG3MQwWxKDGNUdk 0tz2QsByTZZTJxZeVol/0n76kyd9QW4TOk0yhXeh+GGc4yeCFyqTiNYJvUqC0EV7Ogn+ xo+PtSv6BlFL7sn+S65V3eyGT4vxQagDXob/54JAIAc3L0vYdcgsWl+6NVnlcGQwXH7A xL0Q== X-Gm-Message-State: AOJu0YyudVQB3m93Xt2eSPHmOC7QiRMux7d9anNz6ORATJ2CCL7hNYrL gHyEmtLSzpGvUXGg07xIOr9XJE9z17B3jefNgrWsfJvr8ud/vwFGyr7FgqKprBm9rdFWahS2mkH xD8zau+CdlsbULwJSy6sDEPWMrgaFDHvQ X-Received: by 2002:ae9:e00e:0:b0:781:1a4a:584f with SMTP id m14-20020ae9e00e000000b007811a4a584fmr318117qkk.120.1703185859664; Thu, 21 Dec 2023 11:10:59 -0800 (PST) X-Received: by 2002:ae9:e00e:0:b0:781:1a4a:584f with SMTP id m14-20020ae9e00e000000b007811a4a584fmr318097qkk.120.1703185859419; Thu, 21 Dec 2023 11:10:59 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:10:56 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 07/11] scsi: ufs: core: Perform read back after writing UTP_TASK_REQ_LIST_BASE_H Date: Thu, 21 Dec 2023 13:09:53 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-7-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919945114952777 X-GMAIL-MSGID: 1785919945114952777 Currently, the UTP_TASK_REQ_LIST_BASE_L/UTP_TASK_REQ_LIST_BASE_H regs are 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 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 the 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: 88441a8d355d ("scsi: ufs: core: Add hibernation callbacks") Signed-off-by: Andrew Halaney Reviewed-by: Bart Van Assche Reviewed-by: Can Guo --- 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 d1e33328ff3f..7bfb556e5b8e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10351,7 +10351,7 @@ int ufshcd_system_restore(struct device *dev) * are updated with the latest queue addresses. Only after * updating these addresses, we can queue the new commands. */ - mb(); + ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H); /* Resuming from hibernate, assume that link was OFF */ ufshcd_set_link_off(hba); From patchwork Thu Dec 21 19:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632785dyi; Thu, 21 Dec 2023 11:13:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWvK7M6sIlzmwsDW4fllWxgq64qO79sVGtv4gacBT1x3X/sETqLDYuiItiG0zZjm/jAPWO X-Received: by 2002:a05:6a20:9144:b0:194:df37:47f4 with SMTP id x4-20020a056a20914400b00194df3747f4mr140549pzc.73.1703186007770; Thu, 21 Dec 2023 11:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703186007; cv=none; d=google.com; s=arc-20160816; b=GUazeDkXl+oDulq7cX7fBMrM77bHglTXFiQFMDDFRNeIT0zcGcLUDKtgOxlGFXRvxV 5WyuKfdTtbnRoNqMqD65zGPE6yaQUwNGFf0PXI5fkOidCxAi7EkG/5tzZYQt9vDFGJr2 W+HAKCABv45rKWyJ79+jO//U9lOSSRxcbLVrC+FXTC183eaZYaadGhgq/Mqr3hb4gqeY 0p7MhEwWqyxR8SDR/5QUI8bKr7wEc7XPXOlEu/fx3tzMI4ecNGy9wjQcbTwtv3YTj9+Z ULOZMJJzdSJIzcwjkyV58nSbhg7ba3eDEcjPotRBx0gDqTz6Z4/9oW44/gcOYzRKaxvb aG+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4md7/lhuz61o/OLaxynlTwcjr95vaOPE75vAR/46vcY=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=r2EBllgWa29CiO2Evr9p57C6lJA2wwQ11w56ta/DpR5jn6wHuEehAKPtx0DTe5sGQu 5OECl9z7+yNV2hIwTBOCzbe7EWrvornSvA2ZBkgz+MLacZIyhb0g4daFix7Uc//ANdSZ 8TN871C1TbgeFnqw8Z8DuJ2cjFqexFNpqHCxvKiU2BDJqk4epnu8tZ75D5PX7krQTy5s 5sGrTUbLgmkjrz3TkmG7X3ZYGWSzaz0MP9OBTBWyexwncGn5Yt6OM5D7lITt8cDoRGux P3tiPwum/digvtw6CPMnaJays7Fuj6jfhoT09jSIFg64KLbTTZoCddPGbJylYNi6sT+4 clbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cLplHAme; spf=pass (google.com: domain of linux-kernel+bounces-8986-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8986-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i26-20020aa78b5a000000b00690dbd360basi1924703pfd.152.2023.12.21.11.13.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:13:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8986-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cLplHAme; spf=pass (google.com: domain of linux-kernel+bounces-8986-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8986-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 977A9B2367C for ; Thu, 21 Dec 2023 19:13:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D70CF77F31; Thu, 21 Dec 2023 19:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cLplHAme" X-Original-To: linux-kernel@vger.kernel.org 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 0A63577F11 for ; Thu, 21 Dec 2023 19:11:10 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185870; 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=4md7/lhuz61o/OLaxynlTwcjr95vaOPE75vAR/46vcY=; b=cLplHAme+7gr7Wx9qwJy48Btj1dy1ZFa+k4nAOllFqr8d5KUAkD4rryKL0hnWWuURNJEqC riB7TMqMMFXvm5PSc2xrwf1IJFNyEA5UumIqcQwjavfydtnFPo7yqsOog8r382oGRwo8WP bX+KWNaclt/ifKf90FlOKIK2Xn/3IUU= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-c58E-_A4Mge6UtiJVW9rGA-1; Thu, 21 Dec 2023 14:11:08 -0500 X-MC-Unique: c58E-_A4Mge6UtiJVW9rGA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-781168a5772so101018985a.0 for ; Thu, 21 Dec 2023 11:11:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185865; x=1703790665; 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=4md7/lhuz61o/OLaxynlTwcjr95vaOPE75vAR/46vcY=; b=F7+/7KkXVZiYA5YExaIe2tq1Ta7MFftF4XIE4SqpNLM+kdf47UKja4XYd9TFcdYVSq ExgU0uCM6LOnOTUBBipDfS8FFCXby+pezgbmCFi0EnyM1fTth3Ca9RrbonBzbdeP5CNz BS6njLPNCvlG2AcQHo13RG9h++6M9d5fxjOjMEQLirKi6GiINIMtfRKun7n/+f/l8yL6 9ZgkUwZnCe72cG7/y75LPlI0vwLm0SnQBa6TLdCHp336YGbpJkZxzGESA1DifBl8P32u /9Dulq007Fmy3REScnqbj4EVblfL1ZW4WLvntBY34YyHRY5KGsn9gRb34NmM4pJMaCPC OPSw== X-Gm-Message-State: AOJu0YwHiXdp+XHiejDsrUsKKXH/HeKbGapZTsnGXBTrfnwg+7QBG3AD +dtDll26tWfp0XOnURvoPGWNyiK//iZufb+YS9+/0lQ8+yPHJv0rvY4fauqC2LsqGMQrC7uGRdi 6enSK7DrLIQ1gU1EmqKVUPh7oRuS2RFCZ X-Received: by 2002:a05:620a:5632:b0:77f:983d:9627 with SMTP id vv18-20020a05620a563200b0077f983d9627mr329705qkn.23.1703185864732; Thu, 21 Dec 2023 11:11:04 -0800 (PST) X-Received: by 2002:a05:620a:5632:b0:77f:983d:9627 with SMTP id vv18-20020a05620a563200b0077f983d9627mr329687qkn.23.1703185864363; Thu, 21 Dec 2023 11:11:04 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:01 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 08/11] scsi: ufs: core: Perform read back after disabling interrupts Date: Thu, 21 Dec 2023 13:09:54 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-8-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919971330641883 X-GMAIL-MSGID: 1785919971330641883 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") Signed-off-by: Andrew Halaney Reviewed-by: Bart Van Assche Reviewed-by: Can Guo --- 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 7bfb556e5b8e..bb603769b029 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10568,7 +10568,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 Thu Dec 21 19:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp632966dyi; Thu, 21 Dec 2023 11:13:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyr49ebwhaqIG8466CBW8l0pfQWXCcBfK9egX5MVENkYINVkY4mla/ZypW44SVcBlDY4D3 X-Received: by 2002:a50:8e17:0:b0:553:45c8:b1dd with SMTP id 23-20020a508e17000000b0055345c8b1ddmr29327edw.43.1703186027193; Thu, 21 Dec 2023 11:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703186027; cv=none; d=google.com; s=arc-20160816; b=d6/hKLCs+p6rps8/0QJ6HCe2rUc3017HrFQ5h8rX/ZR9FcM3th6nznUsw39SvRev1Y /rAgkU6amuNwLkSh8xq5nKn7JTVOzRPVFCZ1f2HFcKlMfaQNBHBlwQZiBQhoPDvzoRLj l90HqwSTj8FDWIzi/lT4NGqImRdU+o2F/ctUEamkTmwbkBuNGBJGsAr3UE3kEdXO39kc 4/vk33E3+lAWnE+15Naty9nVDsYdzxpLhVgWdqDuoDR/I/r8a3H+3Or7qyiUrvGBEC01 +gRjeATx2fAb7ZtED2TC3q5TOHnJJzM6yTTmCJloHIfrIBuHgEB9vJb7b0iwYhR41L7N uVKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AWn/QHp2YPYufEDNjOJpKb2JC/5WKNiZSL7HfeI2UL8=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=SFcD8D//TqKyAJxmkxphX04Q0h88JwPP4tZvxp9rLqFhyO0US7OFJuPaO4rJCY23FH NiERUIGvVU1P1ki1REwA68ClhK4Emq2RFkG+r04c662vWhcBDpItMc/R49mqfVSaGjDH f1ggvmeSlELjMF2Qrl8OEhtpezRSVEmElB1fHeQdhVZdD+wnIWftfFPzCj/CPQS6UOxJ Q5eKz8t4NL4T3XJ7+U9IPnEB+6lRMn0Pai5qbk5YtnYhy6o+r7XJ7WQ6In/ecyFFfv87 Nt1OTF3uhhg6PzgL3N/8Ku49imaGAi+3cYGE8f+BZL8SumpagLBgEpiL0ezwOszwhuT1 JwBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyPu1vkA; spf=pass (google.com: domain of linux-kernel+bounces-8987-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8987-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w5-20020a056402268500b00553716651ffsi1092952edd.229.2023.12.21.11.13.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8987-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyPu1vkA; spf=pass (google.com: domain of linux-kernel+bounces-8987-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8987-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A08831F2643A for ; Thu, 21 Dec 2023 19:13:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0D8A73192; Thu, 21 Dec 2023 19:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fyPu1vkA" X-Original-To: linux-kernel@vger.kernel.org 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 1534873185 for ; Thu, 21 Dec 2023 19:11:18 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185877; 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=AWn/QHp2YPYufEDNjOJpKb2JC/5WKNiZSL7HfeI2UL8=; b=fyPu1vkATZbKSwLgWdPD5Wa8J3Tzm3g90HYKUcqBvO2olIIkzPPTf0e/Hj9/3xkhikG1aS 3h6naUSjvJTMjmUrECCzJSlBV3axFCnxBxPfifSn5auQYBmW6BVmhVzd6vp2VbPah/6ZoO ebMVPjtdECfFP0eKK2rsDax9C8rA960= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-Bbj7kBnRNNW0OK4lpAjA6Q-1; Thu, 21 Dec 2023 14:11:15 -0500 X-MC-Unique: Bbj7kBnRNNW0OK4lpAjA6Q-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-781029b59d7so107808885a.3 for ; Thu, 21 Dec 2023 11:11:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185872; x=1703790672; 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=AWn/QHp2YPYufEDNjOJpKb2JC/5WKNiZSL7HfeI2UL8=; b=upzDgSWOMPhgHYKFuDL6y6QCBhkqlN7lSLqVkQEKBym3h6jJvySmKdidVWpJBlPFwF DfsMk6pUETSSwC2tREqAFeaSkgPvKH1akcBacqetAS4VjSVlz7V0MmfXN3JLj+skIHIK MeIlWsH5PGdxBzQ5g4pQyKLuZ6PmjdlYPaQQsdQFNJzOdUitNUuwHAy1kd1HbnmdqZih RojWLUROEnDw0y/+fFaCjWCIKXRMPQ9rIO22+Ve9lsT5W+zVwr/+ZyCc9dO/pN6oKjik MCjmjJwwLHI6I+o4gVxvDyGDOKMX0MxK4Te8GWRPHJ6M+EqvOhW9Rxc+2iieTkvb9OGp T19Q== X-Gm-Message-State: AOJu0YxHQ7lYEQcY8TIEd7B4UjA1H8RleWokAj0pj2s55yXt3EiSBENg 5osfiQWA7vbzsiQJCT4W9jkCl8MLb0009bp7dQJIKJCK5m2Nv5cmzJB5BDhU2SMDKKD2dqR7vD8 S/5VhC2v76KT0R7kt7D6L5j9+fGKvx3QW X-Received: by 2002:a05:620a:22d2:b0:781:153b:ae6 with SMTP id o18-20020a05620a22d200b00781153b0ae6mr229449qki.107.1703185871911; Thu, 21 Dec 2023 11:11:11 -0800 (PST) X-Received: by 2002:a05:620a:22d2:b0:781:153b:ae6 with SMTP id o18-20020a05620a22d200b00781153b0ae6mr229432qki.107.1703185871667; Thu, 21 Dec 2023 11:11:11 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:11 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 09/11] scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL Date: Thu, 21 Dec 2023 13:09:55 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-9-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785919991909142464 X-GMAIL-MSGID: 1785919991909142464 Currently, the UIC_COMMAND_COMPL interrupt is disabled and a wmb() is used to complete the register write before any following writes. wmb() ensures the writes complete in that order, 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 wmb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: d75f7fe495cf ("scsi: ufs: reduce the interrupts for power mode change requests") Signed-off-by: Andrew Halaney Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Reviewed-by: Manivannan Sadhasivam --- 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 bb603769b029..75a03ee9a1ba 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4240,7 +4240,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) * Make sure UIC command completion interrupt is disabled before * issuing UIC command. */ - wmb(); + ufshcd_readl(hba, REG_INTERRUPT_ENABLE); reenable_intr = true; } spin_unlock_irqrestore(hba->host->host_lock, flags); From patchwork Thu Dec 21 19:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp633215dyi; Thu, 21 Dec 2023 11:14:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiITa1yLMoHRdmu7lW/mA61dkuaWjcGLmlQl6/Pvlh+MrqcrnBlF0XGl0SXKhfKI/RTN8Q X-Received: by 2002:a05:6808:2e86:b0:3b9:e4d1:964f with SMTP id gt6-20020a0568082e8600b003b9e4d1964fmr269857oib.8.1703186051612; Thu, 21 Dec 2023 11:14:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703186051; cv=none; d=google.com; s=arc-20160816; b=BMY87sdlLMkYf27vYyTNMT3WJcg2Gc3j6mUPQ/bPIfedLxE9GBIKxNDNvpjtwjWFfr R1gHC1vlGLQkfJrZ2phQZXrTqn47yhLHPOG4yjdfhwDXtYB/UeGlj+MrR23odDUnhhZG PqrSLRqGhlTHjJ3skrUkaI5aRM77BXFuMbxa3wO9ATpLBoKVxf2JOb3fo21gi+X59ev9 XRFFeZaImxx40Os410wqPUJ9a2GtW+m2kQjo70tGsEA5CpPFSJoYlvEl6mMkO3ew1pmZ 6611myh+S/pE+HNgn0vuheUcDO/fQu7roxKJZ+h9SWhN89B0qnTo19Ixnk80+xbIrHn8 VKBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=myeBTw3HbDC/jUy61nVcNVpXoHTTT3lUStj2mtls9rs=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=LCi5GoYJQ7jogGHM0HSM8Z/J9CjJ4Zoc+9CpeL5IF3bvfJfJJhle61gQa5W+/oQ4ER szU+NzXkAisicPPTPMhSB8MzyDCkYAw6jIO5YdUx/LT7M45ZYAUQLbEx9NFR9mi418My jW2xTzxhuKoaPDpxqujQmYSv0hWvdJwp2JjBd13hnS0BrEffGfwgS8wZACvHkv5lY9X1 GDf5GdbRtTHXTqCdtqzQfsc5ea/S2l6MkcCDYuRM7dRH4RbfY8Xs9A1xA0rXjUDsXw7Z F5azYo9a6lr6kuxuPrYWaMBnr4JJWmwxUChKIPAheDWqonkt/tSASa1Fl4bTHmIf8NYZ W4AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S02uqQID; spf=pass (google.com: domain of linux-kernel+bounces-8988-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8988-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e4-20020a0ce3c4000000b0067f2e6f65e3si2782562qvl.204.2023.12.21.11.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:14:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8988-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S02uqQID; spf=pass (google.com: domain of linux-kernel+bounces-8988-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8988-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 65ECB1C22DA6 for ; Thu, 21 Dec 2023 19:14:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0157E79468; Thu, 21 Dec 2023 19:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="S02uqQID" X-Original-To: linux-kernel@vger.kernel.org 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 2D9E3760B6 for ; Thu, 21 Dec 2023 19:11:23 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185883; 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=myeBTw3HbDC/jUy61nVcNVpXoHTTT3lUStj2mtls9rs=; b=S02uqQIDrt/dddxLyN9GyNpSXDCuGK0NOLVCiKrrVVD+ulJ1mQaBS7N8OJsjJUklLiF0QN OIiQDsA6C9yGMPNPTUOUv7Y0vGjuSFtfHR+6Nl4iz0EfGwzSCgcUhapH1vWhhGh6amyjM1 Dyjd3mPNNSOSAfiKSnFLLUM1YVVJlpc= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-hpzSQWo-N2WLoyoMvtmc6A-1; Thu, 21 Dec 2023 14:11:20 -0500 X-MC-Unique: hpzSQWo-N2WLoyoMvtmc6A-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-781293a471fso24577285a.3 for ; Thu, 21 Dec 2023 11:11:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185877; x=1703790677; 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=myeBTw3HbDC/jUy61nVcNVpXoHTTT3lUStj2mtls9rs=; b=HEEcBtRCg/TzQxXMJE+c47AnLqkof1HDGP65F81IWbb40y8JpLU6RlIzPELgTKjsf1 /hAkBYUXk+sZyDieIpYQ8O9Pe91/kt97tvO1Qs6dLrnMjfupfecON9IFGrYyXVx31TuZ pXJ9jJPNktPmqB4aF3yr6cyjpzisFQd5KE0lFl2J+kwezguDjS9TgbNtjoT65u6ure8m 9BBhsSjkUupgWOVLYr+JlIYEGJIMCMPBQe+4P0A21MrbkXiZ9nPMcawWEnRKFTvmcS8j 76hDJ1PR4iIo6sWMB7K2rdiMuqAB1Kid6DBu0sTw+bd6vsCfgX8tMGQcE8+5rSfEuJN+ joIw== X-Gm-Message-State: AOJu0YwNX7rZOExeXOpA3FJI6T/QHljvkpvX2p/a6YJgPopOfZys95oG KAGkUpsa/mMbXYN1YXzsjs2DTF9p6o2Q55pmzFkw3XDFvq1nliA67Awq99E/b1k9Vki4h50Q20Q p3c+mokgr5o62KoI8odoU1YaDQw/AFbW6 X-Received: by 2002:a05:620a:2101:b0:771:31c:adcb with SMTP id l1-20020a05620a210100b00771031cadcbmr301247qkl.7.1703185876789; Thu, 21 Dec 2023 11:11:16 -0800 (PST) X-Received: by 2002:a05:620a:2101:b0:771:31c:adcb with SMTP id l1-20020a05620a210100b00771031cadcbmr301230qkl.7.1703185876561; Thu, 21 Dec 2023 11:11:16 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:15 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 10/11] scsi: ufs: core: Perform read back to commit doorbell Date: Thu, 21 Dec 2023 13:09:56 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-10-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785920017275541827 X-GMAIL-MSGID: 1785920017275541827 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 Let's do that to ensure the bit hits the device. Because the wmb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: ad1a1b9cd67a ("scsi: ufs: commit descriptors before setting the doorbell") Signed-off-by: Andrew Halaney Reviewed-by: Can Guo Reviewed-by: Manivannan Sadhasivam --- 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 75a03ee9a1ba..caebd589e08c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -7050,7 +7050,7 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); /* Make sure that doorbell is committed immediately */ - wmb(); + ufshcd_readl(hba, REG_UTP_TASK_REQ_DOOR_BELL); spin_unlock_irqrestore(host->host_lock, flags); From patchwork Thu Dec 21 19:09:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 182431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp637156dyi; Thu, 21 Dec 2023 11:21:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1YA316NdSM44ph9q3ELukgAOYjScJxaAHiU5mAof1msWfgpBbxV+g4yBoWtrudac/Q71m X-Received: by 2002:a19:8c41:0:b0:50e:2d00:9841 with SMTP id i1-20020a198c41000000b0050e2d009841mr56513lfj.101.1703186480046; Thu, 21 Dec 2023 11:21:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703186480; cv=none; d=google.com; s=arc-20160816; b=FJKZew6c1tLqMlgI0OPLhQmAGlMSYzIJzeWRpcNQpB9hds5lFh1EkuDEePBKDZnm2x fWNwEzOo4r1W9mKz6mIXmzP0UKC6YcGxGi19fFtSXgtSsF5DGMu+kpOu89fL3tmvYpyZ HzuR70DtbF5kGcOl7bx80bF85yGHOI5hhUG3+FfHS8e73076rMNYpbw+zAddEjP6QDvJ hkoAADy0kNjRdKKulVR7HT1UWEvUVwIRJd+ZckYUh8WjHBhVGSJk+TU1sAMt5QE21Eof 0LuJ2QrlcYD8N4kc/qwR3HYfQJlrqZHn2j5wHvGEEPpO52R2LRLM+yI11eWL4Ap2d2k0 dL7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4cSBdvbxI8LSVPr25rTyKCoUJu91IkN+EuBnNL3WBh0=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=XbQq1dxPIXYmxEB8agbkf/O/+isMtrTy3wwI3YkOMKoaqduGdKedb7MSOcTjpWz3gJ L9JvFQF57k2UOdNr0FXQWCJQPpgNh3C12bw5Zv0kADz/e5eepqGqvW3Iu5Rd7ZMHdTeX 3MlSHwP9o8fkT5IvZ0i5/vaChyCBQM5Iuu38T/2sL88OAWdt0qgLVCRF2/8HEgQbKHLy JlofUa6qqJ+e2g062nIx8TkEAhsxn9m1RkrMzLWB9G+yXc8v6yUzmdbAJmmqfs/8FEI+ KqyAKSWoWR4igEQwrn+HOnFaAnUPr1MXASOMy2OrgTiwdY0ZeOpnt0biBqL47/XrI0s0 HrkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wp6mmAo4; spf=pass (google.com: domain of linux-kernel+bounces-8989-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8989-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w2-20020a056402268200b0054c4523f740si1123281edd.491.2023.12.21.11.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:21:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8989-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wp6mmAo4; spf=pass (google.com: domain of linux-kernel+bounces-8989-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8989-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2870B1F26EFF for ; Thu, 21 Dec 2023 19:14:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C67E79479; Thu, 21 Dec 2023 19:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wp6mmAo4" X-Original-To: linux-kernel@vger.kernel.org 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 932876A029 for ; Thu, 21 Dec 2023 19:11:24 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703185883; 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=4cSBdvbxI8LSVPr25rTyKCoUJu91IkN+EuBnNL3WBh0=; b=Wp6mmAo4C8iKE11bowaB1/bgdB4aTLZjL8k4UmvIV1tVcnItijdfKujdMuu1OglrJhEk0C 2rClTBVB8wDgPWiuuwt8gclzhgZ9kOfIU9RhmNKo+ZtC8uWM/q4yJP9etNk/jV9hvtTigS pRBU0wu7OmdyT+K8FAmbMw0OI8p9m5s= 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-556-5nmJXuNxOCS2dRuRt0Lh5g-1; Thu, 21 Dec 2023 14:11:22 -0500 X-MC-Unique: 5nmJXuNxOCS2dRuRt0Lh5g-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-67a696be34cso15223386d6.2 for ; Thu, 21 Dec 2023 11:11:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703185881; x=1703790681; 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=4cSBdvbxI8LSVPr25rTyKCoUJu91IkN+EuBnNL3WBh0=; b=fHIE1sKzWenjit8b7Waf2mOXconM6unKlrXb+xt9qfmVAqsgIOqcL+01LjmWl2FEPN azE2i+IWFR9gh4F4ogz4dxKIRFRyCQm6DNjh5VzZ6Ra5BUFO8uBZLhPfG7Joj3+194xt +X2WbRk+gYnNScIGxrF/lKIdIXk9B3/x2j7SsOHceBEAjmdMMpTbnrA6I9drnfMDZqWn KKw3Qw0HUnZuZKVRIeQLE2f0fqHC67bFuIcnk9x/bnl0GdwaOBUvGhiYbdoFsyUIqdOi ktLe37CvLOy9AopXoN3uAqEW4igSPpqO6LzvFFUEtbbLZTkas+PZb2OvIIgN703M6fGA qERw== X-Gm-Message-State: AOJu0YzXbjvGw2StT0O5pEVrLrdbagorVc3JH5vwi2MizaEJ31bkswVI dAqVdSHfFvZrBBsdH2Fvq3NcI1vqfHRBHMyaFjqVyRvXsBBdf4g4Mk8E87s31qmef1vQRP9Ceif zcg1bGN4cLsyeR+0afc6kVRU54d7HOk3i X-Received: by 2002:ad4:5e8c:0:b0:67f:2201:81e1 with SMTP id jl12-20020ad45e8c000000b0067f220181e1mr222523qvb.13.1703185881310; Thu, 21 Dec 2023 11:11:21 -0800 (PST) X-Received: by 2002:ad4:5e8c:0:b0:67f:2201:81e1 with SMTP id jl12-20020ad45e8c000000b0067f220181e1mr222500qvb.13.1703185881066; Thu, 21 Dec 2023 11:11:21 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id 25-20020a05620a04d900b0077f0a4bd3c6sm846370qks.77.2023.12.21.11.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 11:11:19 -0800 (PST) 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 Cc: Andrew Halaney , Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC v3 11/11] scsi: ufs: core: Perform read back before writing run/stop regs Date: Thu, 21 Dec 2023 13:09:57 -0600 Message-ID: <20231221-ufs-reset-ensure-effect-before-delay-v3-11-2195a1b66d2e@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> References: <20231221-ufs-reset-ensure-effect-before-delay-v3-0-2195a1b66d2e@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785920466496504313 X-GMAIL-MSGID: 1785920466496504313 Currently a wmb() is used to ensure that writes to the UTP_TASK_REQ_LIST_BASE* regs are completed prior to following writes to the run/stop registers. wmb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring the 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 the bits hit the device. Because the wmb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: 897efe628d7e ("scsi: ufs: add missing memory barriers") Signed-off-by: Andrew Halaney Reviewed-by: Bart Van Assche Reviewed-by: Can Guo --- 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 caebd589e08c..7c1975a1181f 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4726,7 +4726,7 @@ int ufshcd_make_hba_operational(struct ufs_hba *hba) * Make sure base address and interrupt setup are updated before * enabling the run/stop registers below. */ - wmb(); + ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H); /* * UCRDY, UTMRLDY and UTRLRDY bits must be 1