#ifndef __IO_PAGETABLE_H
#define __IO_PAGETABLE_H
#include <linux/interval_tree.h>
#include <linux/mutex.h>
#include <linux/kref.h>
#include <linux/xarray.h>
#include "iommufd_private.h"
struct iommu_domain;
struct iopt_area { … };
struct iopt_allowed { … };
struct iopt_reserved { … };
int iopt_area_fill_domains(struct iopt_area *area, struct iopt_pages *pages);
void iopt_area_unfill_domains(struct iopt_area *area, struct iopt_pages *pages);
int iopt_area_fill_domain(struct iopt_area *area, struct iommu_domain *domain);
void iopt_area_unfill_domain(struct iopt_area *area, struct iopt_pages *pages,
struct iommu_domain *domain);
void iopt_area_unmap_domain(struct iopt_area *area,
struct iommu_domain *domain);
static inline unsigned long iopt_area_index(struct iopt_area *area)
{ … }
static inline unsigned long iopt_area_last_index(struct iopt_area *area)
{ … }
static inline unsigned long iopt_area_iova(struct iopt_area *area)
{ … }
static inline unsigned long iopt_area_last_iova(struct iopt_area *area)
{ … }
static inline size_t iopt_area_length(struct iopt_area *area)
{ … }
static inline unsigned long iopt_area_start_byte(struct iopt_area *area,
unsigned long iova)
{ … }
static inline unsigned long iopt_area_iova_to_index(struct iopt_area *area,
unsigned long iova)
{ … }
#define __make_iopt_iter(name) …
__make_iopt_iter(…)
__make_iopt_iter(…)
__make_iopt_iter(…)
struct iopt_area_contig_iter { … };
struct iopt_area *iopt_area_contig_init(struct iopt_area_contig_iter *iter,
struct io_pagetable *iopt,
unsigned long iova,
unsigned long last_iova);
struct iopt_area *iopt_area_contig_next(struct iopt_area_contig_iter *iter);
static inline bool iopt_area_contig_done(struct iopt_area_contig_iter *iter)
{ … }
#define iopt_for_each_contig_area(iter, area, iopt, iova, last_iova) …
enum { … };
struct iopt_pages { … };
struct iopt_pages *iopt_alloc_pages(void __user *uptr, unsigned long length,
bool writable);
void iopt_release_pages(struct kref *kref);
static inline void iopt_put_pages(struct iopt_pages *pages)
{ … }
void iopt_pages_fill_from_xarray(struct iopt_pages *pages, unsigned long start,
unsigned long last, struct page **out_pages);
int iopt_pages_fill_xarray(struct iopt_pages *pages, unsigned long start,
unsigned long last, struct page **out_pages);
void iopt_pages_unfill_xarray(struct iopt_pages *pages, unsigned long start,
unsigned long last);
int iopt_area_add_access(struct iopt_area *area, unsigned long start,
unsigned long last, struct page **out_pages,
unsigned int flags);
void iopt_area_remove_access(struct iopt_area *area, unsigned long start,
unsigned long last);
int iopt_pages_rw_access(struct iopt_pages *pages, unsigned long start_byte,
void *data, unsigned long length, unsigned int flags);
struct iopt_pages_access { … };
#endif