Simon Kagstrom wrote: > This patch implements fall-back to plain Qemu if KVM is not > present. Some logic has been moved into kvm_qemu_init. > > Signed-off-by: Simon Kagstrom <[EMAIL PROTECTED]> > > [please inline patches in the future for easier reviewing]
-#if USE_KVM phys_ram_size = ram_size + vga_ram_size + bios_size; +#if USE_KVM + /* Initialize kvm */ if (kvm_allowed) { - phys_ram_size += KVM_EXTRA_PAGES * 4096; - kvm_qemu_init(); - } else { - phys_ram_base = qemu_vmalloc(phys_ram_size); - if (!phys_ram_base) { - fprintf(stderr, "Could not allocate physical memory\n"); - exit(1); - } + if (kvm_qemu_init() < 0) { + fprintf(stderr, "Could not initialize KVM\n"); + kvm_allowed = 0; + } + } + /* Fall back to normal qemu if KVM fails */ + if (!kvm_allowed) { + phys_ram_base = qemu_vmalloc(phys_ram_size); + if (!phys_ram_base) { + fprintf(stderr, "Could not allocate physical memory\n"); + exit(1); + } } #else - phys_ram_size = ram_size + vga_ram_size + bios_size; This bit is rather awkward, since it disabled kvm after it has been enabled. It's a cleaner to never enable kvm_allowed in the first place (i.e. during argument parsing). How about a int libkvm_init(kvm_libcontext_t *libcontext); void libkvm_exit(kvm_libcontext_t libcontext); int kvm_create(kvm_libcontext_t libcontext, kvm_context_t* vm); void kvm_destroy(kvm_context_t *vm); at present, libkvm_init() can just call access(2) on /dev/kvm. In the future, it is planned that open("/dev/kvm") will not create a VM (it just opens a communication channel to the driver), so that libkvm_init() will open the device and store the fd. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel