History log of /include/sound/memalloc.h
Revision Date Author Comments
47d98c026ef9a9888c36f3c4f26b81f548a0ca86 08-Jan-2014 Takashi Iwai <tiwai@suse.de> ALSA: Remove memory reservation code from memalloc helper

Nowadays we have CMA for obtaining the contiguous memory pages
efficiently. Let's kill the old kludge for reserving the memory pages
for large buffers. It was rarely useful (only for preserving pages
among module reloading or a little help by an early boot scripting),
used only by a couple of drivers, and yet it gives too much ugliness
than its benefit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
932e9dec380c67ec15ac3eb073bb55797d8b4801 10-Dec-2013 Stefano Panella <stefano.panella@citrix.com> ALSA: memalloc.h - fix wrong truncation of dma_addr_t

When running a 32bit kernel the hda_intel driver is still reporting
a 64bit dma_mask if the HW supports it.

From sound/pci/hda/hda_intel.c:

/* allow 64bit DMA address if supported by H/W */
if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
else {
pci_set_dma_mask(pci, DMA_BIT_MASK(32));
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
}

which means when there is a call to dma_alloc_coherent from
snd_malloc_dev_pages a machine address bigger than 32bit can be returned.
This can be true in particular if running the 32bit kernel as a pv dom0
under the Xen Hypervisor or PAE on bare metal.

The problem is that when calling setup_bdle to program the BLE the
dma_addr_t returned from the dma_alloc_coherent is wrongly truncated
from snd_sgbuf_get_addr if running a 32bit kernel:

static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
size_t offset)
{
struct snd_sg_buf *sgbuf = dmab->private_data;
dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
addr &= PAGE_MASK;
return addr + offset % PAGE_SIZE;
}

where PAGE_MASK in a 32bit kernel is zeroing the upper 32bit af addr.

Without this patch the HW will fetch the 32bit truncated address,
which is not the one obtained from dma_alloc_coherent and will result
to a non working audio but can corrupt host memory at a random location.

The current patch apply to v3.13-rc3-74-g6c843f5

Signed-off-by: Stefano Panella <stefano.panella@citrix.com>
Reviewed-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
a5606f85611267047206d8ba055bc0e4ba166ad3 24-Oct-2013 Takashi Iwai <tiwai@suse.de> ALSA: Add ifdef CONFIG_GENERIC_ALLOCATOR for SNDRV_DMA_TYPE_IRAM code

It turned out that we can't use gen_pool_*() functions on archs
without CONFIG_GENERIC_ALLOCATOR (resulting in missing symbols), since
linux/genalloc.h doesn't provide dummy functions for all. We'd be
able to fix linux/genalloc.h size, but I take an easier path for
now...

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
055032142c42d2821c4aa617915292d6a08d56fc 23-Oct-2013 Nicolin Chen <b42378@freescale.com> ALSA: Add SoC on-chip internal ram support for DMA buffer allocation

Now it's quite common that an SoC contains its on-chip internal RAM.
By using this RAM space for DMA buffer during audio playback/record,
we can shutdown the voltage for external RAM to save power.

So add new DEV type with iram malloc()/free() and accordingly modify
current default mmap() for the iram circumstance.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
019d80db5727707faa2108fcd4fbbfac9defb3a6 29-Jan-2013 Antonio Ospite <ao2@amarulasolutions.com> ALSA: Force a cast to silence a warning from "sparse"

Some audio drivers are calling snd_dma_continuous_data(GFP_KERNEL)
which makes "sparse" give a warning:

$ make C=2 M=sound/usb modules
...
sound/usb/6fire/pcm.c:625:25: warning: cast from restricted gfp_t
sound/usb/caiaq/audio.c:845:41: warning: cast from restricted gfp_t
sound/usb/usx2y/usbusx2yaudio.c:997:54: warning: cast from restricted gfp_t
sound/usb/usx2y/usbusx2yaudio.c:1001:54: warning: cast from restricted gfp_t
sound/usb/usx2y/usx2yhwdeppcm.c:774:54: warning: cast from restricted gfp_t
sound/usb/usx2y/usx2yhwdeppcm.c:778:54: warning: cast from restricted gfp_t

Add __force to the cast to silence the warning.

Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9d069dc00b02b886abe3cab5e369140f7cd78965 21-Sep-2012 Takashi Iwai <tiwai@suse.de> ALSA: Make snd_sgbuf_get_{ptr|addr}() available for non-SG cases

Passing struct snd_dma_buffer pointer instead, so that they work no
matter whether real SG buffer is used or not.

This is a preliminary work for the HD-audio DSP loader code.

Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
cc6a8acdeee932f6911d8b236d2c7d6bcc4616f6 17-Jun-2008 Takashi Iwai <tiwai@suse.de> ALSA: Fix SG-buffer DMA with non-coherent architectures

Using SG-buffers with dma_alloc_coherent() is often very inefficient
on non-coherent architectures because a tracking record could be
allocated in addition for each dma_alloc_coherent() call.
Instead, simply disable SG-buffers but just allocate normal continuous
buffers on non-supported (currently all but x86) architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
759ee81be6d87c150ea2b300c221b4fec8b5f646 27-Aug-2008 David S. Miller <davem@davemloft.net> alsa: Remove special SBUS dma support code.

No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
51e9f2e665bf2b6a01be275d64c336d942c59a66 30-Jul-2008 Takashi Iwai <tiwai@suse.de> ALSA: Allocate larger pages in sgbuf

Most hardwares have limited buffer-descriptor table length. This
also restricts the max buffer size of the sound driver.
For example, snd-hda-intel has 1MB buffer size limit, and this is
because it can have at most 256 BDL entries. For supporting larger
buffers, we need to allocate larger pages even for sg-buffers.

This patch changes the sgbuf allocation code to try to allocate
larger pages first. At each head of the allocated pages, the
number of allocated pages is stored in the lowest bits of the
corresponding entry of the table addr field. This change isn't
visible as long as the driver uses snd_sgbuf_get_addr() helper.

Also, the patch adds a new function, snd_pcm_sgbuf_get_chunk_size().
This returns the size of the chunk on continuous pages starting at
the given position offset. If the chunk reaches to a non-continuous
page, it returns the size to the boundary.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
77a23f2695bb2de0cd74599400dc55109c531b72 21-Aug-2008 Takashi Iwai <tiwai@suse.de> ALSA: Clean up SG-buffer helper functions and macros

Clean up SG-buffer helper functions and macros. Helpers take substream
as arguments now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
c1017a4cdb68ae5368fbc9ee42c77f1f5dca8916 15-Oct-2007 Jaroslav Kysela <perex@perex.cz> [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz


Signed-off-by: Jaroslav Kysela <perex@perex.cz>
1ef64e670e3bc27e0c3c83810ca36e19924c35c6 21-Oct-2005 Al Viro <viro@zeniv.linux.org.uk> [PATCH] gfp_t: sound

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!