From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754267AbbLLAfA (ORCPT ); Fri, 11 Dec 2015 19:35:00 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:57227 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbbLLAe6 (ORCPT ); Fri, 11 Dec 2015 19:34:58 -0500 Date: Fri, 11 Dec 2015 19:34:56 -0500 (EST) Message-Id: <20151211.193456.188476874988011975.davem@davemloft.net> To: arnd@arndb.de Cc: netdev@vger.kernel.org, w-kwok2@ti.com, m-karicheri2@ti.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/2] netcp: try to reduce type confusion in descriptors From: David Miller In-Reply-To: <1578620.t1ANcREMZ8@wuerfel> References: <1578620.t1ANcREMZ8@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, 11 Dec 2015 16:34:58 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Date: Tue, 08 Dec 2015 16:32:27 +0100 > The netcp driver produces tons of warnings when CONFIG_LPAE is enabled > on ARM: > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_tx_map_skb': > drivers/net/ethernet/ti/netcp_core.c:1084:13: warning: passing argument 1 of 'set_words' from incompatible pointer type [-Wincompatible-pointer-types] > > This is the result of trying to pass a pointer to a dma_addr_t to > a function that expects a u32 pointer to copy that into a DMA descriptor. > > Looking at that code in more detail to fix the warnings, I see multiple > related problems: > > * The conversion functions are not endian-safe, as the DMA descriptors > are almost certainly fixed-endian, but the CPU is not. > > * On 64-bit machines, passing a pointer through a u32 variable is a > bug, accessing an indirect pointer as a u32 pointer even more so. > > * The handling of epib and psdata mixes native-endian and device-endian > data. > > In this patch, I try to sort out the types for most accesses here, > adding le32_to_cpu/cpu_to_le32 where appropriate, and passing pointers > through two 32-bit words in the descriptor padding, to make it plausible > that the driver does the right thing if compiled for big-endian or > 64-bit systems. > > Signed-off-by: Arnd Bergmann Applied to net-next.