On Fri, Dec 23, 2022 at 05:45:24PM +0530, Rijo Thomas wrote:
dma_alloc_coherent memory is just as contiguous as __get_free_pages, and calling dma_alloc_coherent from a guest does not guarantee that the memory is contiguous in host memory either. The memory would look contiguous from the device point of view thanks to the IOMMU though (in both cases). So this is not about being contiguous but other properties that you might rely on (dma mask most likely, or coherent if you're not running this on x86?).
Can you confirm why this fixes things and update the comment to reflect that.
I see what you are saying.
We verified this in Xen Dom0 PV guest, where dma_alloc_coherent() returned a memory that is contiguous in machine address space, and the machine address was returned in the dma handle (buf->dma).
So is this even relevant to the mainstream kernel or is this patch only needed for Xen Dom0?
Thanks,