From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Subject: Re: [PATCH v3] ad7877: keep dma rx buffers in seperate cache lines Date: Tue, 11 May 2010 16:54:41 -0400 Message-ID: References: <1273487642-2169-1-git-send-email-os@emlix.com> <20100511063309.GC9644@core.coreip.homeip.net> <1273608441.15067.1002.camel@calx> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-yw0-f198.google.com ([209.85.211.198]:61119 "EHLO mail-yw0-f198.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757824Ab0EKUzD convert rfc822-to-8bit (ORCPT ); Tue, 11 May 2010 16:55:03 -0400 In-Reply-To: Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Christoph Lameter Cc: Pekka Enberg , Matt Mackall , Dmitry Torokhov , Andrew Morton , Oskar Schirmer , Michael Hennerich , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Daniel_Gl=C3=B6ckner?= , Oliver Schneidewind , Johannes Weiner , Nick Piggin , David Rientjes , David Brownell , Grant Likely On Tue, May 11, 2010 at 16:46, Christoph Lameter wrote: > On Tue, 11 May 2010, Mike Frysinger wrote: >> > DMA. If the arch can only DMA into cacheline aligned objects then = the >> > correct method is to force kmalloc alignment to cacheline size. >> >> these are SPI drivers and are usable on any arch that supports a SPI >> bus (which is pretty much every arch). =C2=A0forget about "embedded" >> arches. >> >> the issue here is simple: a SPI driver (AD7877) needs to do a receiv= e >> SPI transfer into a DMA safe buffer. =C2=A0what is the exact API to >> dynamically allocate memory for the structure with this buffer >> embedded in it such that the start of the structure is cached aligne= d >> ? =C2=A0creating a dedicated kmem cache may work, but it isnt a scal= able >> solution if every SPI driver needs to create its own cache. > > kmalloc returns a pointer to a DMA safe buffer. There is no requireme= nt on > the x86 hardware that the DMA buffers have to be cache aligned. Cache= lines > will be invalidated as needed. so this guarantee is made by the kmalloc() API ? and for arches where the cacheline invalidation is handled in software rather than hardware, they must declare a min alignment value for kmalloc to be at least as big as their cache alignment ? does the phrase "DMA safe buffer" imply cache alignment ? -mike -- To unsubscribe from this list: send the line "unsubscribe linux-input" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html