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(); } /*