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 */