Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+alsa@arm.linux.org.uk>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@suse.cz>,
	Alsa Devel list <alsa-devel@lists.sourceforge.net>
Subject: Re: [PATCH] 1/3 Implement generic device DMA mapping support
Date: Tue, 2 Mar 2004 14:26:32 +0000	[thread overview]
Message-ID: <20040302142632.A12353@flint.arm.linux.org.uk> (raw)
In-Reply-To: <s5h8yijfiic.wl@alsa2.suse.de>; from tiwai@suse.de on Tue, Mar 02, 2004 at 03:09:15PM +0100

On Tue, Mar 02, 2004 at 03:09:15PM +0100, Takashi Iwai wrote:
> At Mon, 01 Mar 2004 18:51:56 +0100,
> I wrote:
> > ah, yes, then it's fine.  thanks.
> 
> i was too fast to confirm that -- it turned out that this doesn't
> help.
> 
> since dma_alloc_coherent() is just a wrapper to pci_alloc_consistent()
> on x86, GFP_KERNEL is ignored.  instead, GFP_ATOMIC is used always.
> sigh...

include/asm-i386/dma-mapping.h:

void *dma_alloc_coherent(struct device *dev, size_t size,
                           dma_addr_t *dma_handle, int flag);

arch/i386/kernel/pci-dma.c:

void *dma_alloc_coherent(struct device *dev, size_t size,
                           dma_addr_t *dma_handle, int gfp)
{
        void *ret;
        /* ignore region specifiers */
        gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
 
        if (dev == NULL || (*dev->dma_mask < 0xffffffff))
                gfp |= GFP_DMA;
        ret = (void *)__get_free_pages(gfp, get_order(size));
 
        if (ret != NULL) {
                memset(ret, 0, size);
                *dma_handle = virt_to_phys(ret);
        }
        return ret;
}

I, therefore, suggest that you're not looking at a 2.6.3 kernel.  This
was changed from pci_alloc_consistent to dma_alloc_coherent on 22 Dec,
and was modified to take the GFP flags on 13 Jan.

dma_alloc_coherent() is therefore not a wrapper for pci_alloc_consistent().

However, include/asm-generic/pci-dma-compat.h which is included by
include/asm-i386/pci.h contains:

static inline void *
pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
                     dma_addr_t *dma_handle)
{
        return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
}

I'm not sure which kernel are you looking at, because it doesn't seem
to match mainline kernels.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

  reply	other threads:[~2004-03-02 14:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-29 22:38 [PATCH] 1/3 Implement generic device DMA mapping support Russell King
2004-02-29 22:42 ` [PATCH] 2/3 " Russell King
2004-02-29 22:43   ` [PATCH] 3/3 " Russell King
2004-03-01 15:41 ` [PATCH] 1/3 " Takashi Iwai
2004-03-01 15:38   ` Jaroslav Kysela
2004-03-01 17:45   ` Russell King
2004-03-01 17:51     ` Takashi Iwai
2004-03-01 18:22       ` Russell King
2004-03-01 18:34         ` Takashi Iwai
2004-03-01 18:44           ` Takashi Iwai
2004-03-02 15:23           ` Takashi Iwai
2004-03-02 14:09       ` Takashi Iwai
2004-03-02 14:26         ` Russell King [this message]
2004-03-02 14:38           ` Takashi Iwai
2004-03-02 14:55             ` Russell King

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=20040302142632.A12353@flint.arm.linux.org.uk \
    --to=rmk+alsa@arm.linux.org.uk \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=perex@suse.cz \
    --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