kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM
@ 2010-07-28 12:42 Jes.Sorensen
  2010-07-28 12:42 ` [PATCH 1/2] Set a default CPU type for compat PC machine defs Jes.Sorensen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jes.Sorensen @ 2010-07-28 12:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm, anthony, avi

From: Jes Sorensen <Jes.Sorensen@redhat.com>

This set of patches adds default CPU types to the PC compat
definitions, and patch #2 sets the CPU type to kvm64/kvm32 when
running under KVM.

Long term we might want to qdev'ify the CPUs but I think it is better
to keep it simple for 0.13.

Jes Sorensen (2):
  Set a default CPU type for compat PC machine defs.
  Use kvm32/kvm64 as default CPUs when running under KVM.

 hw/boards.h  |    1 +
 hw/pc.c      |   13 +++++++++++--
 hw/pc_piix.c |   15 +++++++++++++++
 vl.c         |    2 ++
 4 files changed, 29 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Set a default CPU type for compat PC machine defs.
  2010-07-28 12:42 [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM Jes.Sorensen
@ 2010-07-28 12:42 ` Jes.Sorensen
  2010-07-28 12:42 ` [PATCH 2/2] Use kvm32/kvm64 as default CPUs when running under KVM Jes.Sorensen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jes.Sorensen @ 2010-07-28 12:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm, anthony, avi

From: Jes Sorensen <Jes.Sorensen@redhat.com>

This allows for changing the default CPU type on the current PC
definition without breaking legacy mode.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/boards.h  |    1 +
 hw/pc_piix.c |   15 +++++++++++++++
 vl.c         |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/hw/boards.h b/hw/boards.h
index 6f0f0d7..932bc23 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -19,6 +19,7 @@ typedef struct QEMUMachine {
     QEMUMachineInitFunc *init;
     int use_scsi;
     int max_cpus;
+    const char *def_cpu_model;
     unsigned int no_serial:1,
         no_parallel:1,
         use_virtcon:1,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 812ddfd..51742a0 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -223,6 +223,11 @@ static QEMUMachine pc_machine_v0_12 = {
     .desc = "Standard PC",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-serial-pci",
@@ -242,6 +247,11 @@ static QEMUMachine pc_machine_v0_11 = {
     .desc = "Standard PC, qemu 0.11",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-blk-pci",
@@ -277,6 +287,11 @@ static QEMUMachine pc_machine_v0_10 = {
     .desc = "Standard PC, qemu 0.10",
     .init = pc_init_pci,
     .max_cpus = 255,
+#ifdef TARGET_X86_64
+    .def_cpu_model = "qemu64",
+#else
+    .def_cpu_model = "qemu32",
+#endif
     .compat_props = (GlobalProperty[]) {
         {
             .driver   = "virtio-blk-pci",
diff --git a/vl.c b/vl.c
index ba6ee11..ca2c509 100644
--- a/vl.c
+++ b/vl.c
@@ -2868,6 +2868,8 @@ int main(int argc, char **argv, char **envp)
     }
     qemu_add_globals();
 
+    if ((cpu_model == NULL) && (machine->def_cpu_model))
+        cpu_model = machine->def_cpu_model;
     machine->init(ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Use kvm32/kvm64 as default CPUs when running under KVM.
  2010-07-28 12:42 [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM Jes.Sorensen
  2010-07-28 12:42 ` [PATCH 1/2] Set a default CPU type for compat PC machine defs Jes.Sorensen
@ 2010-07-28 12:42 ` Jes.Sorensen
  2010-07-28 13:49 ` [Qemu-devel] [PATCH v2 0/2] Use kvm64/kvm32 " Markus Armbruster
  2010-08-26  2:00 ` Sheng Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Jes.Sorensen @ 2010-07-28 12:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm, anthony, avi

From: Jes Sorensen <Jes.Sorensen@redhat.com>

KVM has a minimum CPU requirement in order to run, so there is no
reason to default to the very basic family 6, model 2 (or model 3 for
qemu32) CPU since the additional features are going to be available on
the host CPU.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/pc.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 58dea57..b17a199 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -39,6 +39,7 @@
 #include "msix.h"
 #include "sysbus.h"
 #include "sysemu.h"
+#include "kvm.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
@@ -866,11 +867,19 @@ void pc_cpus_init(const char *cpu_model)
 
     /* init CPUs */
     if (cpu_model == NULL) {
+        if (kvm_enabled()) {
 #ifdef TARGET_X86_64
-        cpu_model = "qemu64";
+            cpu_model = "kvm64";
 #else
-        cpu_model = "qemu32";
+            cpu_model = "kvm32";
 #endif
+        } else {
+#ifdef TARGET_X86_64
+            cpu_model = "qemu64";
+#else
+            cpu_model = "qemu32";
+#endif
+        }
     }
 
     for(i = 0; i < smp_cpus; i++) {
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM
  2010-07-28 12:42 [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM Jes.Sorensen
  2010-07-28 12:42 ` [PATCH 1/2] Set a default CPU type for compat PC machine defs Jes.Sorensen
  2010-07-28 12:42 ` [PATCH 2/2] Use kvm32/kvm64 as default CPUs when running under KVM Jes.Sorensen
@ 2010-07-28 13:49 ` Markus Armbruster
  2010-08-26  2:00 ` Sheng Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2010-07-28 13:49 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: qemu-devel, kvm, avi

Jes.Sorensen@redhat.com writes:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> This set of patches adds default CPU types to the PC compat
> definitions, and patch #2 sets the CPU type to kvm64/kvm32 when
> running under KVM.
>
> Long term we might want to qdev'ify the CPUs but I think it is better
> to keep it simple for 0.13.

Makes sense to me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM
  2010-07-28 12:42 [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM Jes.Sorensen
                   ` (2 preceding siblings ...)
  2010-07-28 13:49 ` [Qemu-devel] [PATCH v2 0/2] Use kvm64/kvm32 " Markus Armbruster
@ 2010-08-26  2:00 ` Sheng Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Sheng Yang @ 2010-08-26  2:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jes.Sorensen, kvm, avi, Anthony Liguori

On Wednesday 28 July 2010 20:42:22 Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> This set of patches adds default CPU types to the PC compat
> definitions, and patch #2 sets the CPU type to kvm64/kvm32 when
> running under KVM.
> 
> Long term we might want to qdev'ify the CPUs but I think it is better
> to keep it simple for 0.13.
 
Looks good to me.

Some Windows guest wouldn't enable MSI if it think the processor is too old. So we 
need this patchset.

--
regards
Yang, Sheng


> Jes Sorensen (2):
>   Set a default CPU type for compat PC machine defs.
>   Use kvm32/kvm64 as default CPUs when running under KVM.
> 
>  hw/boards.h  |    1 +
>  hw/pc.c      |   13 +++++++++++--
>  hw/pc_piix.c |   15 +++++++++++++++
>  vl.c         |    2 ++
>  4 files changed, 29 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-26  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-28 12:42 [PATCH v2 0/2] Use kvm64/kvm32 when running under KVM Jes.Sorensen
2010-07-28 12:42 ` [PATCH 1/2] Set a default CPU type for compat PC machine defs Jes.Sorensen
2010-07-28 12:42 ` [PATCH 2/2] Use kvm32/kvm64 as default CPUs when running under KVM Jes.Sorensen
2010-07-28 13:49 ` [Qemu-devel] [PATCH v2 0/2] Use kvm64/kvm32 " Markus Armbruster
2010-08-26  2:00 ` Sheng Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).