Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/include/vmm.h
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | |||||
struct vioapic *vm_ioapic(struct vm *vm); | struct vioapic *vm_ioapic(struct vm *vm); | ||||
struct vhpet *vm_hpet(struct vm *vm); | struct vhpet *vm_hpet(struct vm *vm); | ||||
int vm_get_capability(struct vm *vm, int vcpu, int type, int *val); | int vm_get_capability(struct vm *vm, int vcpu, int type, int *val); | ||||
int vm_set_capability(struct vm *vm, int vcpu, int type, int val); | int vm_set_capability(struct vm *vm, int vcpu, int type, int val); | ||||
int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state); | int vm_get_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state *state); | ||||
int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state); | int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state); | ||||
int vm_apicid2vcpuid(struct vm *vm, int apicid); | int vm_apicid2vcpuid(struct vm *vm, int apicid); | ||||
int vm_activate_cpu(struct vm *vm, int vcpu); | int vm_activate_cpu(struct vm *vm, int vcpu); | ||||
int vm_suspend_cpu(struct vm *vm, int vcpu); | |||||
int vm_resume_cpu(struct vm *vm, int vcpu); | |||||
struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); | struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid); | ||||
void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip); | void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip); | ||||
void vm_exit_debug(struct vm *vm, int vcpuid, uint64_t rip); | |||||
void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip); | void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip); | ||||
void vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip); | void vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip); | ||||
void vm_exit_reqidle(struct vm *vm, int vcpuid, uint64_t rip); | void vm_exit_reqidle(struct vm *vm, int vcpuid, uint64_t rip); | ||||
#ifdef _SYS__CPUSET_H_ | #ifdef _SYS__CPUSET_H_ | ||||
/* | /* | ||||
* Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'. | * Rendezvous all vcpus specified in 'dest' and execute 'func(arg)'. | ||||
* The rendezvous 'func(arg)' is not allowed to do anything that will | * The rendezvous 'func(arg)' is not allowed to do anything that will | ||||
* cause the thread to be put to sleep. | * cause the thread to be put to sleep. | ||||
* | * | ||||
* If the rendezvous is being initiated from a vcpu context then the | * If the rendezvous is being initiated from a vcpu context then the | ||||
* 'vcpuid' must refer to that vcpu, otherwise it should be set to -1. | * 'vcpuid' must refer to that vcpu, otherwise it should be set to -1. | ||||
* | * | ||||
* The caller cannot hold any locks when initiating the rendezvous. | * The caller cannot hold any locks when initiating the rendezvous. | ||||
* | * | ||||
* The implementation of this API may cause vcpus other than those specified | * The implementation of this API may cause vcpus other than those specified | ||||
* by 'dest' to be stalled. The caller should not rely on any vcpus making | * by 'dest' to be stalled. The caller should not rely on any vcpus making | ||||
* forward progress when the rendezvous is in progress. | * forward progress when the rendezvous is in progress. | ||||
*/ | */ | ||||
typedef void (*vm_rendezvous_func_t)(struct vm *vm, int vcpuid, void *arg); | typedef void (*vm_rendezvous_func_t)(struct vm *vm, int vcpuid, void *arg); | ||||
void vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, | void vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t dest, | ||||
vm_rendezvous_func_t func, void *arg); | vm_rendezvous_func_t func, void *arg); | ||||
cpuset_t vm_active_cpus(struct vm *vm); | cpuset_t vm_active_cpus(struct vm *vm); | ||||
cpuset_t vm_debug_cpus(struct vm *vm); | |||||
cpuset_t vm_suspended_cpus(struct vm *vm); | cpuset_t vm_suspended_cpus(struct vm *vm); | ||||
#endif /* _SYS__CPUSET_H_ */ | #endif /* _SYS__CPUSET_H_ */ | ||||
static __inline int | static __inline int | ||||
vcpu_rendezvous_pending(struct vm_eventinfo *info) | vcpu_rendezvous_pending(struct vm_eventinfo *info) | ||||
{ | { | ||||
return (*((uintptr_t *)(info->rptr)) != 0); | return (*((uintptr_t *)(info->rptr)) != 0); | ||||
} | } | ||||
static __inline int | static __inline int | ||||
vcpu_suspended(struct vm_eventinfo *info) | vcpu_suspended(struct vm_eventinfo *info) | ||||
{ | { | ||||
return (*info->sptr); | return (*info->sptr); | ||||
} | } | ||||
static __inline int | static __inline int | ||||
vcpu_reqidle(struct vm_eventinfo *info) | vcpu_reqidle(struct vm_eventinfo *info) | ||||
{ | { | ||||
return (*info->iptr); | return (*info->iptr); | ||||
} | } | ||||
int vcpu_debugged(struct vm *vm, int vcpuid); | |||||
/* | /* | ||||
* Return 1 if device indicated by bus/slot/func is supposed to be a | * Return 1 if device indicated by bus/slot/func is supposed to be a | ||||
* pci passthrough device. | * pci passthrough device. | ||||
* | * | ||||
* Return 0 otherwise. | * Return 0 otherwise. | ||||
*/ | */ | ||||
int vmm_is_pptdev(int bus, int slot, int func); | int vmm_is_pptdev(int bus, int slot, int func); | ||||
▲ Show 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | enum vm_exitcode { | ||||
VM_EXITCODE_IOAPIC_EOI, | VM_EXITCODE_IOAPIC_EOI, | ||||
VM_EXITCODE_SUSPENDED, | VM_EXITCODE_SUSPENDED, | ||||
VM_EXITCODE_INOUT_STR, | VM_EXITCODE_INOUT_STR, | ||||
VM_EXITCODE_TASK_SWITCH, | VM_EXITCODE_TASK_SWITCH, | ||||
VM_EXITCODE_MONITOR, | VM_EXITCODE_MONITOR, | ||||
VM_EXITCODE_MWAIT, | VM_EXITCODE_MWAIT, | ||||
VM_EXITCODE_SVM, | VM_EXITCODE_SVM, | ||||
VM_EXITCODE_REQIDLE, | VM_EXITCODE_REQIDLE, | ||||
VM_EXITCODE_DEBUG, | |||||
VM_EXITCODE_MAX | VM_EXITCODE_MAX | ||||
}; | }; | ||||
struct vm_inout { | struct vm_inout { | ||||
uint16_t bytes:3; /* 1 or 2 or 4 */ | uint16_t bytes:3; /* 1 or 2 or 4 */ | ||||
uint16_t in:1; | uint16_t in:1; | ||||
uint16_t string:1; | uint16_t string:1; | ||||
uint16_t rep:1; | uint16_t rep:1; | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |