From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C115C001B0 for ; Fri, 23 Jun 2023 17:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0/J6qtg/1tN0SBD6OHKrm+rADOW2jIU7bfh+YEutGz4=; b=JDf3uCEaiuEATZ8zw3qXnQPzCl ZJJ8rBMwNaAeLc65xXhm4GwsoZSk9ZvKDPLN/0/EAccXW4jE5rF0lAJVPo5ZUBLVgRnoSjSnAAxvV kMKsnyX9R0IUz909OJzZKORB18ntsRhdLDl0ZLL7Akh8f3nswCPQ0nbNTmHJfSBI4xfivN8aksV+W fx+g0NAAUisWf7FTNrzoOjVwdG9ahZq8LJUf6my7kljRMd+LegAeq2GZJXUYsVc+tK57MCC85pvif VfUs15E62iKy8J84jXE7MEw76Px243BBhAfBPfaGGHLDAW6XzELmMsKe2lRoi0n5HIOdjwNg1rIix vEDBLrXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCkOj-004BKv-2x; Fri, 23 Jun 2023 17:16:37 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCkOg-004BKM-1a for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 17:16:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0363061A8D; Fri, 23 Jun 2023 17:16:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF0DC433C8; Fri, 23 Jun 2023 17:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687540593; bh=XzF98qjp3cUGS5MdS2OUjPFF18XAGxz1hZNvRMAQmHA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eg6HTCAVX1qEpMbVau3oUofy7C3xYSygLN3FOWo1H1d54+tUe0gpxCURhZN9NuULb pIXiuaoqwl/QiGwrKQRLOY/eI895G46e9NxP8CcILCHBX7W3EDX2zmqeJd84BgyoUB Kru+WxIr698PqZJ1A9OizO3WY2t0LNll+7a7FTypYl3Is8+v0zCf3N3xJYXz4YPrB0 jfVaO6e1CDtgcRM+ACDgh5eTN4iow+qzTuBT46eXlyg8I2vyv91Vc/tfwKxxz4WKN4 GDN1Wz5KzKaMQZLWVfCOb2lniu0m7Xif0yOkOtrHAoxWfkmvw4W2PJ4Hrb5Xe6lmw7 1cYLF9UYSR5ew== Date: Fri, 23 Jun 2023 18:16:29 +0100 From: Mark Brown To: Eddie James Cc: Vincent Whitchurch , krzysztof.kozlowski@linaro.org, andi@etezian.org, kernel@axis.com, alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 3/4] spi: Split transfers larger than max size Message-ID: References: <20220927112117.77599-1-vincent.whitchurch@axis.com> <20220927112117.77599-4-vincent.whitchurch@axis.com> <6dff003d-c727-e4a3-b5d3-f58beb2b02cb@linux.ibm.com> <9cc6addc-cd41-7794-79a0-5c776946f492@linux.ibm.com> MIME-Version: 1.0 In-Reply-To: <9cc6addc-cd41-7794-79a0-5c776946f492@linux.ibm.com> X-Cookie: Slow day. Practice crawling. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230623_101634_612966_0F1A35AE X-CRM114-Status: GOOD ( 35.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1971754483309282952==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1971754483309282952== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6UKfe05sFDoqKM7Y" Content-Disposition: inline --6UKfe05sFDoqKM7Y Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 23, 2023 at 11:45:19AM -0500, Eddie James wrote: > On 6/22/23 16:16, Mark Brown wrote: > > On Thu, Jun 22, 2023 at 02:48:36PM -0500, Eddie James wrote: > > > On 9/27/22 06:21, Vincent Whitchurch wrote: > > > > A couple of drivers call spi_split_transfers_maxsize() from their > > > > ->prepare_message() callbacks to split transfers which are too big = for > > > > them to handle. Add support in the core to do this based on > > > > ->max_transfer_size() to avoid code duplication. > > > I've been testing AT25 functionality in linux 6.1 and I believe this = patch > > > is breaking the AT25 protocol. It will split a write command up such = that > > > some of the data is in a different transfer than=A0 the write enable = and > > Could you be more specific about the manner in which you think this is > > breaking things? The size of transfer is immaterial to the client > Ok, I understand better now. Agreed it shouldn't make a difference, but t= his > is actually a limitation of the spi controller I'm using (spi-fsi). The > controller cannot handle multiple transfers keeping the chip select > enabled... I guess the driver can batch transfers in the message to get > around this, unless you want to add a flag for that behavior. Client drivers should in general just generate messages corresponding to the desired result visible to the device and let the controller worry about how to actually accomplish that, splitting transfers needlessly is just going to create overheads. If there's scatter/gather going on that does complicate things a bit though so it's not always going to happen. If the controller driver needs to rewrite the message to combine transfers then it should do that (or tell the core to do so on it's behalf), just like with splitting transfers due to length limits. > > In any case this is all based on the maximum transfer size advertised by > > the conteroller driver, if the device can physically handle larger > > transfers then there's no reason for it to set a limit. If the driver > > can't physically handle larger transfers and it does make a difference > > then the system simply won't work. > Yep, this is also an artifact of the spi-fsi driver having different > transfer size limits for writes and reads. Funnily enough the at25 driver > doesn't truly respect the max transfer size (it doesn't include the write > command and address bytes in the calculation against the max transfer siz= e) > so that's how this worked previously. Yes, the logic there looks incorrect. As well as the issue you've identified the driver should really be using spi_max_message_size(), with a controller that can't control chip select effectivley like the FSI driver that'll be the same a the transfer size but other drivers will be able to chain multiple transfers together even if there's limits on the transfer length. --6UKfe05sFDoqKM7Y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSV02wACgkQJNaLcl1U h9BdnAf+PY0FCLe/tEf10cWA/oH5sgrTc40JOaRJnDP2aw9Aq8zcj4EH+N/SwtGJ VUSCxXpX7D+HyuiQVugw/zdg0XE9gLx2Na7ER9xZrtjcv3GQMQU1VSHlqslPYUBn rARQDcMDZdVVY7BEEvzGl4/FVYklns1he4gF/+HSM/gGinW1f8cNpz5t0z0U1j/l PnOpwHDPP0IhTKiPJoNwpT8bvRg2DGSvhHvZpjFbXdoa09cXJV5tNeZP7FrU/MDZ qnPyBPAWYxc5I2dRHbf503WZBr5CWNch8Ax6zh4oUQuJSVU5zj4OzuEu1ypL6S9n y/Myq1Lx5mGdbbx4ZLfWn/I10kri4w== =M1Yj -----END PGP SIGNATURE----- --6UKfe05sFDoqKM7Y-- --===============1971754483309282952== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1971754483309282952==--