Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033406AbdI0ExY (ORCPT ); Wed, 27 Sep 2017 00:53:24 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:48860 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750753AbdI0ExW (ORCPT ); Wed, 27 Sep 2017 00:53:22 -0400 Date: Tue, 26 Sep 2017 21:53:21 -0700 (PDT) Message-Id: <20170926.215321.424825014223425519.davem@davemloft.net> To: paul.burton@imgtec.com Cc: matt.redfearn@imgtec.com, netdev@vger.kernel.org, alexandre.torgue@st.com, peppe.cavallaro@st.com, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, james.hogan@imgtec.com Subject: Re: [PATCH] net: stmmac: Meet alignment requirements for DMA From: David Miller In-Reply-To: <2520219.WSsBr6LeCR@np-p-burton> References: <1752163.uYYNevmZpH@np-p-burton> <20170926.195244.506518182147628099.davem@davemloft.net> <2520219.WSsBr6LeCR@np-p-burton> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 26 Sep 2017 21:53:22 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1045 Lines: 26 From: Paul Burton Date: Tue, 26 Sep 2017 21:30:56 -0700 > Nobody said that you are required to do anything, I suggested that > it would be beneficial if you were to suggest a change to the > documented DMA API such that it allows your usage where it currently > does not. Documentation is often wrong and it is here. What 200+ drivers actually do and depend upon trumps a simple text document. The requirement is that the memory remains quiescent on the cpu side while the device messes with it. And that this quiescence requirement may or may not be on a cache line basis. There is absolutely no requirement that the buffers themselves are cache line aligned. In fact, receive buffers for networking are intentionally 2-byte aligned in order for the ipv4 headers to be naturally 32-bit aligned. Cache line aligning receive buffers will actually make some architectures trap because of the bad alignment. So see, this cache line alignment requirement is pure madness from just about any perspective whatsoever.