Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp614511lqh; Thu, 28 Mar 2024 10:58:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXY0Kig7IIrXv9STUj+BiEt7P6EYneOrctAcKUQfRzB8czpQZBaNpFUAz8We3JuldQO1npzs45Ds+UGEx5WaVJRMAQm0YNMXhbUzMhWrg== X-Google-Smtp-Source: AGHT+IEzlgiHIXxekEf8m+L1gvlWlMwEJ0njgrkGjO1/9sjGME+SZP228wa9+EtMijb1/ncgG73D X-Received: by 2002:a17:906:7fd3:b0:a46:a28d:2f49 with SMTP id r19-20020a1709067fd300b00a46a28d2f49mr113982ejs.32.1711648706278; Thu, 28 Mar 2024 10:58:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711648706; cv=pass; d=google.com; s=arc-20160816; b=Mhfp2wKQgEBnINBRsjkaF6PHkW/vmKtcTcgfs6LMHbz4p9PiHt2EEDM4+zogAvnDNe pt1xn41hTx1bCV23gsIYc8w2rU1JfDQh6WNohJXQ1rUXQ48XwWbaKPSbcDIw8y0dfWWo cPvp90SyvGPyMvam6hjtv0FSZnaSTxUjBZaVzqJRSd9ELi1igv4GKhY9J/k9mXahjcka YoN1iZJB/8OIh0/1mFeOA2eidq9kIOA3rpnKsOu8TlLICAygMHFM5NNNfe5hn6tI9Eyd vW2cVCNFodMYUgBCkxOep91zBrC4/rtT2a+LTSZs15j+gSpm/kdyclSm7r1LbXF0xM90 eIDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IMB2JrEaXdtfR7K1jGqJIj8fJgUdIhDmgzuCsvn0h6Y=; fh=7VwbJojOPncj7hfLFOM74blM/tUN57vyLN7zAWzjNLw=; b=KdRjsj9tdsVrrnZtLohyYHphKOg7tsLF03TbaLcK2NHRjWIt4buN2I4MxrKuzMjlH3 QUxaf+zsi4VU8QAgA51VRBgC1Wq4gVCHhlWlhB83Z2Bu5zy5EMgD6ZLqwg7vNyg4oalx AEf/YVXFyxSy1M0o5Tt4n9gr/O6P+NMP5FY6DcKkOIMXvozdCA7kQZPMrlC0z/U1OegF r09oGtokIQn2w5mPFobguckgO9scbEjZQ4x64eiZo88nFU97qpkwkCjRxCEEvzt2Rss3 81FqBtnovCGULM7uwI/PrYVtQNr0KoHPtGih4Dg0/au6U1vikL9zloViXBq7w3nPqzUy 55fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Be/HF6uw"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-123390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i18-20020a1709061cd200b00a466b2951c7si923111ejh.981.2024.03.28.10.58.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123390-linux.lists.archive=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=@linaro.org header.s=google header.b="Be/HF6uw"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-123390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 C6C2B1F2504A for ; Thu, 28 Mar 2024 17:58:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D934D130E5E; Thu, 28 Mar 2024 17:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Be/HF6uw" Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C3E781726 for ; Thu, 28 Mar 2024 17:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711648701; cv=none; b=loQRlc6l3c6lDLsgvqfFGXW5fvFA02860oVZ9Xrw2fCG3+4a41O7Ff1ZRu2DEkU1OOuxb4e1/bqxcQQd0GeoA78K4sfNEgmhQJIHVyYmWXG2yxV0M4iPasjVM3/NaB19SJHB1oEgLBO+xu/phz8zhopqEBHCxtiAlhCJVZfw5qs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711648701; c=relaxed/simple; bh=VF9kw4WTAs6CxHwuSeD4k3v4iYoGGymRT9tDvNquKv0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nEEmcMFmbC3CjDuyjCxvnN2Xauqy7QdC3dnEjkRlJ03muVRcCjLy4EHefua5//R4hmT5filVmQiLoNFESOR8snhWeDi9Wb5qVLLKiYyDs8J5D6UrsFUxJW45vWDVEv8CNVOOSPsIwBUUEDOvfW7eRSi4AWdrij2wL8d7bhkbWNg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Be/HF6uw; arc=none smtp.client-ip=209.85.219.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-dc74435c428so1282096276.2 for ; Thu, 28 Mar 2024 10:58:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711648698; x=1712253498; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IMB2JrEaXdtfR7K1jGqJIj8fJgUdIhDmgzuCsvn0h6Y=; b=Be/HF6uwM1Qk3pOx8fJuRHzRY5ClpLb20uL2Dg4kATWnyV+QL0/t+XlKQNotZDn/Vt 2z/VAzxr9QzRvJWwG5pTY6nk/wNDVMM1v3J1+VW07gZRP50VjRtMmxbQ5F5WuJ82pH7X CQftllm3JdhTMqY/ADdBqN0o6UKTXaAbtdVzQ7R6k0eG05BFxCXxZ3LpfgYQPykzcnFJ l3syEz4ZAv1U47diPMQNvNKyUvfMwi0iv0cNNC2uaa/mkrQB/1X/ckmlbIvk18mLpWS6 6Lg+IL65lbm+WSuPXS9EfSujtxbK5Lx/NP5NTD61UzC+GnvyfMLyn3UhwEFCAt1mN0mt V5CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711648698; x=1712253498; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IMB2JrEaXdtfR7K1jGqJIj8fJgUdIhDmgzuCsvn0h6Y=; b=KUgVKC6LilkFqtAfEUW1k9+f6HqBiLbzFTQmZw2sVE58iNKCbcaUlruMy2aW86HXqn WvWEz8LsDTHswgLUX1uq0oh6MN7CK6BjVr/UWeN7oF5GaihjpnnacsKX/YtjfIjjSg8W LcgvOIDaD+20QpHY8m3LX9VBdaRA1zAt0iBipazxS7Sbd4mvKaYgZLOtTKGCWyF5dlyT c5QfhsxpMCW1kmVJroH7h5lmO10b3C5W711jCnlmwtE3pM7P7VE3DewSXdAHTk4TaaKN A+GDvUUBbG2UU3n2Vz4pu32YRWMcbZA5w7j2y7QzsPlpa23dCsQFcuZkWfrtmLy6L2BF a5iA== X-Forwarded-Encrypted: i=1; AJvYcCX1hCC4VgbJvvDRFcECuImUTPsnzL3lmp1xutT76Bawyl/6k/qNU8q062o9y01iN2D4xtPPOBBX/TLxlbXV6FQOo5gmc0lP4xYflQNW X-Gm-Message-State: AOJu0Yx1DZLZ5U44zSbaOW/ccgkwokMmHVWNxenS2kZ9yw+ozxRxhit1 fNw57CBb/lZkfgTR2dV7igEcyzJUlAjSHy/wh5te92nIIS93x6LB585/zpYLL29Uz1hCxNcvdQk O1hX8E62a2lNotu2evwu8+pu+0DgD1i8M8IkRGA== X-Received: by 2002:a25:70c5:0:b0:dcf:288e:21ca with SMTP id l188-20020a2570c5000000b00dcf288e21camr38551ybc.11.1711648698172; Thu, 28 Mar 2024 10:58:18 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240327033041.83625-1-jaewon02.kim@samsung.com> In-Reply-To: <20240327033041.83625-1-jaewon02.kim@samsung.com> From: Sam Protsenko Date: Thu, 28 Mar 2024 12:58:07 -0500 Message-ID: Subject: Re: [PATCH] spi: s3c64xx: Use DMA mode from fifo size To: Jaewon Kim Cc: Andi Shyti , Mark Brown , Krzysztof Kozlowski , Alim Akhtar , linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 26, 2024 at 10:35=E2=80=AFPM Jaewon Kim wrote: > > The SPI data size is smaller than FIFO, it operates in PIO mode, Spelling: "The" -> "If the" > and if it is larger than FIFO mode, DMA mode is selected. > > If the data size is the same as the FIFO size, it operates in PIO mode > and data is separated into two transfer. In order to prevent, Nit: "transfer" -> "transfers", "prevent" -> "prevent it" > DMA mode must be used from the case of FIFO and data size. > You probably mean this code (it occurs two times in the driver): xfer->len =3D fifo_len - 1; Can you please elaborate on why it's done this way? Why can't we just do "xfer->len =3D fifo_len" and use the whole FIFO for the transfer instead? I don't understand the necessity to split the transfer into two chunks if its size is of FIFO length -- wouldn't it fit into FIFO in that case? (I'm pretty sure this change is correct, just want to understand how exactly it works). > Fixes: 1ee806718d5e ("spi: s3c64xx: support interrupt based pio mode") Just wonder if that fixes some throughput regression, or something worse (like failed transfers when the transfer size is the same as FIFO size)? > Signed-off-by: Jaewon Kim > --- > drivers/spi/spi-s3c64xx.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c > index 9fcbe040cb2f..81ed5fddf83e 100644 > --- a/drivers/spi/spi-s3c64xx.c > +++ b/drivers/spi/spi-s3c64xx.c > @@ -430,7 +430,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller= *host, > struct s3c64xx_spi_driver_data *sdd =3D spi_controller_get_devdat= a(host); > > if (sdd->rx_dma.ch && sdd->tx_dma.ch) > - return xfer->len > sdd->fifo_depth; > + return xfer->len >=3D sdd->fifo_depth; > > return false; > } > @@ -826,11 +826,11 @@ static int s3c64xx_spi_transfer_one(struct spi_cont= roller *host, > return status; > } > > - if (!is_polling(sdd) && (xfer->len > fifo_len) && > + if (!is_polling(sdd) && xfer->len >=3D fifo_len && > sdd->rx_dma.ch && sdd->tx_dma.ch) { > use_dma =3D 1; > Would be nice to remove this empty line, while at it. > - } else if (xfer->len >=3D fifo_len) { > + } else if (xfer->len > fifo_len) { Below in the same function I can see similar code: if (target_len >=3D fifo_len) xfer->len =3D fifo_len - 1; Shouldn't that 'if' condition be fixed too? Or it's ok as it is? (Just noticed it by searching, not sure myself, hence asking). > tx_buf =3D xfer->tx_buf; > rx_buf =3D xfer->rx_buf; > origin_len =3D xfer->len; > -- > 2.43.2 > >