From patchwork Fri Feb 26 20:12:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 82444 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1QKD36g019498 for ; Fri, 26 Feb 2010 20:13:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966015Ab0BZUMj (ORCPT ); Fri, 26 Feb 2010 15:12:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55627 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966003Ab0BZUMg (ORCPT ); Fri, 26 Feb 2010 15:12:36 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1QKCZi4005986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Feb 2010 15:12:35 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1QKCMPR012766; Fri, 26 Feb 2010 15:12:34 -0500 From: Glauber Costa To: kvm@vger.kernel.org Cc: mtosatti@redhat.com Subject: [PATCH 08/10] Add -kvm option Date: Fri, 26 Feb 2010 17:12:19 -0300 Message-Id: <1267215141-13629-9-git-send-email-glommer@redhat.com> In-Reply-To: <1267215141-13629-8-git-send-email-glommer@redhat.com> References: <1267215141-13629-1-git-send-email-glommer@redhat.com> <1267215141-13629-2-git-send-email-glommer@redhat.com> <1267215141-13629-3-git-send-email-glommer@redhat.com> <1267215141-13629-4-git-send-email-glommer@redhat.com> <1267215141-13629-5-git-send-email-glommer@redhat.com> <1267215141-13629-6-git-send-email-glommer@redhat.com> <1267215141-13629-7-git-send-email-glommer@redhat.com> <1267215141-13629-8-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 26 Feb 2010 20:13:04 +0000 (UTC) diff --git a/kvm-all.c b/kvm-all.c index 00e7411..0527e0f 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -52,6 +52,7 @@ typedef struct KVMSlot typedef struct kvm_dirty_log KVMDirtyLog; int kvm_allowed = 0; +int kvm_use_kernel_chip = 1; struct KVMState { diff --git a/kvm.h b/kvm.h index 7278874..480e651 100644 --- a/kvm.h +++ b/kvm.h @@ -20,6 +20,7 @@ #ifdef CONFIG_KVM extern int kvm_allowed; +extern int kvm_use_kernel_chip; #define kvm_enabled() (kvm_allowed) #else diff --git a/qemu-config.c b/qemu-config.c index 246fae6..310838e 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -290,6 +290,21 @@ QemuOptsList qemu_cpudef_opts = { }, }; +QemuOptsList qemu_kvm_opts = { + .name = "kvm", + .head = QTAILQ_HEAD_INITIALIZER(qemu_kvm_opts.head), + .desc = { + { + .name = "irqchip-in-kernel", + .type = QEMU_OPT_BOOL, + },{ + .name = "enabled", + .type = QEMU_OPT_BOOL, + }, + { /* end if list */ } + }, +}; + static QemuOptsList *lists[] = { &qemu_drive_opts, &qemu_chardev_opts, @@ -300,6 +315,7 @@ static QemuOptsList *lists[] = { &qemu_global_opts, &qemu_mon_opts, &qemu_cpudef_opts, + &qemu_kvm_opts, NULL, }; diff --git a/qemu-config.h b/qemu-config.h index b335c42..506e5fb 100644 --- a/qemu-config.h +++ b/qemu-config.h @@ -10,6 +10,7 @@ extern QemuOptsList qemu_rtc_opts; extern QemuOptsList qemu_global_opts; extern QemuOptsList qemu_mon_opts; extern QemuOptsList qemu_cpudef_opts; +extern QemuOptsList qemu_kvm_opts; int qemu_set_option(const char *str); int qemu_global_option(const char *str); diff --git a/qemu-options.hx b/qemu-options.hx index 3f49b44..f8fd86d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1793,10 +1793,17 @@ Set the filename for the BIOS. ETEXI #ifdef CONFIG_KVM -DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \ - "-enable-kvm enable KVM full virtualization support\n") +HXCOMM Options deprecated by -kvm +DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, "") + +DEF("kvm", HAS_ARG, QEMU_OPTION_kvm, \ + "-kvm enable=on|off,irqchip-in-kernel=on|off\n" \ + " enable KVM full virtualization support\n") + #endif STEXI +@item -kvm enable=[on|off][,irqchip-in-kernel=on|off] +@findex -kvm @item -enable-kvm @findex -enable-kvm Enable KVM full virtualization support. This option is only available diff --git a/vl.c b/vl.c index 66e477a..8c94fee 100644 --- a/vl.c +++ b/vl.c @@ -5416,6 +5416,17 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_enable_kvm: kvm_allowed = 1; break; + case QEMU_OPTION_kvm: + + opts = qemu_opts_parse(&qemu_kvm_opts, optarg, NULL); + if (!opts) { + fprintf(stderr, "parse error: %s\n", optarg); + exit(1); + } + + kvm_allowed = qemu_opt_get_bool(opts, "enabled", 1); + kvm_use_kernel_chip = qemu_opt_get_bool(opts, "irqchip-in-kernel", 1); + break; #endif case QEMU_OPTION_usb: usb_enabled = 1;