summaryrefslogtreecommitdiffstats
path: root/lib/libvmmapi/vmmapi.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-09-25 19:08:51 +0000
committerneel <neel@FreeBSD.org>2012-09-25 19:08:51 +0000
commitebdd69568d7fa97153aa47a86afe367476a0a1de (patch)
treeb73faadf3ccee979f76090f7f988fe5e700627d7 /lib/libvmmapi/vmmapi.c
parentc34be7b811ad199e64f66db339e7f64c773ca0a7 (diff)
downloadFreeBSD-src-ebdd69568d7fa97153aa47a86afe367476a0a1de.zip
FreeBSD-src-ebdd69568d7fa97153aa47a86afe367476a0a1de.tar.gz
Add ioctls to control the X2APIC capability exposed by the virtual machine to
the guest. At the moment this simply sets the state in the 'vcpu' instance but there is no code that acts upon these settings.
Diffstat (limited to 'lib/libvmmapi/vmmapi.c')
-rw-r--r--lib/libvmmapi/vmmapi.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index d7e6143..78ed368 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -537,6 +537,35 @@ vm_get_stat_desc(struct vmctx *ctx, int index)
return (NULL);
}
+int
+vm_get_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state *state)
+{
+ int error;
+ struct vm_x2apic x2apic;
+
+ bzero(&x2apic, sizeof(x2apic));
+ x2apic.cpuid = vcpu;
+
+ error = ioctl(ctx->fd, VM_GET_X2APIC_STATE, &x2apic);
+ *state = x2apic.state;
+ return (error);
+}
+
+int
+vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state state)
+{
+ int error;
+ struct vm_x2apic x2apic;
+
+ bzero(&x2apic, sizeof(x2apic));
+ x2apic.cpuid = vcpu;
+ x2apic.state = state;
+
+ error = ioctl(ctx->fd, VM_SET_X2APIC_STATE, &x2apic);
+
+ return (error);
+}
+
/*
* From Intel Vol 3a:
* Table 9-1. IA-32 Processor States Following Power-up, Reset or INIT
OpenPOWER on IntegriCloud