#include <linux/slab.h>
#include <linux/file.h>
#include <linux/anon_inodes.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#include <linux/vdpa.h>
#include "iova_domain.h"
static int vduse_iotlb_add_range(struct vduse_iova_domain *domain,
u64 start, u64 last,
u64 addr, unsigned int perm,
struct file *file, u64 offset)
{ … }
static void vduse_iotlb_del_range(struct vduse_iova_domain *domain,
u64 start, u64 last)
{ … }
int vduse_domain_set_map(struct vduse_iova_domain *domain,
struct vhost_iotlb *iotlb)
{ … }
void vduse_domain_clear_map(struct vduse_iova_domain *domain,
struct vhost_iotlb *iotlb)
{ … }
static int vduse_domain_map_bounce_page(struct vduse_iova_domain *domain,
u64 iova, u64 size, u64 paddr)
{ … }
static void vduse_domain_unmap_bounce_page(struct vduse_iova_domain *domain,
u64 iova, u64 size)
{ … }
static void do_bounce(phys_addr_t orig, void *addr, size_t size,
enum dma_data_direction dir)
{ … }
static void vduse_domain_bounce(struct vduse_iova_domain *domain,
dma_addr_t iova, size_t size,
enum dma_data_direction dir)
{ … }
static struct page *
vduse_domain_get_coherent_page(struct vduse_iova_domain *domain, u64 iova)
{ … }
static struct page *
vduse_domain_get_bounce_page(struct vduse_iova_domain *domain, u64 iova)
{ … }
static void
vduse_domain_free_kernel_bounce_pages(struct vduse_iova_domain *domain)
{ … }
int vduse_domain_add_user_bounce_pages(struct vduse_iova_domain *domain,
struct page **pages, int count)
{ … }
void vduse_domain_remove_user_bounce_pages(struct vduse_iova_domain *domain)
{ … }
void vduse_domain_reset_bounce_map(struct vduse_iova_domain *domain)
{ … }
static int vduse_domain_init_bounce_map(struct vduse_iova_domain *domain)
{ … }
static dma_addr_t
vduse_domain_alloc_iova(struct iova_domain *iovad,
unsigned long size, unsigned long limit)
{ … }
static void vduse_domain_free_iova(struct iova_domain *iovad,
dma_addr_t iova, size_t size)
{ … }
void vduse_domain_sync_single_for_device(struct vduse_iova_domain *domain,
dma_addr_t dma_addr, size_t size,
enum dma_data_direction dir)
{ … }
void vduse_domain_sync_single_for_cpu(struct vduse_iova_domain *domain,
dma_addr_t dma_addr, size_t size,
enum dma_data_direction dir)
{ … }
dma_addr_t vduse_domain_map_page(struct vduse_iova_domain *domain,
struct page *page, unsigned long offset,
size_t size, enum dma_data_direction dir,
unsigned long attrs)
{ … }
void vduse_domain_unmap_page(struct vduse_iova_domain *domain,
dma_addr_t dma_addr, size_t size,
enum dma_data_direction dir, unsigned long attrs)
{ … }
void *vduse_domain_alloc_coherent(struct vduse_iova_domain *domain,
size_t size, dma_addr_t *dma_addr,
gfp_t flag, unsigned long attrs)
{ … }
void vduse_domain_free_coherent(struct vduse_iova_domain *domain, size_t size,
void *vaddr, dma_addr_t dma_addr,
unsigned long attrs)
{ … }
static vm_fault_t vduse_domain_mmap_fault(struct vm_fault *vmf)
{ … }
static const struct vm_operations_struct vduse_domain_mmap_ops = …;
static int vduse_domain_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static int vduse_domain_release(struct inode *inode, struct file *file)
{ … }
static const struct file_operations vduse_domain_fops = …;
void vduse_domain_destroy(struct vduse_iova_domain *domain)
{ … }
struct vduse_iova_domain *
vduse_domain_create(unsigned long iova_limit, size_t bounce_size)
{ … }
int vduse_domain_init(void)
{ … }
void vduse_domain_exit(void)
{ … }