aboutsummaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-10-31 05:29:00 +0100
committerAndreas Färber <afaerber@suse.de>2012-12-19 14:09:31 +0100
commit8737c51c0444f832c4e97d7eb7540eae457e08e4 (patch)
tree3d8a23a7dca0caff893d18a194415981309e8b68 /kvm-all.c
parenta404b61244ff555ace0a1360fc22275fbeda503e (diff)
cpu: Move kvm_fd into CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 8e9a8d8fd2..8a00df72c3 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -216,6 +216,7 @@ static void kvm_reset_vcpu(void *opaque)
int kvm_init_vcpu(CPUArchState *env)
{
+ CPUState *cpu = ENV_GET_CPU(env);
KVMState *s = kvm_state;
long mmap_size;
int ret;
@@ -228,7 +229,7 @@ int kvm_init_vcpu(CPUArchState *env)
goto err;
}
- env->kvm_fd = ret;
+ cpu->kvm_fd = ret;
env->kvm_state = s;
env->kvm_vcpu_dirty = 1;
@@ -240,7 +241,7 @@ int kvm_init_vcpu(CPUArchState *env)
}
env->kvm_run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED,
- env->kvm_fd, 0);
+ cpu->kvm_fd, 0);
if (env->kvm_run == MAP_FAILED) {
ret = -errno;
DPRINTF("mmap'ing vcpu state failed\n");
@@ -1652,6 +1653,7 @@ int kvm_vm_ioctl(KVMState *s, int type, ...)
int kvm_vcpu_ioctl(CPUArchState *env, int type, ...)
{
+ CPUState *cpu = ENV_GET_CPU(env);
int ret;
void *arg;
va_list ap;
@@ -1660,7 +1662,7 @@ int kvm_vcpu_ioctl(CPUArchState *env, int type, ...)
arg = va_arg(ap, void *);
va_end(ap);
- ret = ioctl(env->kvm_fd, type, arg);
+ ret = ioctl(cpu->kvm_fd, type, arg);
if (ret == -1) {
ret = -errno;
}