diff mbox

[1/3] Make kvm64 the default cpu model when kvm_enabled()

Message ID 1284479530-4748-2-git-send-email-joerg.roedel@amd.com
State New
Headers show

Commit Message

Joerg Roedel Sept. 14, 2010, 3:52 p.m. UTC
As requested by Alex this patch makes kvm64 the default CPU
model when qemu is started with -enable-kvm.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 hw/pc.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

Comments

Alexander Graf Sept. 14, 2010, 3:58 p.m. UTC | #1
Joerg Roedel wrote:
> As requested by Alex this patch makes kvm64 the default CPU
> model when qemu is started with -enable-kvm.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  hw/pc.c |   19 ++++++++++++++-----
>  1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 69b13bf..f531d0d 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -40,6 +40,16 @@
>  #include "sysbus.h"
>  #include "sysemu.h"
>  #include "blockdev.h"
> +#include "kvm.h"
> +
> +
> +#ifdef TARGET_X86_64
> +#define DEFAULT_KVM_CPU_MODEL "kvm64"
> +#define DEFAULT_QEMU_CPU_MODEL "qemu64"
> +#else
> +#define DEFAULT_KVM_CPU_MODEL "kvm32"
> +#define DEFAULT_QEMU_CPU_MODEL "qemu32"
> +#endif
>  
>  /* output Bochs bios info messages */
>  //#define DEBUG_BIOS
> @@ -867,11 +877,10 @@ void pc_cpus_init(const char *cpu_model)
>  
>      /* init CPUs */
>      if (cpu_model == NULL) {
> -#ifdef TARGET_X86_64
> -        cpu_model = "qemu64";
> -#else
> -        cpu_model = "qemu32";
> -#endif
> +        if (kvm_enabled())
> +            cpu_model = DEFAULT_KVM_CPU_MODEL;
> +        else
> +            cpu_model = DEFAULT_QEMU_CPU_MODEL;
>   

Braces :(.


Alex
Avi Kivity Sept. 16, 2010, 2:03 p.m. UTC | #2
On 09/14/2010 05:52 PM, Joerg Roedel wrote:
> As requested by Alex this patch makes kvm64 the default CPU
> model when qemu is started with -enable-kvm.
>
>

This breaks compatiblity; if started with -M 0.13 or prior we should 
default to qemu64.
Joerg Roedel Sept. 16, 2010, 2:21 p.m. UTC | #3
On Thu, Sep 16, 2010 at 10:03:19AM -0400, Avi Kivity wrote:
>   On 09/14/2010 05:52 PM, Joerg Roedel wrote:
> > As requested by Alex this patch makes kvm64 the default CPU
> > model when qemu is started with -enable-kvm.
> >
> >
> 
> This breaks compatiblity; if started with -M 0.13 or prior we should 
> default to qemu64.

Ok, I can change that. But its  ok to make kvm64 the default for
anything > 0.13?

	Joerg
Avi Kivity Sept. 16, 2010, 2:22 p.m. UTC | #4
On 09/16/2010 04:21 PM, Roedel, Joerg wrote:
> On Thu, Sep 16, 2010 at 10:03:19AM -0400, Avi Kivity wrote:
> >    On 09/14/2010 05:52 PM, Joerg Roedel wrote:
> >  >  As requested by Alex this patch makes kvm64 the default CPU
> >  >  model when qemu is started with -enable-kvm.
> >  >
> >  >
> >
> >  This breaks compatiblity; if started with -M 0.13 or prior we should
> >  default to qemu64.
>
> Ok, I can change that. But its  ok to make kvm64 the default for
> anything>  0.13?
>

Sure.
diff mbox

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 69b13bf..f531d0d 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -40,6 +40,16 @@ 
 #include "sysbus.h"
 #include "sysemu.h"
 #include "blockdev.h"
+#include "kvm.h"
+
+
+#ifdef TARGET_X86_64
+#define DEFAULT_KVM_CPU_MODEL "kvm64"
+#define DEFAULT_QEMU_CPU_MODEL "qemu64"
+#else
+#define DEFAULT_KVM_CPU_MODEL "kvm32"
+#define DEFAULT_QEMU_CPU_MODEL "qemu32"
+#endif
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -867,11 +877,10 @@  void pc_cpus_init(const char *cpu_model)
 
     /* init CPUs */
     if (cpu_model == NULL) {
-#ifdef TARGET_X86_64
-        cpu_model = "qemu64";
-#else
-        cpu_model = "qemu32";
-#endif
+        if (kvm_enabled())
+            cpu_model = DEFAULT_KVM_CPU_MODEL;
+        else
+            cpu_model = DEFAULT_QEMU_CPU_MODEL;
     }
 
     for(i = 0; i < smp_cpus; i++) {