From patchwork Mon Oct 1 14:34:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 1531761 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0CC253FE80 for ; Mon, 1 Oct 2012 14:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751585Ab2JAOeR (ORCPT ); Mon, 1 Oct 2012 10:34:17 -0400 Received: from thoth.sbs.de ([192.35.17.2]:34746 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751535Ab2JAOeQ (ORCPT ); Mon, 1 Oct 2012 10:34:16 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q91EY8Ue002494; Mon, 1 Oct 2012 16:34:08 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q91EY7Oh010616; Mon, 1 Oct 2012 16:34:07 +0200 Message-ID: <5069A9DF.4040606@siemens.com> Date: Mon, 01 Oct 2012 16:34:07 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Anthony Liguori CC: Paolo Bonzini , Marcelo Tosatti , kvm , qemu-devel , Cole Robinson , Scott Moser , =?ISO-8859-1?Q?Andreas_F=E4rber?= , Michael Tokarev , qemu-devel , Avi Kivity Subject: [PATCH] kvm: Set default accelerator to "kvm" if the host supports it References: <20120930191146.GA20012@amt.cnet> <50694EC1.8060006@siemens.com> <20121001093102.GA14797@amt.cnet> <50696E9E.7030302@siemens.com> <87zk468h3y.fsf@codemonkey.ws> <50699CDC.1010604@redhat.com> <87wqzap9ui.fsf@codemonkey.ws> In-Reply-To: <87wqzap9ui.fsf@codemonkey.ws> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If we built a target for a host that supports KVM in principle, set the default accelerator to KVM as well. This also means the start of QEMU will fail to start if KVM support turns out to be unavailable at runtime. Signed-off-by: Jan Kiszka Acked-by: Anthony Liguori --- kvm-all.c | 1 + kvm-stub.c | 1 + kvm.h | 1 + vl.c | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 92a7137..4d5f86c 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -103,6 +103,7 @@ struct KVMState #endif }; +bool kvm_configured = true; KVMState *kvm_state; bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; diff --git a/kvm-stub.c b/kvm-stub.c index 3c52eb5..86a6451 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -17,6 +17,7 @@ #include "gdbstub.h" #include "kvm.h" +bool kvm_configured; KVMState *kvm_state; bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; diff --git a/kvm.h b/kvm.h index dea2998..9936e5f 100644 --- a/kvm.h +++ b/kvm.h @@ -22,6 +22,7 @@ #include #endif +extern bool kvm_configured; extern int kvm_allowed; extern bool kvm_kernel_irqchip; extern bool kvm_async_interrupts_allowed; diff --git a/vl.c b/vl.c index 8d305ca..f557bd1 100644 --- a/vl.c +++ b/vl.c @@ -2215,8 +2215,8 @@ static int configure_accelerator(void) } if (p == NULL) { - /* Use the default "accelerator", tcg */ - p = "tcg"; + /* The default accelerator depends on the availability of KVM. */ + p = kvm_configured ? "kvm" : "tcg"; } while (!accel_initialised && *p != '\0') {