Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1322252

Re: [PATCHv2] net: moxart: use correct accessors for DMA memory

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCHv2] net: moxart: use correct accessors for DMA memory
Date Sat, 30 Jan 2016 04:50:01 +0100
Message-ID <qWuHT-56u-3@gated-at.bofh.it> (permalink)
References <qVY5k-6dI-17@gated-at.bofh.it>
X-Original-To arnd@arndb.de
X-Mailer Mew version 6.7 on Emacs 24.5 / 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]); Fri, 29 Jan 2016 19:40:21 -0800 (PST)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 26
Organization linux.* mail to news gateway
X-Original-Cc linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, romieu@fr.zoreil.com, linux-kernel@vger.kernel.org, David.Laight@aculab.com
X-Original-Date Fri, 29 Jan 2016 19:40:21 -0800 (PST)
X-Original-Message-ID <20160129.194021.1464359327401868408.davem@davemloft.net>
X-Original-References <2689110.SEuesVebGN@wuerfel>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1322252

Show key headers only | View raw


From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 28 Jan 2016 17:54:33 +0100

> The moxart ethernet driver confuses coherent DMA buffers with
> MMIO registers.
> 
> moxart_ether.c: In function 'moxart_mac_setup_desc_ring':
> moxart_ether.c:146:428: error: passing argument 1 of '__fswab32' makes integer from pointer without a cast [-Werror=int-conversion]
> moxart_ether.c:74:39: warning: incorrect type in argument 3 (different address spaces)
> moxart_ether.c:74:39:    expected void *cpu_addr
> moxart_ether.c:74:39:    got void [noderef] <asn:2>*tx_desc_base
> 
> This leaves the basic logic alone and uses normal pointers for
> the virtual address of the descriptor. As we cannot use readl/writel
> to access them, we also introduce our own moxart_desc_read
> moxart_desc_write helpers that perform the same endianess swap
> as the original code, but without the address space conversion.
> 
> The barriers are made explicit here where needed: Even in the worst-case
> scenario, we just have to use a rmb() after checking ownership so
> we don't read any input data before we are sure it is value, and we
> use wmb() before transferring ownership back to the device.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks.

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCHv2] net: moxart: use correct accessors for DMA memory Arnd Bergmann <arnd@arndb.de> - 2016-01-28 18:00 +0100
  Re: [PATCHv2] net: moxart: use correct accessors for DMA memory David Miller <davem@davemloft.net> - 2016-01-30 04:50 +0100

csiph-web