summaryrefslogtreecommitdiff
path: root/include/sound/memalloc.h
AgeCommit message (Collapse)Author
2014-01-03ALSA: memalloc.h - fix wrong truncation of dma_addr_tStefano Panella
commit 932e9dec380c67ec15ac3eb073bb55797d8b4801 upstream. 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> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2009-07-08ALSA: Fix SG-buffer DMA with non-coherent architecturesTakashi Iwai
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>
2008-10-11Merge branch 'master' of ↵David S. Miller
master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: sound/core/memalloc.c
2008-08-29alsa: Remove special SBUS dma support code.David S. Miller
No longer used. Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-25ALSA: Allocate larger pages in sgbufTakashi Iwai
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>
2008-08-25ALSA: Clean up SG-buffer helper functions and macrosTakashi Iwai
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>
2007-10-16[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.czJaroslav Kysela
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2005-10-28[PATCH] gfp_t: soundAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-08-02ALSA CVS updateJaroslav Kysela
Memalloc module,PCM Midlevel,CS46xx driver,EMU10K1/EMU10K2 driver ALSA Core,YMFPCI driver,Sound Scape driver,ATIIXP driver ATIIXP-modem driver,BT87x driver,ENS1370/1+ driver,ES1968 driver Intel8x0 driver,Intel8x0-modem driver,VIA82xx driver,KORG1212 driver MIXART driver,RME HDSP driver,RME9652 driver,Trident driver Clean up DMA buffer allocation routines. - snd_dma_alloc_pages*() take the device type and device pointer directly as arguments. snd_dma_free_pages() takes only dma_buffer instance. - snd_dma_device struct is removed in each driver's instance (no longer needed due to the change above). - snd_malloc_pages_fallback() is removed since it's no longer used. - The buffer reservation / preallocation in snd-page-alloc module is performed only when the buffer id is given. Normal PCM buffers won't be reserved any more (unless the driver specifies). The module keeps the linked list of free-reserved buffers, instead of the whole buffers Reservation is done via snd_dma_reserve_buf(), and retrieved via snd_dma_get_reserved_buf()). - Other misc clean-ups/fixes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2004-03-07ALSA CVS update - Takashi Iwai <tiwai@suse.de>Jaroslav Kysela
Memalloc module,PCM Midlevel,ALSA Core,CMI8330 driver,ES18xx driver Sound Scape driver,AD1816A driver,AD1848 driver,CS4231 driver ES1688 driver,GUS Library,Opti9xx drivers,SB16/AWE driver,SB8 driver ALS4000 driver,AZT3328 driver,BT87x driver,CMIPCI driver,CS4281 driver ENS1370/1+ driver,ES1938 driver,ES1968 driver,FM801 driver Intel8x0 driver,Maestro3 driver,RME32 driver,RME96 driver SonicVibes driver,VIA82xx driver,ALI5451 driver,CS46xx driver EMU10K1/EMU10K2 driver,ICE1712 driver,ICE1724 driver,KORG1212 driver MIXART driver,RME HDSP driver,RME9652 driver,Trident driver YMFPCI driver,Sound Core PDAudioCF driver,USB generic driver - clean up the DMA code again. now only struct device pointer is handled for every BUS type. the pointer must be given via the corresponding macro snd_dma_xxx_data(). - added the hack for dma_alloc_coherent() to accept dev = NULL for ISA buffers. - added the missing include files.
2004-03-04ALSA CVS update - Takashi Iwai <tiwai@suse.de>Jaroslav Kysela
Memalloc module,ALSA Core - fixed the lock up with SG-buffer handler. - removed non-existing export symbol. - clean up ifdefs.
2004-03-04ALSA CVS update - Jaroslav Kysela <perex@suse.cz>Jaroslav Kysela
Big DMA cleanup originated by Russell King <rmk+alsa@arm.linux.org.uk> * Russel - introduced 'struct device' support for 2.6 dma_alloc_coherent() * Jaroslav - removed all bus-specific allocation functions - extended snd_dma_alloc_pages/snd_dma_free_pages to handle all bus types - recoded all (or almost all) device drivers - sgbuf functions are bus independent now
2003-04-10ALSA updateJaroslav Kysela
- documentation - control API - added multi-elements to reduce memory usage - improved preallocation of DMA buffers - CS46xx driver - added support for secondary codec - HDSP driver - big update - firmware is loaded with hdsptool now - pmac driver updates (fixed oops and beep stuff) - VIA82xx driver updated - ymfpci driver updated - drivers updated to new PnP layer - wavefront, ad1816a, cs423x, es18xx, interwave, opl3sa2, cmi8330
2003-04-07[PATCH] remove version crapAlan Cox
2003-03-20ALSA update (0.9.2)Jaroslav Kysela
- created snd-page-alloc module - moved all page allocation code there - preserves preallocated DMA buffers for devices - USB audio driver updated - AC'97 - better modem initialization code - timer API - enhanced (added pause and more event notifications) - splitted ice1724 code from ice1712 to own module - general - timerstamp cleanups (timeval -> timespec) - C99-like cleanups - trident driver - more workaround for wrong IRQ acks - OSS sequencer emulation - fixed OOPS (wrong free order) - more compatible with level 1 of sequencer (/dev/sequencer) - CS46xx driver updated - intel8x0 driver updated - emu10k1 driver updated