From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxQvS-0001GG-K1 for qemu-devel@nongnu.org; Thu, 01 Apr 2010 16:23:38 -0400 Received: from [140.186.70.92] (port=39168 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxQvR-0001FN-CF for qemu-devel@nongnu.org; Thu, 01 Apr 2010 16:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxQvQ-0004Wx-1W for qemu-devel@nongnu.org; Thu, 01 Apr 2010 16:23:37 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:56519) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxQvP-0004Wt-V9 for qemu-devel@nongnu.org; Thu, 01 Apr 2010 16:23:36 -0400 Received: by gwj18 with SMTP id 18so235783gwj.4 for ; Thu, 01 Apr 2010 13:23:35 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4BB500C1.1020600@redhat.com> Date: Thu, 01 Apr 2010 22:23:29 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c once List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel 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