projects/linux·blob master · refs

36 lines · 1.2 KiB

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