Loading cpu-defs.h +0 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,6 @@ typedef struct CPUWatchpoint { const char *cpu_model_str; \ struct KVMState *kvm_state; \ struct kvm_run *kvm_run; \ int kvm_fd; \ int kvm_vcpu_dirty; #endif include/qemu/cpu.h +5 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ typedef struct CPUClass { * @created: Indicates whether the CPU thread has been successfully created. * @stop: Indicates a pending stop request. * @stopped: Indicates the CPU has been artificially stopped. * @kvm_fd: vCPU file descriptor for KVM. * * State of one CPU core or thread. */ Loading @@ -77,6 +78,10 @@ struct CPUState { bool stop; bool stopped; #if !defined(CONFIG_USER_ONLY) int kvm_fd; #endif /* TODO Move common fields from CPUArchState here. */ }; Loading kvm-all.c +5 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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; Loading @@ -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; } Loading Loading
cpu-defs.h +0 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,6 @@ typedef struct CPUWatchpoint { const char *cpu_model_str; \ struct KVMState *kvm_state; \ struct kvm_run *kvm_run; \ int kvm_fd; \ int kvm_vcpu_dirty; #endif
include/qemu/cpu.h +5 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ typedef struct CPUClass { * @created: Indicates whether the CPU thread has been successfully created. * @stop: Indicates a pending stop request. * @stopped: Indicates the CPU has been artificially stopped. * @kvm_fd: vCPU file descriptor for KVM. * * State of one CPU core or thread. */ Loading @@ -77,6 +78,10 @@ struct CPUState { bool stop; bool stopped; #if !defined(CONFIG_USER_ONLY) int kvm_fd; #endif /* TODO Move common fields from CPUArchState here. */ }; Loading
kvm-all.c +5 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading @@ -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"); Loading Loading @@ -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; Loading @@ -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; } Loading