diff mbox

[5/7] Set default 'model' property if it wasn't specified yet.

Message ID 1329347774-23262-6-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Feb. 15, 2012, 11:16 p.m. UTC
If cpu model wasn't specified at startup or hot-plug set it to default
value for the target.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/pc.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Comments

Jan Kiszka Feb. 16, 2012, 11:36 a.m. UTC | #1
On 2012-02-16 00:16, Igor Mammedov wrote:
> If cpu model wasn't specified at startup or hot-plug set it to default
> value for the target.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/pc.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pc.c b/hw/pc.c
> index 3d35d78..ec50f16 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -933,6 +933,14 @@ static int cpu_device_init(ICCBusDevice *dev)
>      CPUPC* cpu = DO_UPCAST(CPUPC, busdev, dev);
>      CPUState *env = &cpu->state;
>  
> +    if (cpu->model == NULL) {
> +#ifdef TARGET_X86_64
> +        qdev_prop_set_string(&dev->qdev, "model", g_strdup("qemu64"));
> +#else
> +        qdev_prop_set_string(&dev->qdev, "model", g_strdup("qemu32"));
> +#endif
> +    }
> +
>      if (cpu_x86_init_inplace(env, cpu->model) < 0) {
>          return -1;
>      }

This obsoletes a similar logic in pc_cpus_init. Please consolidate.

Jan
diff mbox

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 3d35d78..ec50f16 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -933,6 +933,14 @@  static int cpu_device_init(ICCBusDevice *dev)
     CPUPC* cpu = DO_UPCAST(CPUPC, busdev, dev);
     CPUState *env = &cpu->state;
 
+    if (cpu->model == NULL) {
+#ifdef TARGET_X86_64
+        qdev_prop_set_string(&dev->qdev, "model", g_strdup("qemu64"));
+#else
+        qdev_prop_set_string(&dev->qdev, "model", g_strdup("qemu32"));
+#endif
+    }
+
     if (cpu_x86_init_inplace(env, cpu->model) < 0) {
         return -1;
     }