Return-Path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx2.suse.de", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id B49DCDDF70 for ; Wed, 9 Jul 2008 23:32:02 +1000 (EST) Date: Wed, 09 Jul 2008 19:31:51 +0200 Message-ID: From: Takashi Iwai To: benh@kernel.crashing.org To: Gerhard Pircher Subject: Re: [PATCH 0/3] ALSA fixes for non-coherent ppc32 In-Reply-To: <1215593735.8970.361.camel@pasglop> References: <20080709083111.44860@gmx.net> <1215593735.8970.361.camel@pasglop> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , At Wed, 09 Jul 2008 18:55:35 +1000, Benjamin Herrenschmidt wrote: > > On Wed, 2008-07-09 at 10:31 +0200, Gerhard Pircher wrote: > > > > > > The patches are found also on my git tree, dma-fix branch of > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git > > > > > > Any comments and test reports are appreciated, especially about > > > dma_mmap_coherent() addition. > > I know this answer comes a little bit late, but my PPC machine was not > > working for two weeks due to a hardware failure. I tested the patch on > > 2.6.26-rc9 and it seems to work fine so far with my emu10k soundcard. > > I just had to add "#include " to pcm_native.c. > > Otherwise it wouldn't compile. > > Can I get the latest powerpc-side patches so I can review-ack them in > time for the merge window ? The changes in ppc are only the patch below. The others are in sound/*. I wrote it as an inline function simply it's so short and I didn't want extra exports. thanks, Takashi --- commit 2c8662fde57af4cf928d17e089dc3dd2096f4b30 Author: Takashi Iwai Date: Tue Jun 17 16:39:04 2008 +0200 ppc: Add dma_mmap_coherent() for PPC32 A very lazy version of dma_mmap_coherent() implementation for ppc32. Signed-off-by: Takashi Iwai diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h index bbefb69..a6a9675 100644 --- a/include/asm-powerpc/dma-mapping.h +++ b/include/asm-powerpc/dma-mapping.h @@ -306,6 +306,24 @@ static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, /* We don't do anything here. */ } +/* + * A helper to mmap the pages allocated via dma_alloc_coherent() + */ +static inline int dma_mmap_coherent(struct device *dev, + struct vm_area_struct *vma, + void *cpu_addr, dma_addr_t handle, + size_t size) +{ + struct page *pg; +#ifdef CONFIG_NOT_COHERENT_CACHE + /* I'm too lazy and can't stop using bus_to_virt() here... */ + cpu_addr = bus_to_virt(handle); +#endif + pg = virt_to_page(cpu_addr); + return remap_pfn_range(vma, vma->vm_start, + page_to_pfn(pg) + vma->vm_pgoff, + size, vma->vm_page_prot); +} #endif /* CONFIG_PPC64 */ static inline void dma_sync_single_for_cpu(struct device *dev,