qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c


From: Paolo Bonzini
Subject: [Qemu-devel] Re: [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c once
Date: Thu, 01 Apr 2010 22:23:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3

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

[Prev in Thread] Current Thread [Next in Thread]