linux/include/sound
Stefano Panella 932e9dec38 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>
2013-12-10 15:30:46 +01:00
..
ac97_codec.h
aci.h
ad1816a.h
ad1843.h
adau1373.h
aess.h
ak4xxx-adda.h
ak4113.h
ak4114.h ALSA: ak4114: Fix wrong register array size 2013-10-29 16:42:36 +01:00
ak4117.h
ak4531_codec.h
ak4641.h
alc5623.h
asequencer.h
asound.h
asoundef.h
atmel-abdac.h
atmel-ac97c.h
compress_driver.h ALSA: compress: fix drain calls blocking other compress functions (v6) 2013-11-07 10:12:27 +01:00
control.h ALSA: vmaster: Add snd_ctl_sync_vmaster() helper function 2013-06-24 15:51:54 +02:00
core.h ALSA: pcm: Add snd_printd_ratelimit() 2013-08-19 15:48:33 +02:00
cs42l52.h ASoC: cs42l52: Add platform data for reset gpio 2013-10-25 16:37:58 +01:00
cs42l73.h ASoC: cs42l73: Add platform data support for cs42l73 codec 2013-10-18 00:37:29 +01:00
cs4231-regs.h
cs4271.h
cs8403.h
cs8427.h
da7213.h
da9055.h
designware_i2s.h
dmaengine_pcm.h ASoC: dmaengine: Support custom channel names 2013-10-24 09:52:14 +01:00
emu10k1.h
emu10k1_synth.h
emu8000.h
emu8000_reg.h
emux_legacy.h
emux_synth.h
es1688.h
gus.h
hda_hwdep.h
hwdep.h
i2c.h
info.h
initval.h
jack.h
l3.h
max9768.h
max98088.h
max98090.h
max98095.h
memalloc.h ALSA: memalloc.h - fix wrong truncation of dma_addr_t 2013-12-10 15:30:46 +01:00
minors.h
mixer_oss.h
mpu401.h
opl3.h
opl4.h
pcm-indirect.h
pcm.h ALSA: Constify the snd_pcm_substream struct ops field 2013-05-24 15:41:44 +02:00
pcm_oss.h
pcm_params.h
pt2258.h
pxa2xx-lib.h ASoC: pxa: use snd_dmaengine_dai_dma_data 2013-08-15 11:29:07 +01:00
rawmidi.h
rcar_snd.h Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next 2013-10-24 11:24:11 +01:00
rt5640.h ASoC: add RT5640 CODEC driver 2013-06-12 17:46:54 +01:00
s3c24xx_uda134x.h
sb.h
sb16_csp.h
seq_device.h
seq_kernel.h
seq_midi_emul.h
seq_midi_event.h
seq_oss.h
seq_oss_legacy.h
seq_virmidi.h
sh_dac_audio.h
sh_fsi.h
simple_card.h
snd_wavefront.h
soc-dai.h Merge remote-tracking branch 'asoc/topic/mxs' into asoc-next 2013-10-24 11:24:09 +01:00
soc-dapm.h ASoC: dapm: Use SND_SOC_DAPM_INIT_REG_VAL in SND_SOC_DAPM_MUX 2013-11-24 13:55:41 +00:00
soc-dpcm.h ASoC: dapm: Pass snd_soc_card directly to soc_dpcm_runtime_update() 2013-07-24 14:56:19 +01:00
soc.h Merge remote-tracking branch 'asoc/topic/devm' into asoc-next 2013-10-24 11:24:04 +01:00
soundfont.h
spear_dma.h
spear_spdif.h
sta32x.h
tas5086.h
tea6330t.h
timer.h
tlv.h
tlv320aic3x.h
tlv320aic32x4.h
tlv320dac33-plat.h
tpa6130a2-plat.h
uda134x.h
uda1380.h
util_mem.h
vx_core.h
wavefront.h
wm0010.h
wm1250-ev1.h
wm2000.h
wm2200.h
wm5100.h
wm8903.h
wm8904.h
wm8955.h
wm8960.h
wm8962.h
wm8993.h
wm8996.h
wm9081.h
wm9090.h
wss.h