Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1213827pxk; Sat, 12 Sep 2020 15:58:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGh/2zgVFpDu2+C/ig1DgwUm7SaJD3BlDpMewKyZi1jDBpVMkTKuA3inaTVJ0+EJk4PL4r X-Received: by 2002:a50:fd0a:: with SMTP id i10mr10105483eds.277.1599951510457; Sat, 12 Sep 2020 15:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599951510; cv=none; d=google.com; s=arc-20160816; b=A6tv0XP28U+pxuPOWso9sZu8vA0F/VMpqADKrN3GPAJbaN3QIpO7N7K8DptCOi/lop CRg53V21u1tg2NQnsLBXtjxIDfBBc1R9Fo27Jz1Gpof8EUjDQye3yKfBaRE9YT81ZAVg tA81+mATb9/EOhgXJdmFHF7FB9TS6kPhgqnWmFOY19Fy36BlaZO+sj6T+Wn1mtq92DcH cB+4q+W/DsGndfAqQlQwuH++M3QR1naYE6DDjC1IYWs34zPqJ3pBn7IlgAW6asVITAES gte2FES3EUNM07cqo6NTpYIMMAWPHZ9BxtVwJwiQOcK8cFxS8PoGdr7QZQm5bguL5RI+ hF+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OMKklbN2lN6kWblqLp/KhqeIKTNslngE7aod6/EqkYU=; b=WbzZZEYWK23m4pgtxZYJl++zatdWppYMMDHyKb8fCggeGVqmx6U/S5OgFSVYlTMYM4 k0F8QEX/30OnRru75MzTIX70o1dh2rTHXwwp7pypMfj8I/lngPdRjZbJJik6YsahdJab IX9OI70XVjgURhLKao5TA3WEaRpywpLYmRNrlSau/GHmyBtdVY+hvnV0KuP9xc9Ngmkq 0MWytmKrbVcTK58mV7rf7zFl5sTnvv22V0vVICTkRaJAhzl1TgJjGX4stxHaufDB6ZGf JVi4wgl8LpFyXE4CV3GYcWy8h81eyWAObXYrXNyFlBT1UjyoV0+WEqZUGk2fiQIJwG6i 1RNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BXnhs5Cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si4256507ejg.470.2020.09.12.15.58.08; Sat, 12 Sep 2020 15:58:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BXnhs5Cg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725920AbgILWyt (ORCPT + 99 others); Sat, 12 Sep 2020 18:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbgILWyq (ORCPT ); Sat, 12 Sep 2020 18:54:46 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50A1C061757 for ; Sat, 12 Sep 2020 15:54:45 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id e23so11535813otk.7 for ; Sat, 12 Sep 2020 15:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=OMKklbN2lN6kWblqLp/KhqeIKTNslngE7aod6/EqkYU=; b=BXnhs5CgD7Qi0bV003nPQQzi2g0RSJU+U1mYiNoXq1BisWvFct3wAMcEHNd7RbyErm jdXkCPRMft+mhPfXMCRkzwF+yWYzRo4SYFh7Jz9jt+c82ek0sheOziLgDKz35okSoyyu zNZkMRdmmMUTl6OKS0XqDhrEz42U0Wg/SkX/TKIZD4voxNTrQoW9mjhilyZBWfvf6j3i q7xTIbDrrtvIbmtRKk/+N9R8tfVqq+7tToYSbt7eBvt3kLHzdvYRz1xg3KJmycIWRPeB PIeor2yVS4ZR8OJRgP1tIs+yhotJ5SJcA57eKcRdzqbnKE1nKigebdpkxAczI44p+730 O1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OMKklbN2lN6kWblqLp/KhqeIKTNslngE7aod6/EqkYU=; b=gLHUlEPzKxjkDCAKcniVWAFT6BVF2lAZzDKnhdTl2aXsZ/DNr1ezjfQB1C94RpK6Je 0aPr+ihWjJmSY3o42LZADwDktZP3Inw29VPLuCb9U78VkpBiYSc+KLT1W16topwOqxZe HC4Lx22psjkyyhqpC5YlX2AwAmJRSEzVDc51STrh3HZCYvmb/jipIJ+RuwXX6jNER6kU BX594DSsGm1pnco4fXbIfE3fSBwdx2yoUjgkpbNWZrHAY02FZ4+p2Qtz4IuLlxuDVgXZ cz/8imAqffeaENELRSPlwzHmBZevsy5cJWSnXCFeUmR8nZOJZC/8F6NPj+cPMnUiVX97 Jyqw== X-Gm-Message-State: AOAM530kurrYDu5Rdq8+/2/LpITbm81s9jFhkwv/V6AfIed1sVU8YQM1 xM38fJ+xv4SPzeYaPhl0yvKi9g== X-Received: by 2002:a9d:66d4:: with SMTP id t20mr4850145otm.133.1599951283767; Sat, 12 Sep 2020 15:54:43 -0700 (PDT) Received: from yoga ([2605:6000:e5cb:c100:8898:14ff:fe6d:34e]) by smtp.gmail.com with ESMTPSA id d26sm1025568otl.10.2020.09.12.15.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 15:54:43 -0700 (PDT) Date: Sat, 12 Sep 2020 17:54:40 -0500 From: Bjorn Andersson To: Douglas Anderson Cc: Mark Brown , Akash Asthana , swboyd@chromium.org, Andy Gross , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH 3/3] spi: spi-geni-qcom: Slightly optimize setup of bidirectional xfters Message-ID: <20200912225440.GB3715@yoga> References: <20200912140730.1.Ie67fa32009b94702d56232c064f1d89065ee8836@changeid> <20200912140730.3.Ided778fb4cd078e36c6b240d1b279cd7a534a313@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200912140730.3.Ided778fb4cd078e36c6b240d1b279cd7a534a313@changeid> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 12 Sep 16:08 CDT 2020, Douglas Anderson wrote: > When setting up a bidirectional transfer we need to program both the > TX and RX lengths. We don't need a memory barrier between those two > writes. Factor out the __iowmb() and use writel_relaxed(). This > saves a fraction of a microsecond of setup overhead on bidirectional > transfers. > > Signed-off-by: Douglas Anderson > --- > > drivers/spi/spi-geni-qcom.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c > index 92d88bf85a90..6c7e12b68bf0 100644 > --- a/drivers/spi/spi-geni-qcom.c > +++ b/drivers/spi/spi-geni-qcom.c > @@ -376,15 +376,22 @@ static void setup_fifo_xfer(struct spi_transfer *xfer, > len &= TRANS_LEN_MSK; > > mas->cur_xfer = xfer; > + > + /* > + * Factor out the __iowmb() so that we can use writel_relaxed() for > + * both writes below and thus only incur the overhead once even if > + * we execute both of them. > + */ How many passes through this function do we have to take before saving the amount of time it took me to read this comment? Reviewed-by: Bjorn Andersson Regards, Bjorn > + __iowmb(); > + > if (xfer->tx_buf) { > m_cmd |= SPI_TX_ONLY; > mas->tx_rem_bytes = xfer->len; > - writel(len, se->base + SE_SPI_TX_TRANS_LEN); > + writel_relaxed(len, se->base + SE_SPI_TX_TRANS_LEN); > } > - > if (xfer->rx_buf) { > m_cmd |= SPI_RX_ONLY; > - writel(len, se->base + SE_SPI_RX_TRANS_LEN); > + writel_relaxed(len, se->base + SE_SPI_RX_TRANS_LEN); > mas->rx_rem_bytes = xfer->len; > } > > -- > 2.28.0.618.gf4bc123cb7-goog >