Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / arch / arm / xen / mm.c
blobb0e77de9914866e19fb69ab28f9cd674d7e7f57d
1 #include <linux/bootmem.h>
2 #include <linux/gfp.h>
3 #include <linux/export.h>
4 #include <linux/slab.h>
5 #include <linux/types.h>
6 #include <linux/dma-mapping.h>
7 #include <linux/vmalloc.h>
8 #include <linux/swiotlb.h>
10 #include <xen/xen.h>
11 #include <xen/interface/memory.h>
12 #include <xen/swiotlb-xen.h>
14 #include <asm/cacheflush.h>
15 #include <asm/xen/page.h>
16 #include <asm/xen/hypercall.h>
17 #include <asm/xen/interface.h>
19 int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
20 unsigned int address_bits,
21 dma_addr_t *dma_handle)
23 if (!xen_initial_domain())
24 return -EINVAL;
26 /* we assume that dom0 is mapped 1:1 for now */
27 *dma_handle = pstart;
28 return 0;
30 EXPORT_SYMBOL_GPL(xen_create_contiguous_region);
32 void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
34 return;
36 EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
38 struct dma_map_ops *xen_dma_ops;
39 EXPORT_SYMBOL_GPL(xen_dma_ops);
41 static struct dma_map_ops xen_swiotlb_dma_ops = {
42 .mapping_error = xen_swiotlb_dma_mapping_error,
43 .alloc = xen_swiotlb_alloc_coherent,
44 .free = xen_swiotlb_free_coherent,
45 .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu,
46 .sync_single_for_device = xen_swiotlb_sync_single_for_device,
47 .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu,
48 .sync_sg_for_device = xen_swiotlb_sync_sg_for_device,
49 .map_sg = xen_swiotlb_map_sg_attrs,
50 .unmap_sg = xen_swiotlb_unmap_sg_attrs,
51 .map_page = xen_swiotlb_map_page,
52 .unmap_page = xen_swiotlb_unmap_page,
53 .dma_supported = xen_swiotlb_dma_supported,
54 .set_dma_mask = xen_swiotlb_set_dma_mask,
57 int __init xen_mm_init(void)
59 if (!xen_initial_domain())
60 return 0;
61 xen_swiotlb_init(1, false);
62 xen_dma_ops = &xen_swiotlb_dma_ops;
63 return 0;
65 arch_initcall(xen_mm_init);