@@ -5823,6 +5823,20 @@ int main(int argc, char **argv, char **envp)
signal(SIGTTIN, SIG_IGN);
}
+ if (kvm_enabled()) {
+ int ret;
+
+ ret = kvm_init(smp_cpus);
+ if (ret < 0) {
+#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
+ fprintf(stderr, "failed to initialize KVM\n");
+ exit(1);
+#endif
+ fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
+ kvm_allowed = 0;
+ }
+ }
+
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
if (daemonize) {
uint8_t status = 1;
@@ -5983,20 +5997,6 @@ int main(int argc, char **argv, char **envp)
}
}
- if (kvm_enabled()) {
- int ret;
-
- ret = kvm_init(smp_cpus);
- if (ret < 0) {
-#if defined(KVM_UPSTREAM) || defined(NO_CPU_EMULATION)
- fprintf(stderr, "failed to initialize KVM\n");
- exit(1);
-#endif
- fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
- kvm_allowed = 0;
- }
- }
-
if (monitor_device) {
monitor_hd = qemu_chr_open("monitor", monitor_device, NULL);
if (!monitor_hd) {