Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/vmm_dev.c
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | struct vm_stats_old { | ||||
int cpuid; /* in */ | int cpuid; /* in */ | ||||
int num_entries; /* out */ | int num_entries; /* out */ | ||||
struct timeval tv; | struct timeval tv; | ||||
uint64_t statbuf[MAX_VM_STATS]; | uint64_t statbuf[MAX_VM_STATS]; | ||||
}; | }; | ||||
#define VM_STATS_OLD \ | #define VM_STATS_OLD \ | ||||
_IOWR('v', IOCNUM_VM_STATS, struct vm_stats_old) | _IOWR('v', IOCNUM_VM_STATS, struct vm_stats_old) | ||||
struct vm_snapshot_meta_old { | |||||
void *ctx; /* unused */ | |||||
void *dev_data; | |||||
const char *dev_name; /* identify userspace devices */ | |||||
enum snapshot_req dev_req; /* identify kernel structs */ | |||||
struct vm_snapshot_buffer buffer; | |||||
enum vm_snapshot_op op; | |||||
}; | |||||
#define VM_SNAPSHOT_REQ_OLD \ | |||||
_IOWR('v', IOCNUM_SNAPSHOT_REQ, struct vm_snapshot_meta_old) | |||||
#endif | #endif | ||||
struct devmem_softc { | struct devmem_softc { | ||||
int segid; | int segid; | ||||
char *name; | char *name; | ||||
struct cdev *cdev; | struct cdev *cdev; | ||||
struct vmmdev_softc *sc; | struct vmmdev_softc *sc; | ||||
SLIST_ENTRY(devmem_softc) link; | SLIST_ENTRY(devmem_softc) link; | ||||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | #endif | ||||
struct vm_cpu_topology *topology; | struct vm_cpu_topology *topology; | ||||
struct vm_readwrite_kernemu_device *kernemu; | struct vm_readwrite_kernemu_device *kernemu; | ||||
uint64_t *regvals; | uint64_t *regvals; | ||||
int *regnums; | int *regnums; | ||||
enum { NONE, SINGLE, ALL } vcpus_locked; | enum { NONE, SINGLE, ALL } vcpus_locked; | ||||
bool memsegs_locked; | bool memsegs_locked; | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
struct vm_snapshot_meta *snapshot_meta; | struct vm_snapshot_meta *snapshot_meta; | ||||
#ifdef COMPAT_FREEBSD13 | |||||
struct vm_snapshot_meta_old *snapshot_old; | |||||
#endif | #endif | ||||
#endif | |||||
error = vmm_priv_check(curthread->td_ucred); | error = vmm_priv_check(curthread->td_ucred); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
sc = vmmdev_lookup2(cdev); | sc = vmmdev_lookup2(cdev); | ||||
if (sc == NULL) | if (sc == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | case VM_REINIT: | ||||
*/ | */ | ||||
vm_xlock_memsegs(sc->vm); | vm_xlock_memsegs(sc->vm); | ||||
memsegs_locked = true; | memsegs_locked = true; | ||||
/* FALLTHROUGH */ | /* FALLTHROUGH */ | ||||
case VM_MAP_PPTDEV_MMIO: | case VM_MAP_PPTDEV_MMIO: | ||||
case VM_UNMAP_PPTDEV_MMIO: | case VM_UNMAP_PPTDEV_MMIO: | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
case VM_SNAPSHOT_REQ: | case VM_SNAPSHOT_REQ: | ||||
#ifdef COMPAT_FREEBSD13 | |||||
case VM_SNAPSHOT_REQ_OLD: | |||||
#endif | |||||
case VM_RESTORE_TIME: | case VM_RESTORE_TIME: | ||||
#endif | #endif | ||||
/* | /* | ||||
* ioctls that operate on the entire virtual machine must | * ioctls that operate on the entire virtual machine must | ||||
* prevent all vcpus from running. | * prevent all vcpus from running. | ||||
*/ | */ | ||||
error = vcpu_lock_all(sc); | error = vcpu_lock_all(sc); | ||||
if (error) | if (error) | ||||
▲ Show 20 Lines • Show All 440 Lines • ▼ Show 20 Lines | vm_get_topology(sc->vm, &topology->sockets, &topology->cores, | ||||
&topology->threads, &topology->maxcpus); | &topology->threads, &topology->maxcpus); | ||||
error = 0; | error = 0; | ||||
break; | break; | ||||
#ifdef BHYVE_SNAPSHOT | #ifdef BHYVE_SNAPSHOT | ||||
case VM_SNAPSHOT_REQ: | case VM_SNAPSHOT_REQ: | ||||
snapshot_meta = (struct vm_snapshot_meta *)data; | snapshot_meta = (struct vm_snapshot_meta *)data; | ||||
error = vm_snapshot_req(sc->vm, snapshot_meta); | error = vm_snapshot_req(sc->vm, snapshot_meta); | ||||
break; | break; | ||||
#ifdef COMPAT_FREEBSD13 | |||||
case VM_SNAPSHOT_REQ_OLD: | |||||
/* | |||||
* The old structure just has an additional pointer at | |||||
* the start that is ignored. | |||||
*/ | |||||
snapshot_old = (struct vm_snapshot_meta_old *)data; | |||||
snapshot_meta = | |||||
(struct vm_snapshot_meta *)&snapshot_old->dev_data; | |||||
error = vm_snapshot_req(sc->vm, snapshot_meta); | |||||
break; | |||||
#endif | |||||
case VM_RESTORE_TIME: | case VM_RESTORE_TIME: | ||||
error = vm_restore_time(sc->vm); | error = vm_restore_time(sc->vm); | ||||
break; | break; | ||||
#endif | #endif | ||||
default: | default: | ||||
error = ENOTTY; | error = ENOTTY; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 370 Lines • Show Last 20 Lines |