From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: 2.6.26-rc1 regression: ISA DMA broken (bisected) Date: Fri, 09 May 2008 08:06:55 +0200 Message-ID: References: <4823AAF2.7070102@keyaccess.nl> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 5BFF7248F0 for ; Fri, 9 May 2008 08:06:56 +0200 (CEST) In-Reply-To: <4823AAF2.7070102@keyaccess.nl> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Rene Herman Cc: ALSA devel , Linux Kernel , Glauber Costa , Thomas Gleixner , Ingo Molnar , Pete Clements List-Id: alsa-devel@alsa-project.org At Fri, 09 May 2008 03:37:54 +0200, Rene Herman wrote: > > Good day. > > commit 8779f2fc3b84ebb6c5181fb13d702e9944c16069 > > "x86: don't try to allocate from DMA zone at first" > > breaks all of ISA DMA. Or all of ALSA ISA DMA at least. All > ISA soundcards are silent following that commit -- no error > messages, everything appears fine, just silence. > > It won't just revert due to 32/64 merge. > > Rene. Thanks for catching it. Yeah, the patch looks buggy. We had an implicit assumption that dev = NULL for ISA devices that require 24bit DMA. How about the patch below? It's against the latest Linus git tree. thanks, Takashi [PATCH] x86: Fix dma_alloc_coherent() for ISA devices The recent work on x86 dma_alloc_coherent() breaks the ISA DMA buffer allocation, which is represented by "dev = NULL" and requires 24bit DMA implicitly. Signed-off-by: Takashi Iwai --- diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 0c37f16..c5ef1af 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -385,11 +385,13 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) return memory; - if (!dev) + if (!dev) { dev = &fallback_dev; + gfp |= GFP_DMA; + } dma_mask = dev->coherent_dma_mask; if (dma_mask == 0) - dma_mask = DMA_32BIT_MASK; + dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK; /* Device not DMA able */ if (dev->dma_mask == NULL) @@ -403,7 +405,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, larger than 16MB and in this case we have a chance of finding fitting memory in the next higher zone first. If not retry with true GFP_DMA. -AK */ - if (dma_mask <= DMA_32BIT_MASK) + if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) gfp |= GFP_DMA32; #endif