#include "msix.h"
#include "qemu-timer.h"
#include "host-utils.h"
+#include "kvm.h"
//#define DEBUG_APIC
*/
s->lvt[APIC_LVT_LINT0] = 0x700;
}
+
+ cpu_synchronize_state(s->cpu_env, 1);
}
static CPUReadMemoryFunc *apic_mem_read[3] = {
return kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
}
+static void kvm_reset_vcpu(void *opaque)
+{
+ CPUState *env = opaque;
+
+ if (kvm_arch_put_registers(env)) {
+ fprintf(stderr, "Fatal: kvm vcpu reset failed\n");
+ abort();
+ }
+}
int kvm_init_vcpu(CPUState *env)
{
}
ret = kvm_arch_init_vcpu(env);
-
+ if (ret == 0) {
+ qemu_register_reset(kvm_reset_vcpu, 0, env);
+ ret = kvm_arch_put_registers(env);
+ }
err:
return ret;
}
return 0;
}
-int kvm_sync_vcpus(void)
-{
- CPUState *env;
-
- for (env = first_cpu; env != NULL; env = env->next_cpu) {
- int ret;
-
- ret = kvm_arch_put_registers(env);
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
/*
* dirty pages logging control
*/
return ret;
}
-static void kvm_reset_vcpus(void *opaque)
-{
- kvm_sync_vcpus();
-}
-
int kvm_init(int smp_cpus)
{
static const char upgrade_note[] =
if (ret < 0)
goto err;
- qemu_register_reset(kvm_reset_vcpus, INT_MAX, NULL);
-
kvm_state = s;
return 0;
int kvm_init(int smp_cpus);
int kvm_init_vcpu(CPUState *env);
-int kvm_sync_vcpus(void);
int kvm_cpu_exec(CPUState *env);
current_machine = machine;
- /* Set KVM's vcpu state to qemu's initial CPUState. */
- if (kvm_enabled()) {
- int ret;
-
- ret = kvm_sync_vcpus();
- if (ret < 0) {
- fprintf(stderr, "failed to initialize vcpus\n");
- exit(1);
- }
- }
-
/* init USB devices */
if (usb_enabled) {
for(i = 0; i < usb_devices_index; i++) {