1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2022 John Baldwin <jhb@FreeBSD.org> 5 */ 6 7 #ifndef __VMMAPI_INTERNAL_H__ 8 #define __VMMAPI_INTERNAL_H__ 9 10 #include <sys/types.h> 11 #include <dev/vmm/vmm_mem.h> 12 13 struct vmctx { 14 int fd; /* device file descriptor */ 15 int ctlfd; /* vmm control descriptor */ 16 struct { 17 vm_paddr_t base; 18 vm_size_t size; 19 } memsegs[VM_MAX_MEMSEGS]; 20 size_t lowmem_size; 21 size_t highmem_size; 22 int memflags; 23 char *baseaddr; 24 char *name; 25 }; 26 27 struct vcpu { 28 struct vmctx *ctx; 29 int vcpuid; 30 }; 31 32 int vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg); 33 34 extern const char *vm_capstrmap[]; 35 36 #define VM_COMMON_IOCTLS \ 37 VM_RUN, \ 38 VM_SUSPEND, \ 39 VM_REINIT, \ 40 VM_ALLOC_MEMSEG, \ 41 VM_GET_MEMSEG, \ 42 VM_MMAP_MEMSEG, \ 43 VM_MMAP_MEMSEG, \ 44 VM_MMAP_GETNEXT, \ 45 VM_MUNMAP_MEMSEG, \ 46 VM_SET_REGISTER, \ 47 VM_GET_REGISTER, \ 48 VM_SET_REGISTER_SET, \ 49 VM_GET_REGISTER_SET, \ 50 VM_INJECT_EXCEPTION, \ 51 VM_SET_CAPABILITY, \ 52 VM_GET_CAPABILITY, \ 53 VM_STATS, \ 54 VM_STAT_DESC, \ 55 VM_GLA2GPA_NOFAULT, \ 56 VM_ACTIVATE_CPU, \ 57 VM_GET_CPUS, \ 58 VM_SUSPEND_CPU, \ 59 VM_RESUME_CPU, \ 60 VM_SET_TOPOLOGY, \ 61 VM_GET_TOPOLOGY 62 63 #define VM_PPT_IOCTLS \ 64 VM_BIND_PPTDEV, \ 65 VM_UNBIND_PPTDEV, \ 66 VM_MAP_PPTDEV_MMIO, \ 67 VM_PPTDEV_MSI, \ 68 VM_PPTDEV_MSIX, \ 69 VM_UNMAP_PPTDEV_MMIO, \ 70 VM_PPTDEV_DISABLE_MSIX 71 72 extern const cap_ioctl_t vm_ioctl_cmds[]; 73 extern size_t vm_ioctl_ncmds; 74 75 #endif /* !__VMMAPI_INTERNAL_H__ */ 76