diff options
author | Neel Natu <neel@FreeBSD.org> | 2012-09-25 19:08:51 +0000 |
---|---|---|
committer | Neel Natu <neel@FreeBSD.org> | 2012-09-25 19:08:51 +0000 |
commit | e90273829bfc2417bf8cf9e946f0f8243e4e170a (patch) | |
tree | b73faadf3ccee979f76090f7f988fe5e700627d7 /lib | |
parent | edf89256ddd10c3d7347dd30d849a04bfb80200d (diff) | |
download | src-e90273829bfc2417bf8cf9e946f0f8243e4e170a.tar.gz src-e90273829bfc2417bf8cf9e946f0f8243e4e170a.zip |
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.
Notes
Notes:
svn path=/projects/bhyve/; revision=240922
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libvmmapi/vmmapi.c | 29 | ||||
-rw-r--r-- | lib/libvmmapi/vmmapi.h | 4 |
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index d7e6143c124b..78ed3686f8e8 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 diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 516bbc34eafb..b9184097478b 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -30,6 +30,7 @@ #define _VMMAPI_H_ struct vmctx; +enum x2apic_state; int vm_create(const char *name); struct vmctx *vm_open(const char *name); @@ -90,6 +91,9 @@ uint64_t *vm_get_stats(struct vmctx *ctx, int vcpu, struct timeval *ret_tv, int *ret_entries); const char *vm_get_stat_desc(struct vmctx *ctx, int index); +int vm_get_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state *s); +int vm_set_x2apic_state(struct vmctx *ctx, int vcpu, enum x2apic_state s); + /* Reset vcpu register state */ int vcpu_reset(struct vmctx *ctx, int vcpu); |