linux/arch/arm/xen
Stefano Stabellini 340720be32 xen/arm: reimplement xen_dma_unmap_page & friends
xen_dma_unmap_page, xen_dma_sync_single_for_cpu and
xen_dma_sync_single_for_device are currently implemented by calling into
the corresponding generic ARM implementation of these functions. In
order to do this, firstly the dma_addr_t handle, that on Xen is a
machine address, needs to be translated into a physical address.  The
operation is expensive and inaccurate, given that a single machine
address can correspond to multiple physical addresses in one domain,
because the same page can be granted multiple times by the frontend.

To avoid this problem, we introduce a Xen specific implementation of
xen_dma_unmap_page, xen_dma_sync_single_for_cpu and
xen_dma_sync_single_for_device, that can operate on machine addresses
directly.

The new implementation relies on the fact that the hypervisor creates a
second p2m mapping of any grant pages at physical address == machine
address of the page for dom0. Therefore we can access memory at physical
address == dma_addr_r handle and perform the cache flushing there. Some
cache maintenance operations require a virtual address. Instead of using
ioremap_cache, that is not safe in interrupt context, we allocate a
per-cpu PAGE_KERNEL scratch page and we manually update the pte for it.

arm64 doesn't need cache maintenance operations on unmap for now.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Denis Schneider <v1ne2go@gmail.com>
2014-09-11 18:11:53 +00:00
..
enlighten.c xen/arm: introduce XENFEAT_grant_map_identity 2014-09-11 18:11:52 +00:00
grant-table.c arm/xen: remove duplicate arch_gnttab_init() function 2014-08-11 11:59:14 +01:00
hypercall.S ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+ 2014-07-18 12:29:04 +01:00
Makefile xen/arm: reimplement xen_dma_unmap_page & friends 2014-09-11 18:11:53 +00:00
mm32.c xen/arm: reimplement xen_dma_unmap_page & friends 2014-09-11 18:11:53 +00:00
mm.c swiotlb-xen: use xen_alloc/free_coherent_pages 2013-10-10 13:41:10 +00:00
p2m.c xen/grant-table: Refactor gnttab_[un]map_refs to avoid m2p_override 2014-03-18 14:40:19 +00:00