Changeset View
Changeset View
Standalone View
Standalone View
lib/libvmmapi/vmmapi.c
Show First 20 Lines • Show All 1,056 Lines • ▼ Show 20 Lines | vm_disable_pptdev_msix(struct vmctx *ctx, int bus, int slot, int func) | ||||
bzero(&ppt, sizeof(ppt)); | bzero(&ppt, sizeof(ppt)); | ||||
ppt.bus = bus; | ppt.bus = bus; | ||||
ppt.slot = slot; | ppt.slot = slot; | ||||
ppt.func = func; | ppt.func = func; | ||||
return ioctl(ctx->fd, VM_PPTDEV_DISABLE_MSIX, &ppt); | return ioctl(ctx->fd, VM_PPTDEV_DISABLE_MSIX, &ppt); | ||||
} | } | ||||
int | |||||
vm_acpi_device_get_crs(struct vmctx *const ctx, const char *const name, | |||||
ACPI_BUFFER *const crs) | |||||
{ | |||||
if (crs == NULL) { | |||||
return (EINVAL); | |||||
} | |||||
char path[NAME_MAX]; | |||||
snprintf(path, NAME_MAX, "\\_SB.%s", name); | |||||
/* get required size to hold CRS data */ | |||||
struct vm_acpi_device_info acpi_device_info = { | |||||
.type = VM_ACPI_DEVICE_INFO_CRS, | |||||
.path = path, | |||||
}; | |||||
int error = ioctl(ctx->fd, VM_GET_ACPI_DEVICE_INFO, &acpi_device_info); | |||||
if (error) { | |||||
return (error); | |||||
} | |||||
/* allocate buffer for CRS */ | |||||
crs->Pointer = malloc(acpi_device_info.buffer_length); | |||||
if (crs->Pointer == NULL) { | |||||
return (ENOMEM); | |||||
} | |||||
crs->Length = acpi_device_info.buffer_length; | |||||
/* get CRS data */ | |||||
acpi_device_info.buffer = crs->Pointer; | |||||
acpi_device_info.buffer_length = crs->Length; | |||||
error = ioctl(ctx->fd, VM_GET_ACPI_DEVICE_INFO, &acpi_device_info); | |||||
if (error) { | |||||
free(crs->Pointer); | |||||
crs->Length = 0; | |||||
} | |||||
return (error); | |||||
} | |||||
uint64_t * | uint64_t * | ||||
vm_get_stats(struct vmctx *ctx, int vcpu, struct timeval *ret_tv, | vm_get_stats(struct vmctx *ctx, int vcpu, struct timeval *ret_tv, | ||||
int *ret_entries) | int *ret_entries) | ||||
{ | { | ||||
int error; | int error; | ||||
static struct vm_stats vmstats; | static struct vm_stats vmstats; | ||||
▲ Show 20 Lines • Show All 616 Lines • ▼ Show 20 Lines | static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT, | ||||
VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX, | VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX, | ||||
VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, | VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, | ||||
VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, | VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, | ||||
VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, | VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, | ||||
VM_GLA2GPA_NOFAULT, | VM_GLA2GPA_NOFAULT, | ||||
VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU, | VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU, | ||||
VM_SET_INTINFO, VM_GET_INTINFO, | VM_SET_INTINFO, VM_GET_INTINFO, | ||||
VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, | VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, | ||||
VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY }; | VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY, | ||||
VM_GET_ACPI_DEVICE_INFO }; | |||||
if (len == NULL) { | if (len == NULL) { | ||||
cmds = malloc(sizeof(vm_ioctl_cmds)); | cmds = malloc(sizeof(vm_ioctl_cmds)); | ||||
if (cmds == NULL) | if (cmds == NULL) | ||||
return (NULL); | return (NULL); | ||||
bcopy(vm_ioctl_cmds, cmds, sizeof(vm_ioctl_cmds)); | bcopy(vm_ioctl_cmds, cmds, sizeof(vm_ioctl_cmds)); | ||||
return (cmds); | return (cmds); | ||||
} | } | ||||
*len = nitems(vm_ioctl_cmds); | *len = nitems(vm_ioctl_cmds); | ||||
return (NULL); | return (NULL); | ||||
} | } |