On Wed, Dec 22, 2021 at 12:37:03PM +0000, Hyeonggon Yoo wrote:
Oh I misunderstood this. Underlying physical address of vmalloc()-allocated memory can be mapped using DMA API, and it needs to be setup as scatterlist because the allocated memory is not physically continuous. Right?
Yes.
BTW, looking at the API I think the scsi case can be converted to use dma_alloc_pages(). but driver requires 512 bytes of buffer and the API supports allocating by at least page size.
Overallocating is not generally a problem, but if the allocations are for a slow path it might make more sense to stick to dma_map_* and bounce buffer if needed.
It's not a big problem as it allocates a single buffer but in other cases maybe not. Can't we use dma pool for non-coherent pages?
No.