On 04/01/2010 10:07 PM, Blue Swirl wrote:
Remove dependency of vl.c to KVM, then we can partially revert
b33612d03540fda7fa67485f1c20395beb7a2bf0.

This is ugly...

Michael Tsirkin said in commit ca821806:

 Comment on kvm usage: rather than require users to do if(kvm_enabled())
 and/or ifdefs, this patch adds an API that, internally, is defined to
 stub function on non-kvm build, and checks kvm_enabled for non-kvm
 run.

 While rest of qemu code still uses if (kvm_enabled()), I think this
 approach is cleaner, and we should convert rest of code to it
 long term.

Maybe we can start doing this for kvm_init?

+void enable_kvm(void)
+{
+    kvm_allowed = 1;
+}

If you're adding this, this conditional from vl.c

 if (!(kvm_available())) {
     printf("Option %s not supported for this target\n", popt->name);
     exit(1);
 }

belongs in arch_init.c too, like in do_smbios_option and do_acpitable_option.

Alternatively, with the approach I gave above, you can test in kvm_maybe_init if kvm_init returns -ENOSYS, and print the error above instead of "failed to initialize KVM".

Paolo


Reply via email to