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 12 enum { 13 VM_MEMSEG_LOW, 14 VM_MEMSEG_HIGH, 15 VM_MEMSEG_COUNT, 16 }; 17 18 struct vmctx { 19 int fd; 20 struct { 21 vm_paddr_t base; 22 vm_size_t size; 23 } memsegs[VM_MEMSEG_COUNT]; 24 int memflags; 25 char *baseaddr; 26 char *name; 27 }; 28 29 struct vcpu { 30 struct vmctx *ctx; 31 int vcpuid; 32 }; 33 34 int vcpu_ioctl(struct vcpu *vcpu, u_long cmd, void *arg); 35 36 extern const char *vm_capstrmap[]; 37 38 #define VM_COMMON_IOCTLS \ 39 VM_RUN, \ 40 VM_SUSPEND, \ 41 VM_REINIT, \ 42 VM_ALLOC_MEMSEG, \ 43 VM_GET_MEMSEG, \ 44 VM_MMAP_MEMSEG, \ 45 VM_MMAP_MEMSEG, \ 46 VM_MMAP_GETNEXT, \ 47 VM_MUNMAP_MEMSEG, \ 48 VM_SET_REGISTER, \ 49 VM_GET_REGISTER, \ 50 VM_SET_REGISTER_SET, \ 51 VM_GET_REGISTER_SET, \ 52 VM_INJECT_EXCEPTION, \ 53 VM_SET_CAPABILITY, \ 54 VM_GET_CAPABILITY, \ 55 VM_STATS, \ 56 VM_STAT_DESC, \ 57 VM_GET_GPA_PMAP, \ 58 VM_GLA2GPA, \ 59 VM_GLA2GPA_NOFAULT, \ 60 VM_ACTIVATE_CPU, \ 61 VM_GET_CPUS, \ 62 VM_SUSPEND_CPU, \ 63 VM_RESUME_CPU, \ 64 VM_SET_INTINFO, \ 65 VM_GET_INTINFO, \ 66 VM_RESTART_INSTRUCTION, \ 67 VM_SET_TOPOLOGY, \ 68 VM_GET_TOPOLOGY, \ 69 VM_SNAPSHOT_REQ, \ 70 VM_RESTORE_TIME 71 72 #define VM_PPT_IOCTLS \ 73 VM_BIND_PPTDEV, \ 74 VM_UNBIND_PPTDEV, \ 75 VM_MAP_PPTDEV_MMIO, \ 76 VM_PPTDEV_MSI, \ 77 VM_PPTDEV_MSIX, \ 78 VM_UNMAP_PPTDEV_MMIO, \ 79 VM_PPTDEV_DISABLE_MSIX 80 81 extern const cap_ioctl_t vm_ioctl_cmds[]; 82 extern size_t vm_ioctl_ncmds; 83 84 #endif /* !__VMMAPI_INTERNAL_H__ */ 85