public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Rene Herman <rene.herman@keyaccess.nl>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Pete Clements <clem@clem.clem-digital.net>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: 2.6.26-rc1 regression: ISA DMA broken (bisected)
Date: Fri, 09 May 2008 09:48:59 -0300	[thread overview]
Message-ID: <4824483B.9070906@redhat.com> (raw)
In-Reply-To: <s5hzlr0105c.wl%tiwai@suse.de>

Takashi Iwai wrote:
> 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 <tiwai@suse.de>

Woke up and saw it, got worried, but there is already a fix. ;-)

Nice work! And thank you

> ---
> 
> 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
>  


  parent reply	other threads:[~2008-05-09 12:50 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-09  1:37 2.6.26-rc1 regression: ISA DMA broken (bisected) Rene Herman
2008-05-09  6:06 ` Takashi Iwai
2008-05-09  8:55   ` Ingo Molnar
2008-05-09  8:58     ` Ingo Molnar
2008-05-09 17:20       ` Jesse Barnes
2008-05-09 12:03   ` Rene Herman
2008-05-09 12:28     ` Ingo Molnar
2008-05-09 23:00       ` Rene Herman
2008-05-13 14:36         ` Ingo Molnar
2008-05-13 15:26           ` Rene Herman
2008-05-09 12:29     ` Pete Clements
2008-05-09 12:48   ` Glauber Costa [this message]
2008-05-13 16:59   ` Bjorn Helgaas
2008-05-13 17:01     ` Alan Cox
2008-05-13 17:33       ` Rene Herman
2008-05-13 23:18         ` Bjorn Helgaas
2008-05-14  9:25           ` Takashi Iwai
2008-05-14 12:46           ` Rene Herman
2008-05-14 13:01             ` Takashi Iwai
2008-05-14 15:40               ` Rene Herman
2008-05-14 15:53                 ` Takashi Iwai
2008-05-14 18:41                 ` Rene Herman
2008-05-14 18:50                   ` Bjorn Helgaas
2008-05-14 19:09                     ` Rene Herman
2008-05-30 21:15                       ` [PATCH] " Rene Herman
2008-05-30 21:28                         ` [DEVICE MODEL] dev->dma_mask Rene Herman
2008-05-30 21:43                         ` [PATCH] Re: 2.6.26-rc1 regression: ISA DMA broken (bisected) Bjorn Helgaas
2008-05-30 22:11                           ` Rene Herman
2008-05-30 22:37                             ` [PATCH] ISA: set 24-bit dma_mask for ISA devices Rene Herman
2008-05-30 22:55                               ` Andrew Morton
2008-05-30 23:50                                 ` Rene Herman
2008-05-30 23:54                             ` [PATCH] PNP: set the pnp_card dma_mask for use by ISAPnP cards Rene Herman
2008-05-31  8:55                               ` Takashi Iwai
2008-05-30 23:55                             ` [PATCH] ISA: set 24-bit dma_mask for ISA devices Rene Herman
2008-05-31  8:56                               ` Takashi Iwai
2008-05-14 15:26             ` 2.6.26-rc1 regression: ISA DMA broken (bisected) Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4824483B.9070906@redhat.com \
    --to=gcosta@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clem@clem.clem-digital.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rene.herman@keyaccess.nl \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox