• Takashi Iwai's avatar
    ALSA: memalloc: Use proper DMA mapping API for x86 S/G buffer allocations · 0b9f2bd0
    Takashi Iwai authored
    The fallback S/G buffer allocation for x86 used the addresses deduced
    from the page allocations blindly.  It broke the allocations on IOMMU
    and made us to work around with a hackish DMA ops check.
    
    For cleaning up those messes, this patch switches to the proper DMA
    mapping API usages with the standard sg-table instead.
    
    By introducing the sg-table, the address table isn't needed, but for
    keeping the original allocation sizes for freeing, replace it with the
    array keeping the number of pages.
    
    The get_addr callback is changed to use the existing one for
    non-contiguous buffers.  (Also it's the reason sg_table is put at the
    beginning of struct snd_dma_sg_fallback.)
    
    And finally, the hackish workaround that checks the DMA ops is
    dropped now.
    
    Link: https://patch.msgid.link/20240912155227.4078-3-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    0b9f2bd0
memalloc.c 23.7 KB