aboutsummaryrefslogtreecommitdiff
path: root/lib/libvmmapi/vmmapi.c
diff options
context:
space:
mode:
authorRodney W. Grimes <rgrimes@FreeBSD.org>2018-04-08 19:24:49 +0000
committerRodney W. Grimes <rgrimes@FreeBSD.org>2018-04-08 19:24:49 +0000
commit01d822d33b0cd1f801ce39d0ed25fa7f57b5a429 (patch)
tree6e62af630c4d1ea3fb4b4d5e1b23dfe38ea44c9d /lib/libvmmapi/vmmapi.c
parent92223bddedf0f8b964a62904f065b12563db8ae9 (diff)
Notes
Diffstat (limited to 'lib/libvmmapi/vmmapi.c')
-rw-r--r--lib/libvmmapi/vmmapi.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index ecb21f0dcdc12..cb19bc71b160b 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -1506,6 +1506,38 @@ vm_restart_instruction(void *arg, int vcpu)
}
int
+vm_set_topology(struct vmctx *ctx,
+ uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus)
+{
+ struct vm_cpu_topology topology;
+
+ bzero(&topology, sizeof (struct vm_cpu_topology));
+ topology.sockets = sockets;
+ topology.cores = cores;
+ topology.threads = threads;
+ topology.maxcpus = maxcpus;
+ return (ioctl(ctx->fd, VM_SET_TOPOLOGY, &topology));
+}
+
+int
+vm_get_topology(struct vmctx *ctx,
+ uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus)
+{
+ struct vm_cpu_topology topology;
+ int error;
+
+ bzero(&topology, sizeof (struct vm_cpu_topology));
+ error = ioctl(ctx->fd, VM_GET_TOPOLOGY, &topology);
+ if (error == 0) {
+ *sockets = topology.sockets;
+ *cores = topology.cores;
+ *threads = topology.threads;
+ *maxcpus = topology.maxcpus;
+ }
+ return (error);
+}
+
+int
vm_get_device_fd(struct vmctx *ctx)
{
@@ -1535,7 +1567,7 @@ vm_get_ioctls(size_t *len)
VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU,
VM_SET_INTINFO, VM_GET_INTINFO,
VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME,
- VM_RESTART_INSTRUCTION };
+ VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY };
if (len == NULL) {
cmds = malloc(sizeof(vm_ioctl_cmds));