From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCLo0-0007Ef-CF for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:20:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCLnz-0007E6-Ph for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:20:47 -0500 Received: from [199.232.76.173] (port=37405 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCLnz-0007E0-Ax for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:20:47 -0500 Received: from savannah.gnu.org ([199.232.41.3]:47434 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCLny-0001o3-RF for qemu-devel@nongnu.org; Mon, 15 Dec 2008 17:20:47 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LCLnw-0007uP-Er for qemu-devel@nongnu.org; Mon, 15 Dec 2008 22:20:44 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LCLnv-0007uJ-9r for qemu-devel@nongnu.org; Mon, 15 Dec 2008 22:20:43 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Mon, 15 Dec 2008 22:20:43 +0000 Subject: [Qemu-devel] [6060] kvm: sync vcpu state during initialization (Hollis Blanchard) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6060 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6060 Author: aliguori Date: 2008-12-15 22:20:42 +0000 (Mon, 15 Dec 2008) Log Message: ----------- kvm: sync vcpu state during initialization (Hollis Blanchard) Currently on x86, qemu initializes CPUState but KVM ignores it and does its own vcpu initialization. However, PowerPC KVM needs to be able to set the initial register state to support the -kernel and -append options. Signed-off-by: Hollis Blanchard Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/kvm-all.c trunk/kvm.h trunk/vl.c Modified: trunk/kvm-all.c =================================================================== --- trunk/kvm-all.c 2008-12-15 22:07:50 UTC (rev 6059) +++ trunk/kvm-all.c 2008-12-15 22:20:42 UTC (rev 6060) @@ -141,6 +141,21 @@ return ret; } +int kvm_sync_vcpus(void) +{ + CPUState *env; + + for (env = first_cpu; env != NULL; env = env->next_cpu) { + int ret; + + ret = kvm_arch_put_registers(env); + if (ret) + return ret; + } + + return 0; +} + /* * dirty pages logging control */ Modified: trunk/kvm.h =================================================================== --- trunk/kvm.h 2008-12-15 22:07:50 UTC (rev 6059) +++ trunk/kvm.h 2008-12-15 22:20:42 UTC (rev 6060) @@ -31,6 +31,7 @@ int kvm_init(int smp_cpus); int kvm_init_vcpu(CPUState *env); +int kvm_sync_vcpus(void); int kvm_cpu_exec(CPUState *env); Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-12-15 22:07:50 UTC (rev 6059) +++ trunk/vl.c 2008-12-15 22:20:42 UTC (rev 6060) @@ -5456,6 +5456,17 @@ machine->init(ram_size, vga_ram_size, boot_devices, ds, kernel_filename, kernel_cmdline, initrd_filename, cpu_model); + /* Set KVM's vcpu state to qemu's initial CPUState. */ + if (kvm_enabled()) { + int ret; + + ret = kvm_sync_vcpus(); + if (ret < 0) { + fprintf(stderr, "failed to initialize vcpus\n"); + exit(1); + } + } + /* init USB devices */ if (usb_enabled) { for(i = 0; i < usb_devices_index; i++) {