Thread (45 messages) 45 messages, 5 authors, 2013-09-12

[PATCH v5 11/13] xen: introduce xen_alloc/free_coherent_pages

From: Stefano Stabellini <hidden>
Date: 2013-09-06 16:10:14
Also in: lkml, xen-devel

On Fri, 6 Sep 2013, Catalin Marinas wrote:
On Fri, Sep 06, 2013 at 03:59:02PM +0100, Stefano Stabellini wrote:
quoted
On Fri, 6 Sep 2013, Catalin Marinas wrote:
quoted
On Thu, Sep 05, 2013 at 05:43:33PM +0100, Stefano Stabellini wrote:
quoted
On Thu, 5 Sep 2013, Catalin Marinas wrote:
quoted
On Thu, Aug 29, 2013 at 07:32:32PM +0100, Stefano Stabellini wrote:
quoted
xen_swiotlb_alloc_coherent needs to allocate a coherent buffer for cpu
and devices. On native x86 and ARMv8 is sufficient to call
__get_free_pages in order to get a coherent buffer, while on ARM we need
to call arm_dma_ops.alloc.
Don't bet on this for ARMv8. It's not mandated for the architecture, so
at some point some SoC will require non-cacheable buffers for coherency.
I see.
Would it be better if I implemented xen_alloc_coherent_pages on armv8 by
calling arm64_swiotlb_dma_ops.alloc?
What does this buffer do exactly? Is it allocated by guests?
It is allocated by Dom0 to do DMA to/from a device.
It is the buffer that is going to be returned by dma_map_ops.alloc to
the caller:

On x86:
dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> __get_free_pages

On ARM:
dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> arm_dma_ops.alloc

On ARM64
dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> ????
OK, I'm getting more confused. Do all the above calls happen in the
guest, Dom0, or a mix?
I guess the confusion comes from a difference in terminology: dom0 is a
guest like the others, just a bit more privileged. We usually call domU
a normal unprivileged guest.

The above calls would happen in Dom0 (when an SMMU is not available).
They could also happen in a DomU if we assign a physical device to it
(and an SMMU is not available).

So in general they would happen in any guest that needs to program a
real device.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help