From patchwork Mon Jan 22 17:21:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2737398dyb; Mon, 22 Jan 2024 09:58:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOy3p2AuUgHjbSY9/wHfr8xanNVg1BLcvcj+0MGalFFIhankfUkLhJBoDFJNhwdbjUzZI9 X-Received: by 2002:a05:6808:11c1:b0:3bd:b5d1:ea3b with SMTP id p1-20020a05680811c100b003bdb5d1ea3bmr3508570oiv.0.1705946294888; Mon, 22 Jan 2024 09:58:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946294; cv=pass; d=google.com; s=arc-20160816; b=JNi8Tlkj4ljevU+yGJUlgrlFC6E236eHMcousJsY3mSfW9mrsayiM+9vTo88XZCSph /lzlBViYy92E17D7l6YgqmIMO3XD6/sesOUXhLh9XaDh+3xiSGqoTGHhPXxpncGHX5bA FuVDGO4hNmlgrw0SwygbN0150epnk9W+jSq42Do/B4Ru6BkwOKaDprhNyX3FbK6E/Kql +08Eq9GjDN/Yrnc0B/Z+FyJxAPDaCAZhPydovGNKgqO7NNhqFp8nQjbKwuIcDd7Gyddp +55wXnuo+ZMLVZgxKs4uC21rPoGQLb54kNc4WS35/PF28OSvtrvnOV9XQJoBBN9VMUde GjdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=NX3H6VfoJEzhW/8XTfEE0I9qy52CGxJXMOtu5CoBhrc=; fh=ByWCEAp5R90L4d9lFFDxgmLJfbDPex7EGCNskL+wDE0=; b=qeClqgMKGWUVhoHR7DHegoH9+QImYTMZlZVCgYlK9w+Gy/5Llzh0f3cfUHK1bfkHLG FzV6YIznpmf0dkMvm4YPFrTP+PAQJJ87HoU+GuNcorIB6ix/hwkjJZneKRNQXw9fdt3f Nm/qwGhXcYvHpNeuA8U770yZzrSPrHCrZ5NxxAFOO6Eycoq6xOhhQmkuguVRF+5gBxs4 cPxs2OEb7nUe8KG+xv5XPumfkftcf3Z1Hcpp+vBaOXKb75ntaRZoPND4kol1E3/vd4aE km20pndTNmSONn1fpJ3sChNjPS9+twhJrkNSl1q79swJ2+T0qUyKZUrF2m1qp76kqb5O dA6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PB3a9STo; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33792-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33792-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. [147.75.199.223]) by mx.google.com with ESMTPS id pj3-20020a05620a1d8300b007830b4b4361si5881952qkn.435.2024.01.22.09.58.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33792-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PB3a9STo; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33792-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33792-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 9B7AD1C2781A for ; Mon, 22 Jan 2024 17:58:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDFFC60BA3; Mon, 22 Jan 2024 17:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PB3a9STo" 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 9144B60B81 for ; Mon, 22 Jan 2024 17:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944100; cv=none; b=igJJc1o33nwV2dedcVtMzDRzbS3QBLqecLFtqG5+9YZ4MYjzx5k5HRiJ+4gdPPBbV5WXw3AQBqshWCYiDxQWTvPizawrMsE6/xRuQzs6XFqyqCcTkKu1gmfPbV6a06lVQ+MI5I80cLoqaXQ1LfZVC05vyc63TdoPPFjuYlJokpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944100; c=relaxed/simple; bh=09zxCdt+NCfT08JtVbcGX9+GXw8iPNk0hTs2e6ou3d4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XXi3conuUmOlYHfnTJFQCIs2L7frsxjNYKwXiaa9+6iCDzU/o4r+fX5XrxA3UyToWN/vcbyemH/kuxmq5fsyr3qvNgU82txljdWVqxcIRQ4iP+1NfpT9WbxoReqKXbO3OWKDIs2X27bKrH/HOzQcqGkD3+OG/pck72rjthZwPGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PB3a9STo; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944097; 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=NX3H6VfoJEzhW/8XTfEE0I9qy52CGxJXMOtu5CoBhrc=; b=PB3a9SToQmCFQOrS49eFGu2GvXqKDbJNfgatNdPrZByPzNbnMHO8UK6VbTmhkYIjEI9E1r l0UA3pBEJdw1wImqzbIUUpSPWYqhSE5ouH3/mWhqYhnicorzcXUcI9UdfO0GnTKdL2ZNPU gWVIIDEIBVaCjSyuOhzWZct1QL8nuPE= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-lfwNzo-vMeW2wDInJNqAUg-1; Mon, 22 Jan 2024 12:21:36 -0500 X-MC-Unique: lfwNzo-vMeW2wDInJNqAUg-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-685c9384ecdso32487886d6.2 for ; Mon, 22 Jan 2024 09:21:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944092; x=1706548892; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NX3H6VfoJEzhW/8XTfEE0I9qy52CGxJXMOtu5CoBhrc=; b=cT1gt+qJG44GtqQt4wH05Xu4T2eOa57RaIy8sAV/5L4uyoZJ1iUj9Tj9KkB1T6Og/z GQtCe6HQ7JzVas2MBW6MKQGx4k9g2rIXqaPpJXkXOQ2p3DbQ2xnoWwutYUyhWrUfQjyR MOHRsj1bKw6qPlusWgJRm//uuj0TSuZ/bEHy+EEX14FfrC97zVTvFUn1FiGQvifI74Rs XFCqfdiqGMfptmlvt28T93XG9+mKV/XZMEI4LxiGCswoiqd6TXNBi7+REsGqnueZvuvA 4fopXda7BK3A6uJfI0MIWqKXiJkA8h+eCsHfkbvJhmbWo3SvdsxUJbOD3HGrxXZ/c5Pq ldLA== X-Gm-Message-State: AOJu0YwQ4vH7d7t+fZKDbbPvXEAEQeuFnV5qXFH2dentQe1AFPdJ+aBJ ngA9p9+B/Lqw61i3qdv3F9voMiCBgoAt5G6mzmc86sKuk8RTnwDvd2TyTBxn29DjZ+aKBPXuXI0 ACfklEcL4P/jB+9s+H3TVkiERE5DZIaRCFuTC08VgLsf2kntkXUq7JxeCURtzsA== X-Received: by 2002:a05:6214:76d:b0:685:7524:dd7b with SMTP id f13-20020a056214076d00b006857524dd7bmr5671171qvz.97.1705944092383; Mon, 22 Jan 2024 09:21:32 -0800 (PST) X-Received: by 2002:a05:6214:76d:b0:685:7524:dd7b with SMTP id f13-20020a056214076d00b006857524dd7bmr5671151qvz.97.1705944091962; Mon, 22 Jan 2024 09:21:31 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id lf3-20020a0562142cc300b00680c25f5f06sm2567738qvb.86.2024.01.22.09.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:21:31 -0800 (PST) From: Andrew Halaney Date: Mon, 22 Jan 2024 11:21:26 -0600 Subject: [PATCH RFC v4 01/11] scsi: ufs: qcom: Perform read back after writing reset bit Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240122-ufs-reset-ensure-effect-before-delay-v4-1-6c48432151cc@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> 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: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney , Manivannan Sadhasivam X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788814342523597390 X-GMAIL-MSGID: 1788814342523597390 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 Reviewed-by: Can Guo Signed-off-by: Andrew Halaney --- 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 Mon Jan 22 17:21:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2737543dyb; Mon, 22 Jan 2024 09:58:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7kIXDRPWfD4WDnOAjxnboCiYtOQKrUMXl5va2HHCTf1BcRE/qQk2rktP/ENh9mPYVWkCh X-Received: by 2002:a05:620a:1091:b0:783:2694:48bf with SMTP id g17-20020a05620a109100b00783269448bfmr8304193qkk.12.1705946313030; Mon, 22 Jan 2024 09:58:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946313; cv=pass; d=google.com; s=arc-20160816; b=fTp8YrS5W3oUWqaVERk7TPIb/duiLoc1KNQl0WMe3sUqkgQt9m7dKKVZvM1fC/BXgo c+98SeGA2XSeyjiSqxk204ytRLKZqWGg2/mMTapcojTjTlzQYoRenVJEQoECd+Owke/l D02ugrJ/K19TLg+pPHK4G8F7C4f4I138f2OFsuCPcDLzvtS7sYqbwDKzxIHbQzk7cgem ykq6dQZmAeBUqQ2gmAp3dxmWzyNvuXWSnpyXGP/MTvOgez28UFG92obHBwnS/fkD6h0F A161crjb/UF85ge0lPSfUyG6CPVQReg1lYFwI2wc7re4kMBoePzAZdUaj2GSJnuY3wKZ C+YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=6KvF/wE7cle9SwAgTLO4kAe2SOvejFGQAYKmJxo43jY=; fh=c5Fs9M7WVDX65WPVRK59sxT+vx/fjIimWGcXj/zERog=; b=iyxW4CkoIv7vF7AXMdhi9Y9OVklI0zf3v9gaQhNNQDF0sL6kgHwVn77LYJ2+IXR9QF Sz+FPJ9FqHaJdfwDsPJnsfYiCYwBVh3Mq/DePRfwoij41RxlCNzvgQyGUVgfJJHGMc9Y eaOFfgQpty7wlbr6ojPXfXrkikKe1TxjCgIhwurXuwqEhA+qvIcRBZNuKjm26P0NMGKu X5OnRv6J0yS9LQs3Vr1xF+AMVxvs1CM4xY3JUIbAF4sDNQF/QLANdUCBNsV7wAV6c+sd NV+6r2kV8E+My7qkMs7b8UentNCBdHeOcrXzM/Vl4oJmw+wi9RYFkjdlw/bRMZS7g499 WBoQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TmLlzKrj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33793-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33793-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. [147.75.199.223]) by mx.google.com with ESMTPS id h13-20020a05620a13ed00b00783070846e9si5980907qkl.385.2024.01.22.09.58.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:58:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33793-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TmLlzKrj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33793-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33793-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 CF94A1C28A40 for ; Mon, 22 Jan 2024 17:58:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF7E760BBF; Mon, 22 Jan 2024 17:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TmLlzKrj" 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 B388D60B95 for ; Mon, 22 Jan 2024 17:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944103; cv=none; b=p29rY1zVJb2S+Di2U2V4Z6EL7hfFGD5ndXyUmAav7nCkyyQ2wYqhvtFzydHtB1WY6FQDpQCXjw+3piZU52gLE8D/8AVRPrvFt9OZ7hSz2C5baXMqbBD2YOCzyJFv9eORffQeeStORdAgEVXBDq5UF3GfhiOqwlHyFy9pJ+IG800= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944103; c=relaxed/simple; bh=0P1cnI0mD8xM/AjnAgWtUBg7VLq6L+5OdBjFcSoDduc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dKOlepbhag5CUWd9h0+GlK1rVIHdr1YfNNAkrRIoQoISP+kVAwqmiPIpvzkoyXUPMNCp+DtWV0u4uNBc/s+pl8CnPrP+l6U4ettwIhpkLoj4gsU7meW6dSlC5t8RmQ9xPlttybQ/DJy0vH+ibm5MWtmihPxTra8Meud52hEySo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TmLlzKrj; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944100; 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=6KvF/wE7cle9SwAgTLO4kAe2SOvejFGQAYKmJxo43jY=; b=TmLlzKrjV4S4UXYVXar1JTPl+ouBcAqGeekrFsy+GZ24cIpHcgfKb5e/QUIawymyVzqwCH C0sGfVG/iw5OhQanwRQ/gdgPpGeqQsLSfXfawvlbZ/QiHISyIoBNRmKOI59Q+e2VySal00 ZhjRMXiky4AE7aBgvlIvEsWjL00loO4= 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-277-7Ws6_TiBORCBsd-VQfLxJA-1; Mon, 22 Jan 2024 12:21:38 -0500 X-MC-Unique: 7Ws6_TiBORCBsd-VQfLxJA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-681998847b0so66515206d6.0 for ; Mon, 22 Jan 2024 09:21:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944097; x=1706548897; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6KvF/wE7cle9SwAgTLO4kAe2SOvejFGQAYKmJxo43jY=; b=NiJ3av+H8OjyUPp7PkxukzdZYaF98YZC09IfeePNqJsn5wmt89DfuUJyE+lIAkrST1 QlKH5YMOibiR1CayGa8/NKV/uT+QDsgFKkWPGRTFsSgOa82ud6t/8cas9T0OJ6hpO2zD bE0pQWUrvMIJvBzIfSw0/SSBZBN86kSD1/YqUSYt1soY33aERjdXTVwnEu4RQ13/T0ci GIzQDj+hWKbmJTj5aZgVh1yTumUfE5vUVVmjzYxInA4enq7xoosrdPem+oZpKo0MMruY ejKMKdH+wLcRQek5W0obDAGjW1BT6qkL8FIscBhIVT+OwTfL86LQ9WNrk5Js1m2X1vsB Dp8g== X-Gm-Message-State: AOJu0Yw9IlcyB7VLZf6RwreMXk1vYN73lcmjpt355H/UVsO8Pv0y5Y// Z2MfSy0Hzd3N4XSmYkMYGw9qTWchXoXmORv2WoTkkKU5fM8y7y9tATGyv3YuHtkfU68iDzPelNw W5v0cZyPB6GWf1f7nfTqreurBAnxnyi9a3/qoXrxwTmbzQiYHGVy2I6fVGMS8yg== X-Received: by 2002:a05:6214:1d2e:b0:684:d2a1:990f with SMTP id f14-20020a0562141d2e00b00684d2a1990fmr6930848qvd.40.1705944096917; Mon, 22 Jan 2024 09:21:36 -0800 (PST) X-Received: by 2002:a05:6214:1d2e:b0:684:d2a1:990f with SMTP id f14-20020a0562141d2e00b00684d2a1990fmr6930834qvd.40.1705944096647; Mon, 22 Jan 2024 09:21:36 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id lf3-20020a0562142cc300b00680c25f5f06sm2567738qvb.86.2024.01.22.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:21:33 -0800 (PST) From: Andrew Halaney Date: Mon, 22 Jan 2024 11:21:27 -0600 Subject: [PATCH RFC v4 02/11] scsi: ufs: qcom: Perform read back after writing REG_UFS_SYS1CLK_1US Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240122-ufs-reset-ensure-effect-before-delay-v4-2-6c48432151cc@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> 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: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788814361119095305 X-GMAIL-MSGID: 1788814361119095305 Currently after writing to REG_UFS_SYS1CLK_1US a mb() is used to ensure that write has gone through to the device. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure the bit hits the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and power optimizations") Reviewed-by: Can Guo Signed-off-by: Andrew Halaney --- 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 39eef470f8fa..0603a07a23a2 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 Mon Jan 22 17:21:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2746035dyb; Mon, 22 Jan 2024 10:09:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IECjQHu5gefIliC6GbkB0ubSS4wRnla9PXtmZW+BdVFe51UhdbPHzXfQN/DFnLtMQhHsxGH X-Received: by 2002:a05:6e02:f07:b0:35f:e861:6fcc with SMTP id x7-20020a056e020f0700b0035fe8616fccmr6130395ilj.81.1705946982884; Mon, 22 Jan 2024 10:09:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946982; cv=pass; d=google.com; s=arc-20160816; b=fO4OKM3BA06NH57pFJBUZ+lzhU/Xi+e6gPBazt8zx6gGUM1t6+V0NZ5l9Etdxo7i2x z4LJVNU0OMECCKka4kbNCJVGFV92XQFRw4aJmOS8jTIEU5y5jWo0Ney5E246VirYMSNO 4mgJWy6N9QZkColTgXp28nDQZUzSBcIUHxIzu/Tan+OQ0o8rCkB1Eq0LqfS2kNgoca7K UP2iFJmKRbI8Ketu0KcYyA6PwPPitGBdWE5N6f9z02cdjS+8gQstSKcSnzyQd0RNo+8P 8ngzbjLBorlL0YBFvfOIa8BlVAs9dH0yS+Q/4bSkaQzPx6kmkndU1jl1aWrJYRpqXmhB ZA7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=sjlATDY0QO5uIJmBTf+Xy8olJtH1umxQHbsM1EB2vCM=; fh=c5Fs9M7WVDX65WPVRK59sxT+vx/fjIimWGcXj/zERog=; b=b3BChQvqVCRZb0ngkq74D9P6a34STnHi3KTU1FyYDOCzKNNiFD1Ro1W5mt/f49LHX9 7whw7zvTaTgmvgfSfxvaej7KewtlLVVtbc8uWVd4BVPgUPJhbtGfIuBTF7GpPf95jgb+ RFtydGDZMldeb2td5+qSOQj0UC/7OPNBl5Teab6rsGhvWyvbcF4rKRyNV62aIUuQudn1 r8ICBP/2qKyCPZKL0CW18EtUWNj2fcd9HAuxx4CgiVy15XOnccCJ7M8P80IiWrZmz486 HOzyjKslG+fkx3O+y5NtiGqkEH7Ts4Qi9LiZVxznhVAqbKpPOJqoDaIvbbZIP2czs8T9 zATg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Bm0riMaq; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33794-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33794-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 z7-20020a656107000000b005c69365abbbsi8231750pgu.318.2024.01.22.10.09.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:09:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33794-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=Bm0riMaq; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33794-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33794-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 CD7DD28BE56 for ; Mon, 22 Jan 2024 17:58:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAC1260DEA; Mon, 22 Jan 2024 17:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bm0riMaq" 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 8B19460BBD for ; Mon, 22 Jan 2024 17:21:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944108; cv=none; b=EUW7oM4qCG12ESqRun91L8MgE3ZXhY5P79nnFDSmbQ82LqrsVsJY/k17rNKz7cpGPXlft1qmeX+jOyxKj8Eo77gjF2NEsy1J5iB6GWszz81udRjT1ls8roBrpOFuD5y1YkgGDdulA+ID6LV5tfKjSb6urmA8xokUfyobwToGyJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944108; c=relaxed/simple; bh=r/jz8Df2KX737BM4u04ZW0ds9pGrXMmBG5wbF5ma2rg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j7rOVqgB7E/pvGPRBcLFsNaCIK+O7xeVzR+1JOTQEaC0i3+LLUGkDoujy5cvOgvHS21iLsw7UP0QV19+fvi72OZjIzWORVUS4LqeFhWTzlORpkrxJ9+SnM+LtbHtS78nGm7b0cKIFS1AOx/xnKrRiPQtNWUuHfMH1OwW3ATOf5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Bm0riMaq; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944106; 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=sjlATDY0QO5uIJmBTf+Xy8olJtH1umxQHbsM1EB2vCM=; b=Bm0riMaq7FedhH6LvV8eIA7aKkBcSF0bkLHcocmpPIQoDvqxxePg0rUiHCZWPqsvmDMTA1 2IIbiMXB3X/y7rJZuYOTBHMqFA/GKjpfG+nL9GDV3e2lYmD3qKv3ecTr41koTV5jEgrh91 0F4j9MGo3w6fmu4HfIiuqM9XUzQWT3U= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-SMI5aN1dNmyZQ5KZits38g-1; Mon, 22 Jan 2024 12:21:44 -0500 X-MC-Unique: SMI5aN1dNmyZQ5KZits38g-1 Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-598e30e7e8cso3286744eaf.3 for ; Mon, 22 Jan 2024 09:21:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944101; x=1706548901; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sjlATDY0QO5uIJmBTf+Xy8olJtH1umxQHbsM1EB2vCM=; b=pLpVfa5qzkSEcP78VCcdhNkpuNNMjYvkgwJtdjEXSnz5ThvwambT3qPOwTBpGvhzjI wmBQqOnEipxrFy4T7VvNGxsdOfuIoeNpvKGtJE/fTAlEW7sD/eetumwJjoG6BG4TC1nt 7NL4XvhOPEa7SwZ509ZLmTbkqOpnEcMBnpxRj4asaCc/lfMIbGH4K1suKjIIGp5ZArme MPoKtvt3lYvOen2brXoYKglTvC/+OC20ghKc0jFI67Ih7eF58LLYLlBNWNwyPD5hubGp t2TlHCJcdFGHj23o9g2avQwBZ0/W7B9ZDc0q80x4bfRmF3bOa7n2UZ6CyV3rdBIBjmbn dMLQ== X-Gm-Message-State: AOJu0YzPr8dUq6QPVc4L0FywJ/O4M7P1OjD1kkYJJg8m58vP6lFsoNZR PUiXriUWE/RtYdt4UL9L3tMNvx+lV84Y+6UtvOgPtUtq86l44PxvAG4CEDC76ppxnAcNfi4sRBB +3QKrJ/taMfOHUzDYJJLZDyQ8W/9/Qk1HXTrTn4L2Yc5bHGVXpv5/sEXlkoDLtA== X-Received: by 2002:a05:6358:9386:b0:173:203:c5c1 with SMTP id h6-20020a056358938600b001730203c5c1mr2261912rwb.62.1705944101721; Mon, 22 Jan 2024 09:21:41 -0800 (PST) X-Received: by 2002:a05:6358:9386:b0:173:203:c5c1 with SMTP id h6-20020a056358938600b001730203c5c1mr2261899rwb.62.1705944101357; Mon, 22 Jan 2024 09:21:41 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id lf3-20020a0562142cc300b00680c25f5f06sm2567738qvb.86.2024.01.22.09.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:21:37 -0800 (PST) From: Andrew Halaney Date: Mon, 22 Jan 2024 11:21:28 -0600 Subject: [PATCH RFC v4 03/11] scsi: ufs: qcom: Remove unnecessary mb() after writing testbus config Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240122-ufs-reset-ensure-effect-before-delay-v4-3-6c48432151cc@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> 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: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788815063052488605 X-GMAIL-MSGID: 1788815063052488605 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 But, there's really no reason to even ensure completion before continuing. The only requirement here is that this write is ordered to this endpoint (which readl()/writel() guarantees already). For that reason the mb() can be dropped altogether without anything forcing completion. Fixes: 9c46b8676271 ("scsi: ufs-qcom: dump additional testbus registers") Signed-off-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 0603a07a23a2..a489c8c6f849 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1429,11 +1429,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 Mon Jan 22 17:21:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2743880dyb; Mon, 22 Jan 2024 10:06:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0N2U/4c6wW/c+Ye+TqC1+8AZgeUHgfe/zh2r953RcQv52sZ26Nj947vNgQ8UF13DR0cG0 X-Received: by 2002:a17:907:c209:b0:a30:399c:6421 with SMTP id ti9-20020a170907c20900b00a30399c6421mr720704ejc.254.1705946808855; Mon, 22 Jan 2024 10:06:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946808; cv=pass; d=google.com; s=arc-20160816; b=Gsx0l8K5Zxq3B33QTG2BDbhHxA4JKQ9R4+hMgXTa20u1gCx0xrHsksjmwj5oLc2j+l OjnjNAG/a8z0RSMUcoYrNmgcopaHxuUeBott7DavlsyE2cqIYGASsCJ6wpDVGZLkJntI awU+7W3ESJbx1GfQTcRprNlO6hKxS65leMFL7jUsjhEeQ37n3FQubryzTK04ggDfUT+d TaPs5DdPa7LSelTwuZ2GIsuBxd9rNZfkxHi+upZ3AdyaqoZ8axu3cXOwRcmcROzUHf9+ fpzOKiphc6AbvSrSb37uJT/9sDJeB9XR9k84uLoGpkT25Vp6CPS1SighsyEoW5rW65NP 82tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=R70AogzmSo/CRKtY8ackbX9p9Zw/xQ4/D9I9iZgsmTo=; fh=c5Fs9M7WVDX65WPVRK59sxT+vx/fjIimWGcXj/zERog=; b=cStV3MKsKLJKcmK/uPQCKtX1P4O+rLcbdK5pLXTCE80Ft80zP0rRnzH1qMFnY44yj4 TH9ogP0qGg+vU8QlAvOn1XFAquhQTb0eTIT4f+bWuTLO3mMreAZ0/qhj262iQm1bfoA4 2Hm2xZfkFyXbZz8wGsP04fZ9Ape4NGSakMpzi1t8cNsN6r2KOXbHCvgQc6zjU7tSXzYl nYF/ZJ+M5plagq4vXHUYQbYbiXEpHUgz2NpD0xsmyKJhDFAXoSBOpr/fIPsjY+qO0F/N Z8joR6xSZPfzDUhLKy12TQHHYD0euzSky/SRGaSELER/mjDFmDmpGVW8C2eCznl07Moz tusw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aZcK0mcJ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33796-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33796-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 f24-20020a170906391800b00a2693a66d02si10847994eje.251.2024.01.22.10.06.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:06:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33796-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=aZcK0mcJ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33796-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33796-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 9CF251F2CC18 for ; Mon, 22 Jan 2024 17:59:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C9D660EDF; Mon, 22 Jan 2024 17:22:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aZcK0mcJ" 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 8DBDB60DEC for ; Mon, 22 Jan 2024 17:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944121; cv=none; b=RkrPYgtLBB7SDiizk6HApHXKtMuRyZI+GaIloaibIgxtN4AfqLoHZvTRCmXuCYw8DmfKBPbgUQP1s255n6NBsWxZQWrzhBrY3SFV095RpsmkJxuVUFMVF1o+ODmzA9aZ3sOOlxmZBa7rROnX4xvPpSSJLKZN9M+mhtaoVaQt3C8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944121; c=relaxed/simple; bh=98P8Ul6Yd7c/3fLfOg78lrSuMF8zpONCYx14LZgSuKM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kSA2DpQ4wXlr7HVNj/+6Sk1JZzAfIWxKBO4L9f9MDZwFvSLRmSOcbihWlW8xR5FCZIHHVlBkOA/g2zv3sDGhou0vKQ/h0tcoMFRvia54YxcCvjBXp4uQW4CF/GgfhIszLwvefLohhKqXK34UYR13HRg6oKuWWw5ZMkgsVcNOMDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=aZcK0mcJ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944117; 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=R70AogzmSo/CRKtY8ackbX9p9Zw/xQ4/D9I9iZgsmTo=; b=aZcK0mcJ/UxbGQVHOIRR5emOiTaFZYQuGDJnDLrXv83ImNE3ladtAkZWEexhG2T7jBRNvM gmHkQRxBTnmB3D3YhGvo6ioMBwW+T0pLPIcv+/pkehoxv5hpGF68jnSohHDKEQH5bK8clb y5fjQOULNRRUTY3P0WzwjVVNgoadc/s= 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-613-rcqANBuTMLK5wGN8ZetTNw-1; Mon, 22 Jan 2024 12:21:50 -0500 X-MC-Unique: rcqANBuTMLK5wGN8ZetTNw-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-68694f9e037so9399446d6.2 for ; Mon, 22 Jan 2024 09:21:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944107; x=1706548907; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R70AogzmSo/CRKtY8ackbX9p9Zw/xQ4/D9I9iZgsmTo=; b=w0/BZ4c8BxTfogUbav7pbghu1noF7Y39A2fV+8JuQnfwh/tJ3rEDTzPeh+zKgxMPh1 tw86+XFJw/l2tJfHDeHdE0dgFtPaZIDmSy3hpz9ukjuEiHZbz9EWdWjbWSp8lEIOnFFr T2xvd0RUG0KEzRLnLhrjzZV0DzhPKZW+giC5aQIkfTctJu5CXnxZ3G5Gg6JXUyQ6bci8 obf0LeZfetWdHDc3oicXetueqXSt+sP8gzCAqqvXZf4Ggp4JfMllGxke0YzxE0RuWClA owXLCRTuJoU0VBMFyKi1NHQKCCssOP5hhj18gUeBt3mSssVGRnAM798ipdQ05ipCAsp/ SE7g== X-Gm-Message-State: AOJu0YyU4PutZp9GzUBe2IVlxYi1ZO1RlO/2uvDSlYcKBHMcifIj4fr6 Vwdxf3zLaH9vI8SzQcc6qI9orTbPC3ctc7NKSTa6rGoimNGnRtP35S7gm5OxtcL33BeyxqIuv3b oUZ2aAQ2Pxqtt6A6eGdqBrLrByZV0n165/vw+JqZ1oYiMcK6pFQ6TZB3ykpI9nw== X-Received: by 2002:ad4:5d45:0:b0:681:888c:b82c with SMTP id jk5-20020ad45d45000000b00681888cb82cmr6893800qvb.125.1705944106734; Mon, 22 Jan 2024 09:21:46 -0800 (PST) X-Received: by 2002:ad4:5d45:0:b0:681:888c:b82c with SMTP id jk5-20020ad45d45000000b00681888cb82cmr6893775qvb.125.1705944106311; Mon, 22 Jan 2024 09:21:46 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id lf3-20020a0562142cc300b00680c25f5f06sm2567738qvb.86.2024.01.22.09.21.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:21:42 -0800 (PST) From: Andrew Halaney Date: Mon, 22 Jan 2024 11:21:29 -0600 Subject: [PATCH RFC v4 04/11] scsi: ufs: qcom: Perform read back after writing unipro mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240122-ufs-reset-ensure-effect-before-delay-v4-4-6c48432151cc@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> 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: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788814881217545841 X-GMAIL-MSGID: 1788814881217545841 Currently, the QUNIPRO_SEL bit is written to and then an mb() is used to ensure that completes before continuing. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 But, there's really no reason to even ensure completion before continuing. The only requirement here is that this write is ordered to this endpoint (which readl()/writel() guarantees already). For that reason the mb() can be dropped altogether without anything forcing completion. Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and power optimizations") Signed-off-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index a489c8c6f849..decad95bd444 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -278,9 +278,6 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) if (host->hw_ver.major >= 0x05) ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); - - /* make sure above configuration is applied before we return */ - mb(); } /* From patchwork Mon Jan 22 17:21:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2743971dyb; Mon, 22 Jan 2024 10:06:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaFxuQr3aW2xUpRJKWGZI/G7vxRzWs6fhy+S32XargFu3FIOyhjREBNFYKT9LoUEjRwfRT X-Received: by 2002:ac2:5ff0:0:b0:50e:efc4:a318 with SMTP id s16-20020ac25ff0000000b0050eefc4a318mr1559976lfg.64.1705946817327; Mon, 22 Jan 2024 10:06:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946817; cv=pass; d=google.com; s=arc-20160816; b=FWH4F11k7NDVTtRv/MkHL/d2mINoV3DptPKgokKPq7Ofq4ixbB2Qp+IkYBU5q2jCBT EMM6hq3tbktJKl+g4HMwTqWvtX0LrKTDDUORgL2W6WpBS1QyhxNUDSCbzzFA1A2rrnhR ta/dOL+iaZr3ctOaKe/SZ9jJrJHCdw8oNeeQG1gKXwmrRYvPA6JJr4Qm8tlmqGcxXKDm ATon4ve6NqCjsrZR5k3BKMci5uu58cfgMd7Hd3NjixpDYgBHDk3CXPiYXqgL3qsdXzbq EWVpb0mEm6BuyhyVF8BEktDOW3I8k1rVJqyh51eUft+Xr0okh3zlMSrtF9hlaBk9nKDV WFyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=7rD2RVNfwDn0BbFWtf0meNmC+cZt+1EvBJ+MzhncMZA=; fh=ByWCEAp5R90L4d9lFFDxgmLJfbDPex7EGCNskL+wDE0=; b=begsDFqxgfGMBaxPpcnOfIFq4RP6902zGS5L/3Y7AoI5wqEbKWi0udg9SUGDYH+Njx SOHuIdzEbUz7CwUilJTvWoLhk8k7vlT+piRoiJi5+iVGhqJ6wvVO1MNlQsXWoKU9hjWB IBHKULOCuglbTs08v6xP56p40W8o18L+VOUEmNjk2gBFP3CHVuWzTMVG/oSeRvBbrjmA 1gEF5Jf/iR6IN9rIKCuZSg3QUOW7S7bMJVBf06s5OsuxQa8DsoAb8rksoGs4w8U75nhb b2vPugRwnHUHIz4ekuQZqZqkbQThqK+f3X7HlOHwlL3V9SnWXkJgs4/SzkbnGPTfszGk Hr5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PWZyyodt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33795-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33795-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 o18-20020a1709064f9200b00a28aca767d6si10463996eju.815.2024.01.22.10.06.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33795-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=PWZyyodt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33795-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33795-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 E850D1F2CE9B for ; Mon, 22 Jan 2024 17:59:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B19C60EDE; Mon, 22 Jan 2024 17:22:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PWZyyodt" 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 B152360DEF for ; Mon, 22 Jan 2024 17:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944121; cv=none; b=H48ZrnM88L1n1KYEWbmDZOGLXpMRjgW+KM1jyIyAt1aYR1FTPesrG69LHhZSxYerchfiXpCFlaVJyPa3lZje/HwsD0OES1/eTrEEb07+7tHaJm8TuKHZGudQ7GR/VwfTT+QTWlH8w7/Go6zu11ORMsmbm026VcCGS1ThW1PqWLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944121; c=relaxed/simple; bh=OxrzxxUWihz3B2zxHQ6fTBKU+t//zIV2dCIEuKHpOM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GUMkqPTAxyY/fy6T5ncGUakPjpBkM8qAetP8ayPidhGi/T0/dR0Jf12mRfNCO26CMWBguj4tSJozqnLaHKi1m7HLIrZTAItLMCBOX0RQNxYDuVmYfv2qlhC4nQqC0a/Ug52mZNVFZT7epo/AWAOtEV30Ct8lxn007h8YeUCuqRo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PWZyyodt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944117; 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=7rD2RVNfwDn0BbFWtf0meNmC+cZt+1EvBJ+MzhncMZA=; b=PWZyyodttiPWgQSY7JSd3/iKAKtUYGrlq6WB7j0fGDe66DJ2Rh4925QHA0DaYfDX+VQetw rF9ZCW0JDYpO4C9QntRmyprq6HN7c8VT00SdTp+azXtR1GHXotGPm0q0vEZf6Mgc6Py78P AgNAZwfFAnLKBEID5bGE3ESeXtir/wk= Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-gIS6TGeTMBCqCxBXG21xHw-1; Mon, 22 Jan 2024 12:21:56 -0500 X-MC-Unique: gIS6TGeTMBCqCxBXG21xHw-1 Received: by mail-ua1-f69.google.com with SMTP id a1e0cc1a2514c-7cee1755d80so912367241.2 for ; Mon, 22 Jan 2024 09:21:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944111; x=1706548911; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7rD2RVNfwDn0BbFWtf0meNmC+cZt+1EvBJ+MzhncMZA=; b=jimMZfQ2jI0vFW4VeYF7nInlJ0DQjZhlVvaVKEhaFsqL/QjxRyi9nRNTU7OaJ+OpKH FIP/r0kDc31F3uVDlvsgOtnXeURukjdrTBD7NruINg7tSgrd8lnVu6DREiuigY2kzT0Z PmKgwdSk5JwN81TC/yde0JGT7PPxU6Z+NAPCDutheG+17hLDWTF/zZkhf3gUimUYqalg lhQZ4gAPCgRc6SY9y82IJWrDND2H7TwNKeeLTlyawRjNRYDRsjZBVy8WeEjXndLArTH8 sKM+uUppFLURnqHGbdqYmXDhj7IpPinHeCsTf8bgkQI3Sxgb4BEddvu0YKCqRBw32c91 FIOQ== X-Gm-Message-State: AOJu0YzN86vov4mYlijkZdQ//1OmTBsE6W6CqE9oMgs3qd2SLW1d3NDv ldfzSIa4DuTBvpTQd8xzMO2H2Oey3CWeQfGz1OU6c9+BkvOfxyi8Aw1uqVrGiBE4U+vWj7cCZsf G0fKr1oWclE2/AoyDBdp/F6J0Z7/fe4mt9PqH1U7WTkG6F3ERF3p0ISzVuvoKpQ== X-Received: by 2002:a05:6122:179c:b0:4b7:422b:d7c3 with SMTP id o28-20020a056122179c00b004b7422bd7c3mr1787498vkf.20.1705944111717; Mon, 22 Jan 2024 09:21:51 -0800 (PST) X-Received: by 2002:a05:6122:179c:b0:4b7:422b:d7c3 with SMTP id o28-20020a056122179c00b004b7422bd7c3mr1787474vkf.20.1705944111456; Mon, 22 Jan 2024 09:21:51 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id lf3-20020a0562142cc300b00680c25f5f06sm2567738qvb.86.2024.01.22.09.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:21:47 -0800 (PST) From: Andrew Halaney Date: Mon, 22 Jan 2024 11:21:30 -0600 Subject: [PATCH RFC v4 05/11] scsi: ufs: qcom: Perform read back after writing CGC enable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240122-ufs-reset-ensure-effect-before-delay-v4-5-6c48432151cc@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-6c48432151cc@redhat.com> 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: Will Deacon , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Halaney , Manivannan Sadhasivam X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788814889744099943 X-GMAIL-MSGID: 1788814889744099943 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. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Can Guo Fixes: 81c0fc51b7a7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms") Signed-off-by: Andrew Halaney --- 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 decad95bd444..881074fc2329 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -406,7 +406,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 Mon Jan 22 17:24:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2747226dyb; Mon, 22 Jan 2024 10:11:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzjesnTHchXFRP6Yp5zaAXbknBcj51wrDN6PGLCjszetrE8AYCi4FOPsWpBmEch+AjMz2W X-Received: by 2002:aa7:88ca:0:b0:6da:dc3f:e831 with SMTP id k10-20020aa788ca000000b006dadc3fe831mr6113281pff.63.1705947084962; Mon, 22 Jan 2024 10:11:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705947084; cv=pass; d=google.com; s=arc-20160816; b=sZQjt6wQMLN9TPueOFZta46H9/f+xJcJ4fdbzjlP4TQjue5RT7URjamZU4qCznrAWe hNvf5PLKRwdIICfev0j0kJXWyQFidcF02Zgrvyc4HTXov0IWBTcTsZZYE0Huse2+8e0g n4VV7oce8sW4dFBm0QrN2MFViXQ1rW/QlAeT2+/uIhcMWmh+jlBa5UWXMwuIa6yclPU1 g6MLULY+2+K+GOM16/EmqkccFkflW5MJHu+8l+/wsQf/iDXaPy60ULwdQGoGxwqqE85I /S3wQGRq84lQWnc6xaF3kNaKpkZi6kQmt77KpGt8NHWFHLsjIb6gj8KD7ThEOK++hjD0 MwoA== ARC-Message-Signature: i=2; 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=Nbn1T5pI3z/UbfuUYU7cHvzOeNQR0JNnB8PBypvklZ8=; fh=sZjr1X209RpV6CW6bF47/guNu/E4ZUOEtACd37gRznE=; b=l9P4AU0BoFu+M4BL1Ooe4jjEEcIDAhlTKEgadKptrx38JOd06Goo3InFdBD2pfRAHs nhwgVM6qUKCwYT6rhXBro33nIr37/ye+zwiCIoxl18tKNOQEEm3LsyseHtbMEr+LXatG ++X/8TYyiptrw2DpDeSPh+2e8mO5OpHiEpdOthGEoFldIcHHKx15JnTEA1vX+qxMOzeE Q2XxqCo4YZMGFd8pTuwNH5AdJdF9zQ2lCe7iE/QNYiZwqoAr+uye6RA/zkC/mY9q16lw cK0HvRq4+Brs6s1oh/9eKOmTJ8X57b6kMfGhQhUCKJd7ueF3q4gEd9FgOYT46584Pv7i dfgw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="clNL/NcM"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33803-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33803-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 g11-20020a056a0023cb00b006db786ef628si10698771pfc.158.2024.01.22.10.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:11:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33803-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="clNL/NcM"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33803-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33803-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 53D092817FE for ; Mon, 22 Jan 2024 18:01:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 869D853E19; Mon, 22 Jan 2024 17:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="clNL/NcM" 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 62B4853E2D for ; Mon, 22 Jan 2024 17:24:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944278; cv=none; b=lGwyx85cM7ych2K1jVwMHBeBmq7nVCabvgx+Ux+Ti5whkKiXPOrHBlMmJgN4Lr2nKJw1v6F2Ey0uRk4w8UoMUiFkUcgEHc8QsKy/Cs9Bgbdxbf7czUC9ZUGGuDRIHYI9Qi7TAjaoWTfhJ4tzRkBgYH8D21tUJKXrX6JPOad0QoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944278; c=relaxed/simple; bh=s5zG+L/VGA4r6opNYDq/X6r4u7Dz3JHhUiw1v8rHzzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=irnAFjD480p3qobaNfjd3zcmGEJYot+hNfnuO36cdD7hwJNZD2bhn0CI+cZAmg5HfR/PSYZ10hsLd0GcjvXd2rLwXURmMA6R6P4DlEEmRdrkzZA0AEkFejagcbH6O3DtYUX/qlDr0Ez7oEBDQHJ2nXMIGGOpAsyRTB7z/luV19A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=clNL/NcM; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944276; 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=Nbn1T5pI3z/UbfuUYU7cHvzOeNQR0JNnB8PBypvklZ8=; b=clNL/NcM1B6zQ5NSaMG/XxX8nj5lVZ1CB9WQI2+z7+Lksm0uAjGl/Mq5+VrXrhbVx5syLA rSsh7Rp65o2zFHgQ2+TkjulCphYT7K6cfiV3+ac8eNjNIDu/GhFeJkFP6UaV0g0bYb04/R SLEuY5vYoKLcyB0xNXMIR+o8qUgptEw= 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-197-Ft3HtnJJPl2yqRrJheVuNA-1; Mon, 22 Jan 2024 12:24:35 -0500 X-MC-Unique: Ft3HtnJJPl2yqRrJheVuNA-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7835bb86ca6so578391385a.2 for ; Mon, 22 Jan 2024 09:24:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944271; x=1706549071; 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=Nbn1T5pI3z/UbfuUYU7cHvzOeNQR0JNnB8PBypvklZ8=; b=N7rJ68o+Yq64Wtt0XRwvvq+6ELPvWzmrtf6zD/iHCe8i6Q2WAdNnjXakV5o10hfsgU Im5vz7o8P4IsjGQWFiFJBoqS3ukIhVkLZYUhHwFJbzp5h+P+Z2VhF78OORpDaYOMVfum 46TRNm0wJXtIb5WaRJyJ1sp5EvBsaCX8kOErxhxMtAjNnuIDWdZ0NosB8l1mqLSEOrW5 zyLqGL8w7whzqXk+CUttGtfgwKyWsdgLNwkL5ARfAEFIfjOHyE19mXrD4nWrH6w+/JBz cPNzGhBvNSoKJ901/4gk5UfU2B1I9PA1Av9PHb/KcsLX7m+cdxskTGnyHXCDCvPBsEtZ SLKg== X-Gm-Message-State: AOJu0YzLyAUcqx5VZ1pPr6ksym6D/4MaP2Kezb7YFHynFEiKZ9KwkMdF GG2ScCgv6dNFnLNfLao7tw+M1CajTU8rG6Bo5OTfjiXiYfxBLdgp2jBOfetkdsEYS4z3ri4IUut PMP9VaHRru702lZoJ5Nz7IIYBnRipG1P08t6uylEqaGVa6NCSA2oYq82V0j0UPA== X-Received: by 2002:a05:620a:4092:b0:783:a2ba:eebc with SMTP id f18-20020a05620a409200b00783a2baeebcmr1181215qko.24.1705944271369; Mon, 22 Jan 2024 09:24:31 -0800 (PST) X-Received: by 2002:a05:620a:4092:b0:783:a2ba:eebc with SMTP id f18-20020a05620a409200b00783a2baeebcmr1181193qko.24.1705944270958; Mon, 22 Jan 2024 09:24:30 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:24:30 -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 v4 06/11] scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV Date: Mon, 22 Jan 2024 11:24:02 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-6-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788815170569896125 X-GMAIL-MSGID: 1788815170569896125 Currently, HCLKDIV is written to and then completed with an mb(). mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure the bit hits the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: d90996dae8e4 ("scsi: ufs: Add UFS platform driver for Cadence UFS") Reviewed-by: Manivannan Sadhasivam Signed-off-by: Andrew Halaney --- drivers/ufs/host/cdns-pltfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 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 Mon Jan 22 17:24:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2742453dyb; Mon, 22 Jan 2024 10:04:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWENQ2so4BQp95gBdwX2gsLqNQtDC39mcytVGjNDZlOJrCh8jOCLiUzEPJZ56b3AzQ0Wax X-Received: by 2002:a05:6214:2603:b0:680:b7fd:e3c0 with SMTP id gu3-20020a056214260300b00680b7fde3c0mr7866328qvb.130.1705946691517; Mon, 22 Jan 2024 10:04:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946691; cv=pass; d=google.com; s=arc-20160816; b=HSRNuZ2cheCh9CgyltdDfD16NkrHPUM1QREYudfjx+O9VFZQ/0RMAo0mmSqLA1UwXP 2wTU/gPUsfqHxfo4fctKzAUY8DlkGUyQV3ZiEXQVceayXDc+dROiT0mlLQQ5c9+Wyp4p Ad3fbjBRAficiHKRyhsSHo1Aqi/yB4//Q5W0O6BP3KnsH84KtiFtHvuFPpZhnZBf73CG 9cgH06t+e+3p/9OaYKeDKg0jFl88F5klUAcdrUGJQKNt2srKMCBpABfQNekZAJkOU3ZT a4KmaXnUu4kPPhO+lztycK1FLDOwUs3wlXJ7mHfiJjqKdgTN7DCRQCMoMmuwJPgCEmW3 HwBg== ARC-Message-Signature: i=2; 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=n3rKjJ1dBHRScMpZN00CyaIUSPfncYm2oVF6llIbVjU=; fh=sZjr1X209RpV6CW6bF47/guNu/E4ZUOEtACd37gRznE=; b=QV3E9GmGMklEarN/Upxcd+vjAAjOIXIFKZNnfFXrsB0ND55wrcafLb3XZaEgymg2Bg /oT4HIj1ElzAENnLup72kzc5yJdYmFMdM48v7s3Sg8UCEgloB/SULGea66oC4Ycz7B77 dTeVOW6fp7+UuGRYmuLlia/t3DDDdltxef2fdW++wkggnAXS2vWd/B1QZUKozt71h2Q+ cqZgH43Bb640Ne3BLSwh9iWut6BlqU5H+XNEYc3OU6jQdu0TYKz+65ATqVCcAcUyRjCR OzZEYOyu5fhRDRC6lFtGzOpZThKEyp7lgSPEHCnYTJM0HoPo1hLKnBiEyUZ3kIoKF+rR CO1Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bitJDir8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33805-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33805-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. [147.75.199.223]) by mx.google.com with ESMTPS id d11-20020a0ce44b000000b006819be5e0a4si6011545qvm.418.2024.01.22.10.04.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:04:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33805-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bitJDir8; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33805-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33805-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 822BC1C29A19 for ; Mon, 22 Jan 2024 18:02:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FA9661674; Mon, 22 Jan 2024 17:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bitJDir8" 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 3F907612D3 for ; Mon, 22 Jan 2024 17:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944288; cv=none; b=riURiWCrSHX4wkj6yg6/uKqs2hwhkcqvk0UVbSHGCabN13AUnvhUU5jEAt4vWCcJtC4+U9H+jCqefv+nIlB1tSjiuG7us18zOiq3R6/myEsuNp5ixXBT1flMf7QDQUS8qTrZw6d0eBKujIM6o+iq/os06YZB109JOlodWOtHyIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944288; c=relaxed/simple; bh=zKxNl6WkG8B4Eq9wfZgbuUODUlpOt/Exm0CtlwBwjts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HTt0QEPnt3nthhDIq3yTzLUjICDf/IoI62DTukYmqvU3VfPpzG+enzIzftD7qgWGX7II0kpOoHwAshVMzXER5atxpBc5DKIDHAhJsMAkdl58z+hDW6qysqE/nM0NefF6wzsgs9jV6ddIGUqJeZ+KUQ79+733k8rrkXUA2Nx3YKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bitJDir8; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944286; 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=n3rKjJ1dBHRScMpZN00CyaIUSPfncYm2oVF6llIbVjU=; b=bitJDir8X5JvhmCHOf230WvB3Ws8GctoQtcsHUHA6BvM2USiAaKyWF4uaRy5WvfoL+oU5Q oRfIJW1jlJE5T3CorvAv20Y2XtUF+e4qA9lzT99QeI0xfLj4RtoM9uF3HOy6yv8Is1Y36A hILybJgL4Pf46+xhoUWvyOHcoYcpWU0= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-0E2YbUvUP1iIrW24KfurYA-1; Mon, 22 Jan 2024 12:24:43 -0500 X-MC-Unique: 0E2YbUvUP1iIrW24KfurYA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-429a1d383c3so53850481cf.1 for ; Mon, 22 Jan 2024 09:24:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944279; x=1706549079; 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=n3rKjJ1dBHRScMpZN00CyaIUSPfncYm2oVF6llIbVjU=; b=f9x0I/l0mEnaMrJ0arpyyAnRiXqyNLkWS2tggnUr8dxTU0+eb2tEwTyQ0yVDys8jnf AjCTZv6vHV8908b4EdRBuUJCiRFRgwVvUBSQmNHkAr+lV05RfMiBQYevIWpVzijvqh3e s2zorQnXGpLFv0rwGCcCUPRwSvTnEd0tCD414gmL5Dv5Ix5nDZKM9SUOJA8RuP2pTGkD OEHWwYoziFm6aZ29tFu7QvaRiofWwbGCmHj3+jCcG3bQuHPhC/bL/xkoeW/hE8ANHB9C wWB9QL+UmQoYZ01hrwREYjPPMfz7vwBpZJ1E0N5ZFD5oq+GjO5FlQS8NYtOiirHZjYw6 HX4A== X-Gm-Message-State: AOJu0YwYQP5+mDDztC8JAFXOkPqCpVP6gz7igIVMD62mQR+9DWXmOlKy 89H+3mUmhruag5vaO/jFK8xTOYXq6hpcaSjxoYFa0GXuDzSbqr/zYvgNT7XBTS40Kng2MWfmJrH sapxik9jUp2+6pbnZSruLftvGvx7NwxaORBFEZKm4i6t9xKWxxSsVhJ6HHAlYaw== X-Received: by 2002:a05:622a:1347:b0:42a:48e6:3d1d with SMTP id w7-20020a05622a134700b0042a48e63d1dmr681135qtk.8.1705944279385; Mon, 22 Jan 2024 09:24:39 -0800 (PST) X-Received: by 2002:a05:622a:1347:b0:42a:48e6:3d1d with SMTP id w7-20020a05622a134700b0042a48e63d1dmr681119qtk.8.1705944279021; Mon, 22 Jan 2024 09:24:39 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:24:38 -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 v4 07/11] scsi: ufs: core: Perform read back after writing UTP_TASK_REQ_LIST_BASE_H Date: Mon, 22 Jan 2024 11:24:03 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-7-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788814757743278819 X-GMAIL-MSGID: 1788814757743278819 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") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 029d017fc1b6..e2e6002fe46a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10347,7 +10347,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 Mon Jan 22 17:24:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2748938dyb; Mon, 22 Jan 2024 10:14:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEj48mHs74vzJfnXqRstgQ8oGDbDIWQRnvFfQnmHNJ3VhS/Vs775OP1KK429BZYRsZBw1kg X-Received: by 2002:a17:902:a50b:b0:1d5:afad:26a0 with SMTP id s11-20020a170902a50b00b001d5afad26a0mr1777991plq.93.1705947240478; Mon, 22 Jan 2024 10:14:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705947240; cv=pass; d=google.com; s=arc-20160816; b=R6T3NtNh3jeG7c53JI5VgwbJB1RP38dEX9r9wSNw5ZbcMCwu67O0Ksa8sTcxm2xc7s Nw9Shf180/1ZoXYE4WirrEGd6lfXD2NltGk8823EhMGK+w2xClro6l5sSXVAdFmF9HHp CGpifsO1VUo2CYbQMYXe6GNh3YDx+tYSOm300fuZFZO5yGaWBiy3tnpXCeMFcNufWTwu JQ4kSJpG65guLOWjpxAYJ258806HM1KL4YOlNp+6DsuhkZLPlH3F3IR7mxz71HOzU7eG DqwofoeB9eJOGog5r345Tkx5Bly/nOaMLVxlIbVtYxx5JMPpKBEU7hu12Llxx71BB9yy by6g== ARC-Message-Signature: i=2; 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=Jvd6d1nUhV9LrU5f+xXncvSCqH2blthYX1l8ESnZEkg=; fh=sZjr1X209RpV6CW6bF47/guNu/E4ZUOEtACd37gRznE=; b=bYIjJSYIsm84BsZXS0az6jFEuVGnaCT9Yj8o3lhCu/QZ0Ppaau6bRPkC60avOIZEDB yuQrcq87uK18wo3rlin4fizVR2z7ok6joIuxOl3y7hLCPXwFBGD+RmTcA06rOhqhaJ3L n1n8QqzF7WhFHqe/sFVCk3ziUfLHkmmAz7Wr2X1xiG5Qt+snWGL95eDzXfiiUed6K2UR MiO/5/+DDcEYffZzRO0pu6ao0ctGfPWKZ7kXV+w+ZA9IRzmTN2IjwmM25Zw5sdlH9yuP iBrJXnxKAoW4H71S5SNOwSPdNkGqquQPxFZCQezRGQih2D3VNyyJS+DtAtrhdMcC1zjn GcvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TuODnOtj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33811-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k17-20020a170902c41100b001d51f3acb68si8608404plk.280.2024.01.22.10.14.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:14:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TuODnOtj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33811-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 8D392290EAD for ; Mon, 22 Jan 2024 18:04:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C460663128; Mon, 22 Jan 2024 17:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TuODnOtj" 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 A1E6C62A1B for ; Mon, 22 Jan 2024 17:25:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944340; cv=none; b=gJB5vATDPuzJqRNU2FfemxH0zl/5rNukYYL0+YbnswkCIQzV9BTFlnOe7xbDYpjXfSglV4BmUq0w3u+3LPOnt6wncvqg7Me79CseC5hGsF/mTJMzQGNCiorwV0d/u/F4V/75Vklewe+RoNVAu7/biL9ihPzo9pyxFPuzWUxL3P4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944340; c=relaxed/simple; bh=W4mJLP2iaxCUp7jWQvTVdyu+M70cTTTVM83ZPvkZy40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DX7qG71he/Di7IhXW9aTmUEnzTe3Gxfr8ZxDiPb4ihFloFHm8TIKhndsyiBbm8LK9x5YnT2+f2/RhEtMO+wZGuWfPYIyzwzBa91QhbpjQTkBVSPqChDkgVb77pPGZc5XQap6Jb1lY1GCZ0TI11kNbzH/SKTXjfSqRFs4W39VBPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TuODnOtj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944337; 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=Jvd6d1nUhV9LrU5f+xXncvSCqH2blthYX1l8ESnZEkg=; b=TuODnOtjCTi+AEZli7hF78l0Y6RJcAD+KjqBiqhv3UQfK2YmFw4Oicmmy2I0DvPnEyHT5f hnBVNG2Vg1m9HgCoEyqqphbJBc4DW8DfnhOuNu4wBGnNmleqAA1JD8/2c1p4Sj6ue7Hasi ygEl8LXjQVJcDjZRIQ5+jpNzW5islrI= 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-324-JxYtus6YN5CcpEvL9Y6N1Q-1; Mon, 22 Jan 2024 12:25:35 -0500 X-MC-Unique: JxYtus6YN5CcpEvL9Y6N1Q-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-781d8e14fd8so532084285a.3 for ; Mon, 22 Jan 2024 09:25:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944315; x=1706549115; 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=Jvd6d1nUhV9LrU5f+xXncvSCqH2blthYX1l8ESnZEkg=; b=ktba5ZMfrL8EH8gQ2GwP7TJrDsARKGsBqfWqa4p3982NL4Ok2ABoZcfpOOul492KGS fi68qu8YosJi5TjbrnMezre+hGxRbk8zT+91kv6ApHIdU9MQEowQC9eZfDLwn0Z+WuJb nk8Ww3IZZBi62Smh1tO8x92ZiCP+FJuX6gRXjHKIyHUa+S+6Nresiwn8mGeVMefFqsM5 3o0hztwgx80EPT+SX8rqNhqdpOkY+oZF8Lyb7uSbKp1BJvN2aaH7rmtx8bOAXaq6DXlL +vwp/nEvmysVWet9OUZWIsrfOygt09DExfkX9vGS7lb1czry6ieolGlgTCHnj4cVESUn NqJw== X-Gm-Message-State: AOJu0YzDG+iUoFztxJgSZftqOSozcHeT4YbwtjOo5aLDKRc0a8oiSDWX b4iA/4+7Ly2jOBOyHHCSitwmZpi3ssysOcb+O5OsBaagCmBRjM/MqNczSRpuKaz4A+r/7jK31JJ bpA8mYh4UGJ7uCIx7NrjgmAo/mD1lTyuTC5cBhyJmJ/hcH3hh1WvlEW/UnVMb/A== X-Received: by 2002:a05:620a:8212:b0:783:375d:452c with SMTP id ow18-20020a05620a821200b00783375d452cmr5390428qkn.33.1705944314858; Mon, 22 Jan 2024 09:25:14 -0800 (PST) X-Received: by 2002:a05:620a:8212:b0:783:375d:452c with SMTP id ow18-20020a05620a821200b00783375d452cmr5390410qkn.33.1705944314547; Mon, 22 Jan 2024 09:25:14 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:25:14 -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 v4 08/11] scsi: ufs: core: Perform read back after disabling interrupts Date: Mon, 22 Jan 2024 11:24:04 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-8-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788815333764722740 X-GMAIL-MSGID: 1788815333764722740 Currently, interrupts are cleared and disabled prior to registering the interrupt. An mb() is used to complete the clear/disable writes before the interrupt is registered. mb() ensure that the write completes, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring these bits have taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 Let's do that to ensure these bits hit the device. Because the mb()'s purpose wasn't to add extra ordering (on top of the ordering guaranteed by writel()/readl()), it can safely be removed. Fixes: 199ef13cac7d ("scsi: ufs: avoid spurious UFS host controller interrupts") Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index e2e6002fe46a..9b6355555897 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10564,7 +10564,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 Mon Jan 22 17:24:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2748665dyb; Mon, 22 Jan 2024 10:13:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1at2YYF6XF4IPAb03Ou9ixi7a8kNjG9ezyvyMplMcF6088GtHnzNlwuBjx0qaUWbAxtGR X-Received: by 2002:a05:6512:62:b0:50e:9e5b:497 with SMTP id i2-20020a056512006200b0050e9e5b0497mr1557281lfo.137.1705947212145; Mon, 22 Jan 2024 10:13:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705947212; cv=pass; d=google.com; s=arc-20160816; b=RlRixSaxhF8Y1vNIteMDPDiZZMIS/Afi5uvAm+fxNSFWnoVKE1u0DNnd25IjTceqQP qhY4RKuSK+tE9300ICfvgV7wGzCTfw0GZ5llNazvUVGrKBJuMSpY9ptH0KZyH+kUfkoB gtd6m85DgAB7vIuHvUHlK7K/hPFssZxSvg7shuVp/aVyamQPMnPawotyfMoTuLmm2EQ5 j1MflcAAxriTP3ftO26/c1zk31G3gGEx7XH+fyQvb/7UWQBLqm9KwHpTVaslbDdkeSZU IwIM1P3pQQ5onb0MbDlC8ImSIFMzki4eVvK9+/hbmYE8xilflHrfiwJtTgR/ySopevrg Is1Q== ARC-Message-Signature: i=2; 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=v9E8LP/sXchUxMDynkpMldI5w3cNLtCQjxmXDj4qu+Y=; fh=sZjr1X209RpV6CW6bF47/guNu/E4ZUOEtACd37gRznE=; b=KWaVG6uDMiIf/R8fftwppN1fi4iCrxh/h6qYQ/JL9HP9PNcUrveU5cJXwrqlGXoAga D3tuqIqIuo82qZblbuFGbkqsol1nFTBtYZkyEc8gSUNlGPt4Gu1vqSxgx4Db5sY69H/G Zbd4kX//5SCosVF+j1W5ENu2KHo3J0AEqT6Sm4e9EMvel17LEkFcFf/j2IWU2gc51Yvi W/lTgTYSFzHthguA6hnlBqy/dKSMenffpl4Lp+qZ7DDPKG30Bb8HYVTMDJloZZIB4ZuI xrNiJiC4/oPvJ1bfo8SOVX9eiCvqt82ycygbh1unFYJik3RjWZJjpihPX3HS/X/d/eIp ZHgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cbWfcELD; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33808-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33808-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 i26-20020a170906251a00b00a2af3048ed1si10896317ejb.873.2024.01.22.10.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:13:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33808-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=cbWfcELD; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33808-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33808-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 E0BE31F2FB64 for ; Mon, 22 Jan 2024 18:03:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E368629ED; Mon, 22 Jan 2024 17:25:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cbWfcELD" 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 4525E62804 for ; Mon, 22 Jan 2024 17:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944331; cv=none; b=el41+yNWQder4+dGfNOKYD7vL46tltuEA1fHl5N5rQqZGEZGMm17x1iKoeqH3ruREl9lVi/7MFRcP9Y1eX9x4/FoVhIZ/DWLaHpVGt4BeYcOTGClWwIdQgFscbW527Qkqusty3b3yjKOZm74An24NSBudYfOTx9NpqsDiLHkQik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944331; c=relaxed/simple; bh=eqU9bnJJL8L6334KQv0i2/sTryAarZX2XDro3a1bVTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ttWeroKZFlq7eI1gFgogSDAPsYcpDzqWT/+9IjQff5AjdnIupjC2MlqAMhXSjgt/GsMJzJYBkGB9+IaHbfAJufVx3/XflbXggL4Tczss+V8HXNCWYjMjU/ViT/iUx7JH759lENDEzJQrXJSqVUpR0YgNksecSWeOcptVwk8T8EQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cbWfcELD; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944324; 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=v9E8LP/sXchUxMDynkpMldI5w3cNLtCQjxmXDj4qu+Y=; b=cbWfcELDfp2bs0f1f6+LR/6H3MK/P0VRX1dUUsRIjkLCdjdGuYrSQzQ6RXJOA/aoiJU/QK EXVuG5SaVMx/CrF0s3NtpSXuimMjISdaS2Ctb1U9QBZILG1eyG1bYVgDs5ZW4FxkW/+ruc cV4dy1iaDsUleGUN2N7/2RMlUJ+YucM= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-XObZFEpTNLKs0an3hYqgQw-1; Mon, 22 Jan 2024 12:25:23 -0500 X-MC-Unique: XObZFEpTNLKs0an3hYqgQw-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-42793cd9d33so51642681cf.2 for ; Mon, 22 Jan 2024 09:25:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944320; x=1706549120; 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=v9E8LP/sXchUxMDynkpMldI5w3cNLtCQjxmXDj4qu+Y=; b=iL4G5SdCmlZ/3l9huXpCbAyhVUM0QxrpCz4Ef1ER+znF8w5hHEaIcs39gRx+ysyrJR KfAQQJDU3h78c1BQjDLVNlRcZORQ1u6u6Ewl5fVu81prFHtX+COYvrDGj7rxEp6isH8n VkXYEY1eU4ia47Bg6bFBCbhELjmgiF1RNaK3yR4f50jDOOZthwfAisC32NtLbbSY4zyZ G2SVU328GIzV41TYvbfvq8rh0tj//xrhDG+J+oRjJyLguiFs+07Y2m8LydEQxhDep5Cz GWeeR5v/S2F5ZPdVgdhWuR/wr0Zd0TvL1/4Wv9POQdipmXFTORloOoVnM5FtcUiJ4KSh 8Hdw== X-Gm-Message-State: AOJu0YxRustR3t1shLN0d9cCy7XuavhnUwVEpESAykpDP9pAL7B3wN9v Hx6tGmq3mXGPPWm8iGewm3bfa4WC60LdasqChI4kyEMDqOwZyjU1mYvE/OtcBeWNa1nrhQOlWXQ Y3xT6wGdU85wWx9qWveCDpXxWlbzIVUafu7Z8MJRLwoSwwkrWb10iVze03turzQ== X-Received: by 2002:ac8:5c06:0:b0:42a:2be8:37f8 with SMTP id i6-20020ac85c06000000b0042a2be837f8mr7667936qti.46.1705944319785; Mon, 22 Jan 2024 09:25:19 -0800 (PST) X-Received: by 2002:ac8:5c06:0:b0:42a:2be8:37f8 with SMTP id i6-20020ac85c06000000b0042a2be837f8mr7667911qti.46.1705944319483; Mon, 22 Jan 2024 09:25:19 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:25:17 -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 v4 09/11] scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL Date: Mon, 22 Jan 2024 11:24:05 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-9-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788815303703995729 X-GMAIL-MSGID: 1788815303703995729 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") Reviewed-by: Bart Van Assche Reviewed-by: Can Guo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9b6355555897..9bf490bb8eed 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 Mon Jan 22 17:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2748753dyb; Mon, 22 Jan 2024 10:13:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFg2W/FH172T/tRO+Dr4XrFH7l7AnubKKH1ZZ608hMGv1uTzgWPU3ebumfhN9RbH/wUjdI5 X-Received: by 2002:aa7:8e84:0:b0:6db:97ef:2255 with SMTP id a4-20020aa78e84000000b006db97ef2255mr2058673pfr.27.1705947222614; Mon, 22 Jan 2024 10:13:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705947222; cv=pass; d=google.com; s=arc-20160816; b=j9vn0PagHNSw6f8grEUvmxBtGe0I5LHxsCBkbeLa9ffspiqdB6utV1VdsXjh0JP/1w kvKOpG4VB7sOqTrtGFxKJa88QFB8zHqRlorVHA/iDeCSKR6esrcxEQT2f058fGMJLGiX UvDIRmh/vwZQKFeftNU0mPTxTXUyAPdnmtnGr6hFI5fyx/MAgCEjEt2lEaIqVdMLrtQL chZSyoiYDaYPjkOLU7TmlaiNOhcP0BLOZFC3BaUe6+jUKmasBukrqHreRiPjVIk913OC J6eNtK1wbwIsglhUGav3ank5sELDO2HT4HYsWwxDi7SLGCq2qipsqILmIELX5X2bYQCh uY9Q== ARC-Message-Signature: i=2; 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=rWSD/O3bKBCmQqSFNDTq3XZwC2CZzWCGf6aiHY6rT3c=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=sniVToYtrJHK87PBX/Kj4c0MAhHcJPGlTb3Rds8ss2P4uVf07bmjI3HbzdCoGV2Q94 mVKnZl1Za6r5KCajhLT/x8wBPaXpK69qNRAUUDs/I12o3ZjzzF50OWc+vIiH4vjQrT7U ddWHiL0S/YJ/RlPNYWBBktknD/cGMt/x6suh7UFXSS76MtTVtf0Ylss8hxSRjrWuPGtJ iqUXMq9yodJneQMPuECX+g9rKM8d9a4dZc9UOKTS74NDYRrb4DNRAfcCYSQCIeKi6Y8o H0TNYXnrkTBH/fBH7CBb9ZvLwrcK/m0F3KchNKOOiiFMUASgO5M0VOYo17qz+xBjYQ0d mXAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WUTtXlL0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33809-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33809-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fh10-20020a056a00390a00b006db896af13fsi11028289pfb.174.2024.01.22.10.13.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:13:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33809-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WUTtXlL0; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33809-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33809-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 4F7D02909A2 for ; Mon, 22 Jan 2024 18:03:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C935062A04; Mon, 22 Jan 2024 17:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WUTtXlL0" 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 E543E5579A for ; Mon, 22 Jan 2024 17:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944333; cv=none; b=czyhm0NZXJNje4Piywployro2GKmbDDVNflMBbw/+6FV1HISAmc/wiGblXmaXt8rA6ocswWzOQHS8CZqDLdbUJRsT4VBpIdjd9U/WPwgCJ5DNrLCDBDh7uyxmGztJ6DGw2lAlTuWmTOl74eLtlZIJ8GNFyDDurZ8T1PdksmSy7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944333; c=relaxed/simple; bh=MER45LHvwiXQD+ULDnSvsVxwXZ1b2Z5xk98z1OKFCA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HslToyDLpVOqYbNF/xltvHRtam7o1Nyah1TPKM0x0usx0uwWb09suw0ZOmWfkxwQHMQct4Z5Im+xYBJJUH050gd3QDTkWmoPD9b/fbtKGscxkTCTEqEcaJ2w4HdfOC/0HL/bCh8c/s7hZ37VRQS111WftqWQWC+lR7U/iwIzy1c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WUTtXlL0; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944329; 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=rWSD/O3bKBCmQqSFNDTq3XZwC2CZzWCGf6aiHY6rT3c=; b=WUTtXlL0vFyi3Hn4WjZEZnZ79liCysFF1Bzx27qN9f+jWyp1F66+qofaiP+cmr4p44cVPu /g/cEV78g4pLFZDFt+pDGtYAwlk7vRv1+IAJ+IxR9D/sVo29LfaNKtr/SoKs22S0vmQBki O8yKJLcsB6p/m0qObNomzO0SapvGIq8= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-235-e4xl3UFJOWCVZFPfg7H4rA-1; Mon, 22 Jan 2024 12:25:28 -0500 X-MC-Unique: e4xl3UFJOWCVZFPfg7H4rA-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-42987be5d14so51522901cf.1 for ; Mon, 22 Jan 2024 09:25:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944325; x=1706549125; 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=rWSD/O3bKBCmQqSFNDTq3XZwC2CZzWCGf6aiHY6rT3c=; b=c5qXmRc4LiMR3Y+3Q0alatRa9JNf3Iu6NNHZE0fON3JVp+AjdiFbTe4R4AuHS5ttkK EfTPtRGII0b5mBZnvMzsI3Ugt9+0l+dxORQ+9BbZQlS1iXfHEbgPY4WtnRp8kYQH8vKn 4wKbUwZ3xm1WfFPDps7UqmFTrGFq4gf0HOEYZ6LuIPcsnOVL+538Nl3H2bDQsFrFn97M B8lzkhRXh0kOYu3H3R6icdEF4AMMH3sUQRlS48+qGwdhKtUqgaSs1wzzG3TVrrExSEoJ 1HF/H+vn7ZRAHhYNvvDNj55Yb7hDk+WuWaJs5OKfnRoDWEMRnKCn/7RXoKTtMnvoBBw7 exwg== X-Gm-Message-State: AOJu0YyLH5QW4Ygh4XOwljJRYR++170/FxPkCSpHL9t10T6YAyNfqm/o 2GSB8UUsEBG5Q0sU1MrjFH1SJHn4WWARE270I2ia5Ff+f6AiRI/pR349qihkVFVuTGpCJu/O1US Xj99cJk2IHpHAB1qdk2UJaxqoYXEHsTuNmExrEwEEOLbNtq6346Jg9H667iGt3A== X-Received: by 2002:a05:622a:153:b0:429:bfe8:7cbf with SMTP id v19-20020a05622a015300b00429bfe87cbfmr5989896qtw.61.1705944325632; Mon, 22 Jan 2024 09:25:25 -0800 (PST) X-Received: by 2002:a05:622a:153:b0:429:bfe8:7cbf with SMTP id v19-20020a05622a015300b00429bfe87cbfmr5989887qtw.61.1705944325372; Mon, 22 Jan 2024 09:25:25 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:25:25 -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 v4 10/11] scsi: ufs: core: Remove unnecessary wmb() after ringing doorbell Date: Mon, 22 Jan 2024 11:24:06 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-10-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788815315067447909 X-GMAIL-MSGID: 1788815315067447909 Currently, the doorbell is written to and a wmb() is used to commit it immediately. wmb() ensures that the write completes before following writes occur, but completion doesn't mean that it isn't stored in a buffer somewhere. The recommendation for ensuring this bit has taken effect on the device is to perform a read back to force it to make it all the way to the device. This is documented in device-io.rst and a talk by Will Deacon on this can be seen over here: https://youtu.be/i6DayghhA8Q?si=MiyxB5cKJXSaoc01&t=1678 But, completion and taking effect aren't necessary to guarantee here. There's already other examples of the doorbell being rung that don't do this. The writel() of the doorbell guarantees prior writes by this thread (to the request being setup for example) complete prior to the ringing of the doorbell, and the following wait_for_completion_io_timeout() doesn't require any special memory barriers either. With that in mind, just remove the wmb() altogether here. Fixes: ad1a1b9cd67a ("scsi: ufs: commit descriptors before setting the doorbell") Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) -- 2.43.0 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9bf490bb8eed..21f93d8e5818 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -7047,10 +7047,7 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba, /* send command to the controller */ __set_bit(task_tag, &hba->outstanding_tasks); - ufshcd_writel(hba, 1 << task_tag, REG_UTP_TASK_REQ_DOOR_BELL); - /* Make sure that doorbell is committed immediately */ - wmb(); spin_unlock_irqrestore(host->host_lock, flags); From patchwork Mon Jan 22 17:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 190276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2742407dyb; Mon, 22 Jan 2024 10:04:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2H0DBI8ij9iUN5O73P0rsQh8qWDY8zDofOdNXs4CUSW1KyRRJtsUUcN6cbPkrH1j73qQp X-Received: by 2002:a05:6402:3139:b0:559:eb14:37c7 with SMTP id dd25-20020a056402313900b00559eb1437c7mr161006edb.76.1705946688286; Mon, 22 Jan 2024 10:04:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705946688; cv=pass; d=google.com; s=arc-20160816; b=XP/yTbARmr9gwEAfTlg4FwyaD+ZyvzYhYKktkoCGuMvcsvoyVtWZEf5pg3Wy0RuWhC qP9gQs5FgnlLWuF/qJrr9rNwyDBy9AjuR2ZNQET3ZJxLFX56S/BamhvJxaIQnyQjdHBP P43gKrDskIk1KTefR0nytDPNXlpZWbg6n2X2v5bQy/ri3Gu6zaLUWzXNJraKf0oI1Kh7 4PJL/+eQVLViArtx7i8H2sp8FD9OOT4XJQEJlf9STugNxa2cVkyjbFK11fEIik8Klira nzbZVJxPD2k4cTLF+ZltJblJaO7Am5Jv4nul3ZDucyjJ5Bv5x8lJd/8oTSm4ons/90GX yX3w== ARC-Message-Signature: i=2; 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=xvA2uv2JUZrdT2MKiipHpiF6tbdfVobWEO3O5fZ7MOA=; fh=1ZbOLymucMpHPgAW6Ec0PFi2ApL0mTrRg5dRvTVPo8g=; b=HbMySuNnF5GCWmMemPofJgbWjCEbOcNuAop+rAvFUxD8i7K131rb7YvG6Ke8ST8Qof fnvY/CFZSfAlgq+fAMxI+I/KmUWsg2p1N5F8CCTWRsJfO/74lzwfDXW9bh3SskOGPHsd ZINY2WxvPg8DZsP4IOnQ6JFxRdz8bkn9ajXLGSaGqu1TWyJh7OJH9PSSy1QPIFAlg9RR 8UtmTvxuf6otxgaDt1nF74/we28PgN0HK5Z3jMitbCNEuc10p+ufu5U/iinJZ0THjJeU MoYRGWKY4ZQV2yxRotvlTG7AYpirZr5t4xBoVFcNpG0IbER0YsNKx498+sjhfR1LpGo8 2a5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NiJFdtad; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33812-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 et15-20020a056402378f00b005596712d498si8074288edb.70.2024.01.22.10.04.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:04:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33812-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=NiJFdtad; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-33812-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33812-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 E22C91F30274 for ; Mon, 22 Jan 2024 18:04:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 416AF633EB; Mon, 22 Jan 2024 17:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NiJFdtad" 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 1BE336311D for ; Mon, 22 Jan 2024 17:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944343; cv=none; b=Y7ea48qrRCU4e/Tw7Vp5r/XVo31pNcbjSb/YlLp6IAZU/rUvnM7jWCjAetTWusM3NvHHgxVkOV7hMRwB29rFe2vDR+1+QuoX395PTL3nqO9TCdep8YZzUvR3u/zjHXs6HStp5J3oE+8tZnHbcDY5PFHSGpleTocHy8T8ngnfefk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705944343; c=relaxed/simple; bh=lrt06U9MjfT0+aAqB1+xoJHCrTf+UY09+oCiHhhT3Fc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aMJox8Ke/1A4TX99+Av6XZYpyBCXF3Szm+Xry9mZV/WJDpy40H68O6aMnIopoP8g2/NLoU8ib/9AY6e+ZZMEhoqyl8qvHlzgAE36XjAUuC8IovIXNvQYmrYK+1cdDmEiRwewTW05aBqCpvIl6G71ObtqK8qwMqmYVsOqhZlDVlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NiJFdtad; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705944340; 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=xvA2uv2JUZrdT2MKiipHpiF6tbdfVobWEO3O5fZ7MOA=; b=NiJFdtadtsWkArX3ayAncZ40S/JUERmz1qvDg5ab1wMNKh37ejImxFQ9pGY5mtPXvMd2Wz 4158UowfHMQ/G1FXaXugpf4X30dJiN08ABoqzSRzmVSb831FPj9yiFJt5uyHbGQmBm1Pyc 7d0gv4txrYRFfG+Kj3h5jieVdZkOPdY= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-30-rh2gyoGSNWKc9lqTtPT1_Q-1; Mon, 22 Jan 2024 12:25:39 -0500 X-MC-Unique: rh2gyoGSNWKc9lqTtPT1_Q-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-429d0905823so63476991cf.0 for ; Mon, 22 Jan 2024 09:25:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705944337; x=1706549137; 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=xvA2uv2JUZrdT2MKiipHpiF6tbdfVobWEO3O5fZ7MOA=; b=hCz1sFeqIsedWds8MpMI5xyf63oljYi2k31Rc18sDWt4rtyGAVfSXofagxMcBRUx7X /7AZQ9noG+UIBjCXb3uwMPKAriG0rrJ+mzzEtIjF9b+YS832EigTNHn9JqC+1gss1ZLV hPXoH74VGWg3ekGjmT9w4v/VYY/qDyGAInaGuwdbNzosuWDL+Jt0Zr581LVuogXvx2qy 9wUM+66bxhsJhbyZ737bsBfMN8WbE/pDArHCtRDMVWL+h4KVNrND8e5skeNQEJirw9cp ihFnJyfCTqsA009wg1sLyCjgwFw29kQ3H7A+dUADteP0LDZ4YkHV/NFubIYtarP3qi/K Stag== X-Gm-Message-State: AOJu0YxUm77Bs177CdlCjTIdOzKU/pImkN3cKJOslAYc6bX8AmBLi3kR JS1mC+Eej1gxmL3muBHQ80ZJL5nK7EsbLm8x6iiP/W6tWlB0syxcGsERgVuFIyhfahQ8A4ZBFrp kmOR80z87kuS45xzenTSuqCRpLZwlDMk081L3yXgeswR71/+hDvSZs2Hdb3m7trItLjeKhQ== X-Received: by 2002:ac8:4c8c:0:b0:42a:2666:a410 with SMTP id j12-20020ac84c8c000000b0042a2666a410mr5552768qtv.63.1705944336847; Mon, 22 Jan 2024 09:25:36 -0800 (PST) X-Received: by 2002:ac8:4c8c:0:b0:42a:2666:a410 with SMTP id j12-20020ac84c8c000000b0042a2666a410mr5552733qtv.63.1705944336119; Mon, 22 Jan 2024 09:25:36 -0800 (PST) Received: from fedora.redhat.com ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id c7-20020a05620a200700b00781ae860c31sm2280992qka.70.2024.01.22.09.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:25:35 -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 v4 11/11] scsi: ufs: core: Remove unnecessary wmb() prior to writing run/stop regs Date: Mon, 22 Jan 2024 11:24:07 -0600 Message-ID: <20240122-ufs-reset-ensure-effect-before-delay-v4-11-90a54c832508@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@redhat.com> References: <20240122-ufs-reset-ensure-effect-before-delay-v4-0-90a54c832508@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: 1788814754449718049 X-GMAIL-MSGID: 1788814754449718049 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 But, none of that is necessary here. All of the writel()/readl()'s here are to the same endpoint, so they will be ordered. There's no subsequent delay() etc that requires it to have taken effect already, so no readback is necessary here. For that reason just drop the wmb() altogether. Fixes: 897efe628d7e ("scsi: ufs: add missing memory barriers") Signed-off-by: Andrew Halaney --- drivers/ufs/core/ufshcd.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.43.0 diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 21f93d8e5818..358857ea9ff6 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4722,12 +4722,6 @@ int ufshcd_make_hba_operational(struct ufs_hba *hba) ufshcd_writel(hba, upper_32_bits(hba->utmrdl_dma_addr), REG_UTP_TASK_REQ_LIST_BASE_H); - /* - * Make sure base address and interrupt setup are updated before - * enabling the run/stop registers below. - */ - wmb(); - /* * UCRDY, UTMRLDY and UTRLRDY bits must be 1 */