From 7ba1e61953f4592606e60b2e7507ff6a6faf861a Mon Sep 17 00:00:00 2001 From: aliguori Date: Wed, 5 Nov 2008 16:04:33 +0000 Subject: Add KVM support to QEMU This patch adds very basic KVM support. KVM is a kernel module for Linux that allows userspace programs to make use of hardware virtualization support. It current supports x86 hardware virtualization using Intel VT-x or AMD-V. It also supports IA64 VT-i, PPC 440, and S390. This patch only implements the bare minimum support to get a guest booting. It has very little impact the rest of QEMU and attempts to integrate nicely with the rest of QEMU. Even though this implementation is basic, it is significantly faster than TCG. Booting and shutting down a Linux guest: w/TCG: 1:32.36 elapsed 84% CPU w/KVM: 0:31.14 elapsed 59% CPU Right now, KVM is disabled by default and must be explicitly enabled with -enable-kvm. We can enable it by default later when we have had better testing. Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5627 c046a42c-6fe2-441c-8c8c-71466251a162 --- monitor.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'monitor.c') diff --git a/monitor.c b/monitor.c index 61bd33543a..8fff3aa752 100644 --- a/monitor.c +++ b/monitor.c @@ -37,6 +37,7 @@ #include #include "qemu-timer.h" #include "migration.h" +#include "kvm.h" //#define DEBUG //#define DEBUG_COMPLETION @@ -1263,6 +1264,19 @@ static void do_info_kqemu(void) #endif } +static void do_info_kvm(void) +{ +#ifdef CONFIG_KVM + term_printf("kvm support: "); + if (kvm_enabled()) + term_printf("enabled\n"); + else + term_printf("disabled\n"); +#else + term_printf("kvm support: not compiled\n"); +#endif +} + #ifdef CONFIG_PROFILER int64_t kqemu_time; @@ -1497,6 +1511,8 @@ static const term_cmd_t info_cmds[] = { "", "show dynamic compiler info", }, { "kqemu", "", do_info_kqemu, "", "show kqemu information", }, + { "kvm", "", do_info_kvm, + "", "show kvm information", }, { "usb", "", usb_info, "", "show guest USB devices", }, { "usbhost", "", usb_host_info, -- cgit v1.2.3