Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / tools / virtio / linux / dma-mapping.h
blob1571e24e94942ba92da68e995f1c5e008c42acfc
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_DMA_MAPPING_H
3 #define _LINUX_DMA_MAPPING_H
5 #ifdef CONFIG_HAS_DMA
6 # error Virtio userspace code does not support CONFIG_HAS_DMA
7 #endif
9 #define PCI_DMA_BUS_IS_PHYS 1
11 enum dma_data_direction {
12 DMA_BIDIRECTIONAL = 0,
13 DMA_TO_DEVICE = 1,
14 DMA_FROM_DEVICE = 2,
15 DMA_NONE = 3,
18 #define dma_alloc_coherent(d, s, hp, f) ({ \
19 void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
20 *(hp) = (unsigned long)__dma_alloc_coherent_p; \
21 __dma_alloc_coherent_p; \
24 #define dma_free_coherent(d, s, p, h) kfree(p)
26 #define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
28 #define dma_map_single(d, p, s, dir) (virt_to_phys(p))
29 #define dma_mapping_error(...) (0)
31 #define dma_unmap_single(...) do { } while (0)
32 #define dma_unmap_page(...) do { } while (0)
34 #endif