From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756286AbcA3DkX (ORCPT ); Fri, 29 Jan 2016 22:40:23 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:42002 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753780AbcA3DkW (ORCPT ); Fri, 29 Jan 2016 22:40:22 -0500 Date: Fri, 29 Jan 2016 19:40:21 -0800 (PST) Message-Id: <20160129.194021.1464359327401868408.davem@davemloft.net> To: arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, romieu@fr.zoreil.com, linux-kernel@vger.kernel.org, David.Laight@aculab.com Subject: Re: [PATCHv2] net: moxart: use correct accessors for DMA memory From: David Miller In-Reply-To: <2689110.SEuesVebGN@wuerfel> References: <2689110.SEuesVebGN@wuerfel> 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann 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] *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 Applied, thanks.