From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mvegu-00020d-0I for qemu-devel@nongnu.org; Wed, 07 Oct 2009 18:09:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mvegp-0001y4-88 for qemu-devel@nongnu.org; Wed, 07 Oct 2009 18:08:59 -0400 Received: from [199.232.76.173] (port=51544 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvegp-0001xm-3Z for qemu-devel@nongnu.org; Wed, 07 Oct 2009 18:08:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39680) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mvegn-0006ty-Cg for qemu-devel@nongnu.org; Wed, 07 Oct 2009 18:08:53 -0400 From: Glauber Costa Date: Wed, 7 Oct 2009 19:08:35 -0300 Message-Id: <1254953315-5761-10-git-send-email-glommer@redhat.com> In-Reply-To: <1254953315-5761-9-git-send-email-glommer@redhat.com> References: <1254953315-5761-1-git-send-email-glommer@redhat.com> <1254953315-5761-2-git-send-email-glommer@redhat.com> <1254953315-5761-3-git-send-email-glommer@redhat.com> <1254953315-5761-4-git-send-email-glommer@redhat.com> <1254953315-5761-5-git-send-email-glommer@redhat.com> <1254953315-5761-6-git-send-email-glommer@redhat.com> <1254953315-5761-7-git-send-email-glommer@redhat.com> <1254953315-5761-8-git-send-email-glommer@redhat.com> <1254953315-5761-9-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH v2 9/9] Add -kvm option List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com This option deprecates --enable-kvm. It is a more flexible option, that makes use of qemu-opts, and allow us to pass on options to enable or disable kernel irqchip, for example. Signed-off-by: Glauber Costa --- kvm-all.c | 1 + kvm.h | 1 + qemu-config.c | 16 ++++++++++++++++ qemu-config.h | 1 + qemu-options.hx | 13 +++++++++---- vl.c | 11 +++++++++++ 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index f33354d..b31d085 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -51,6 +51,7 @@ typedef struct KVMSlot typedef struct kvm_dirty_log KVMDirtyLog; int kvm_allowed = 0; +int kvm_use_kernel_chip = 0; struct KVMState { diff --git a/kvm.h b/kvm.h index f0c9201..49a2b56 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 bafaea2..9461766 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -184,12 +184,28 @@ QemuOptsList qemu_rtc_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, &qemu_device_opts, &qemu_net_opts, &qemu_rtc_opts, + &qemu_kvm_opts, NULL, }; diff --git a/qemu-config.h b/qemu-config.h index cdad5ac..58cead2 100644 --- a/qemu-config.h +++ b/qemu-config.h @@ -6,6 +6,7 @@ extern QemuOptsList qemu_chardev_opts; extern QemuOptsList qemu_device_opts; extern QemuOptsList qemu_net_opts; extern QemuOptsList qemu_rtc_opts; +extern QemuOptsList qemu_kvm_opts; int qemu_set_option(const char *str); diff --git a/qemu-options.hx b/qemu-options.hx index 3dd76b3..1cb8431 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1431,15 +1431,20 @@ 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") -#endif +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") STEXI -@item -enable-kvm +@item -kvm [enable=on|off][,irqchip-in-kernel=on|off] Enable KVM full virtualization support. This option is only available if KVM support is enabled when compiling. ETEXI +#endif + #ifdef CONFIG_XEN DEF("xen-domid", HAS_ARG, QEMU_OPTION_xen_domid, "-xen-domid id specify xen guest domain id\n") diff --git a/vl.c b/vl.c index afe01af..a6f9eb7 100644 --- a/vl.c +++ b/vl.c @@ -5353,6 +5353,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; -- 1.6.2.5