1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_H 3 #define SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_H 4 5 #include <libvfio/assert.h> 6 #include <libvfio/iommu.h> 7 #include <libvfio/iova_allocator.h> 8 #include <libvfio/vfio_pci_device.h> 9 #include <libvfio/vfio_pci_driver.h> 10 11 /* 12 * Return the BDF string of the device that the test should use. 13 * 14 * If a BDF string is provided by the user on the command line (as the last 15 * element of argv[]), then this function will return that and decrement argc 16 * by 1. 17 * 18 * Otherwise this function will attempt to use the environment variable 19 * $VFIO_SELFTESTS_BDF. 20 * 21 * If BDF cannot be determined then the test will exit with KSFT_SKIP. 22 */ 23 const char *vfio_selftests_get_bdf(int *argc, char *argv[]); 24 char **vfio_selftests_get_bdfs(int *argc, char *argv[], int *nr_bdfs); 25 26 /* 27 * Reserve virtual address space of size at an address satisfying 28 * (vaddr % align) == offset. 29 * 30 * Returns the reserved vaddr. The caller is responsible for unmapping 31 * the returned region. 32 */ 33 void *mmap_reserve(size_t size, size_t align, size_t offset); 34 35 #endif /* SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_H */ 36