Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2#ifndef SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOVA_ALLOCATOR_H
3#define SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOVA_ALLOCATOR_H
4
5#include <linux/list.h>
6#include <linux/types.h>
7#include <linux/iommufd.h>
8
9#include <libvfio/iommu.h>
10
11struct iova_allocator {
12 struct iommu_iova_range *ranges;
13 u32 nranges;
14 u32 range_idx;
15 u64 range_offset;
16};
17
18struct iova_allocator *iova_allocator_init(struct iommu *iommu);
19void iova_allocator_cleanup(struct iova_allocator *allocator);
20iova_t iova_allocator_alloc(struct iova_allocator *allocator, size_t size);
21
22#endif /* SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOVA_ALLOCATOR_H */