Re: [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization

2008-12-13 Thread Anthony Liguori

Hollis Blanchard wrote:

On Fri, 2008-12-12 at 18:23 -0600, Hollis Blanchard wrote:
  

When I use -cpu coreduo (for some strange reason core2duo is not
recognized), I don't segfault.



I didn't have TARGET_X86_64, so that explains the missing core2duo...
  


I'm a bit confused.  You were running -enable-kvm with qemu (as opposed 
to qemu-system-x86_64)?


Regards,

Anthony Liguori


--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization

2008-12-12 Thread Hollis Blanchard
On Thu, 2008-12-11 at 15:24 -0600, Anthony Liguori wrote:
 Hollis Blanchard wrote:
  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 holl...@us.ibm.com

 
 Segv's x86 when using -enable-kvm.

qemu.git already segvs on x86 with --enable-kvm unless you specify a
-cpu option. (I'd call that a bug.) Maybe you forgot that on this run?

When I use -cpu coreduo (for some strange reason core2duo is not
recognized), I don't segfault.

-- 
Hollis Blanchard
IBM Linux Technology Center

--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] kvm: sync vcpu state during initialization

2008-12-11 Thread 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 holl...@us.ibm.com
---
 kvm-all.c |   15 +++
 kvm.h |1 +
 vl.c  |   11 +++
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index dad80df..11034df 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -141,6 +141,21 @@ err:
 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
  */
diff --git a/kvm.h b/kvm.h
index ac464ab..efce145 100644
--- a/kvm.h
+++ b/kvm.h
@@ -31,6 +31,7 @@ struct kvm_run;
 int kvm_init(int smp_cpus);
 
 int kvm_init_vcpu(CPUState *env);
+int kvm_sync_vcpus(void);
 
 int kvm_cpu_exec(CPUState *env);
 
diff --git a/vl.c b/vl.c
index c3a8d8f..0a02151 100644
--- a/vl.c
+++ b/vl.c
@@ -5456,6 +5456,17 @@ int main(int argc, char **argv, char **envp)
 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++) {
-- 
1.5.6.5

--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH 2/6] kvm: sync vcpu state during initialization

2008-12-11 Thread Anthony Liguori

Hollis Blanchard wrote:

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 holl...@us.ibm.com
  


Segv's x86 when using -enable-kvm.

Regards,

Anthony Liguori
--
To unsubscribe from this list: send the line unsubscribe kvm-ppc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html