summaryrefslogtreecommitdiff
path: root/lib/libvmmapi/internal.h
blob: 4afe1cab34606c0cd69ff429a0805f62a74ffb1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*-
 * SPDX-License-Identifier: BSD-2-Clause
 *
 * Copyright (c) 2022 John Baldwin <jhb@FreeBSD.org>
 */

#ifndef __VMMAPI_INTERNAL_H__
#define	__VMMAPI_INTERNAL_H__

#include <sys/types.h>
#include <dev/vmm/vmm_mem.h>

struct vmctx {
	int	fd;		/* device file descriptor */
	int	ctlfd;		/* vmm control descriptor */
	struct {
		vm_paddr_t base;
		vm_size_t size;
	} memsegs[VM_MAX_MEMSEGS];
	size_t 	lowmem_size;
	size_t 	highmem_size;
	int	memflags;
	char	*baseaddr;
	char	*name;
};

struct vcpu {
	struct vmctx *ctx;
	int vcpuid;
};

int	vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg);

extern const char *vm_capstrmap[];

#define	VM_COMMON_IOCTLS	\
	VM_RUN,			\
	VM_SUSPEND,		\
	VM_REINIT,		\
	VM_ALLOC_MEMSEG,	\
	VM_GET_MEMSEG,		\
	VM_MMAP_MEMSEG,		\
	VM_MMAP_MEMSEG,		\
	VM_MMAP_GETNEXT,	\
	VM_MUNMAP_MEMSEG,	\
	VM_SET_REGISTER,	\
	VM_GET_REGISTER,	\
	VM_SET_REGISTER_SET,	\
	VM_GET_REGISTER_SET,	\
	VM_INJECT_EXCEPTION,	\
	VM_SET_CAPABILITY,	\
	VM_GET_CAPABILITY,	\
	VM_STATS,		\
	VM_STAT_DESC,		\
	VM_GLA2GPA_NOFAULT,	\
	VM_ACTIVATE_CPU,	\
	VM_GET_CPUS,		\
	VM_SUSPEND_CPU,		\
	VM_RESUME_CPU,		\
	VM_SET_TOPOLOGY,	\
	VM_GET_TOPOLOGY

#define	VM_PPT_IOCTLS		\
	VM_BIND_PPTDEV,		\
	VM_UNBIND_PPTDEV,	\
	VM_MAP_PPTDEV_MMIO,	\
	VM_PPTDEV_MSI,		\
	VM_PPTDEV_MSIX,		\
	VM_UNMAP_PPTDEV_MMIO,	\
	VM_PPTDEV_DISABLE_MSIX

extern const cap_ioctl_t vm_ioctl_cmds[];
extern size_t vm_ioctl_ncmds;

#endif /* !__VMMAPI_INTERNAL_H__ */