• Maciej S. Szmigiero's avatar
    ALSA: emu10k1: add a IOMMU workaround · 04f8773a
    Maciej S. Szmigiero authored
    The Audigy 2 CA0102 chip (but most likely others from the emu10k1 family,
    too) has a problem that from time to time it likes to do few DMA reads a
    bit beyond its normal allocation and gets very confused if these reads get
    blocked by a IOMMU.
    
    For the first (reserved) page this happens multiple times at every
    playback, for various synth pages it happens randomly, rarely for PCM
    playback buffers and the page table memory itself.
    All these reads seem to follow a similar pattern, observed read offsets
    beyond the allocation end were 0x00, 0x40, 0x80 and 0xc0 (PCI cache line
    multiples), so it looks like the device tries to accesses up to 256 extra
    bytes.
    
    As a workaround let's widen these DMA allocations by an extra page if we
    detect that the device is behind a non-passthrough IOMMU (the DMA memory
    should be relatively plenty on IOMMU systems).
    Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    04f8773a
memory.c 17.2 KB