linux_dsm_epyc7002/tools/virtio/linux/dma-mapping.h
Christoph Hellwig 325ef1857f PCI: remove PCI_DMA_BUS_IS_PHYS
This was used by the ide, scsi and networking code in the past to
determine if they should bounce payloads.  Now that the dma mapping
always have to support dma to all physical memory (thanks to swiotlb
for non-iommu systems) there is no need to this crude hack any more.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Palmer Dabbelt <palmer@sifive.com> (for riscv)
Reviewed-by: Jens Axboe <axboe@kernel.dk>
2018-05-07 07:15:41 +02:00

33 lines
782 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_DMA_MAPPING_H
#define _LINUX_DMA_MAPPING_H
#ifdef CONFIG_HAS_DMA
# error Virtio userspace code does not support CONFIG_HAS_DMA
#endif
enum dma_data_direction {
DMA_BIDIRECTIONAL = 0,
DMA_TO_DEVICE = 1,
DMA_FROM_DEVICE = 2,
DMA_NONE = 3,
};
#define dma_alloc_coherent(d, s, hp, f) ({ \
void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
*(hp) = (unsigned long)__dma_alloc_coherent_p; \
__dma_alloc_coherent_p; \
})
#define dma_free_coherent(d, s, p, h) kfree(p)
#define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
#define dma_map_single(d, p, s, dir) (virt_to_phys(p))
#define dma_mapping_error(...) (0)
#define dma_unmap_single(...) do { } while (0)
#define dma_unmap_page(...) do { } while (0)
#endif