Why dma_alloc_coherent don't return direct mapped vaddr?

Li Chen me at linux.beauty
Wed Jul 20 20:28:22 PDT 2022


Hi Arnd,

dma_alloc_coherent two addr:
1. vaddr.
2. dma_addr

I noticed vaddr is not simply linear/direct mapped to dma_addr, which means I cannot use virt_to_phys/virt_to_page to get 
paddr/page. Instead, I should use dma_addr as paddr and phys_to_page(dma_addr) to get struct page.

My question is why dma_alloc_coherent not simply return phys_to_virt(dma_addr)? IOW, why vaddr is not directly mapped to dma_addr?

Regards,
Li



More information about the linux-arm-kernel mailing list