9ae3a8
commit 891c6ba393323686ace2b5ecd9c35bbde6165f2a
9ae3a8
Author: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Date:   Thu Jun 27 15:57:42 2013 +0200
9ae3a8
9ae3a8
    target-i386: Update model values on Conroe/Penryn/Nehalem CPU models
9ae3a8
    
9ae3a8
    RH-Author: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
    Message-id: <1372348663-1706-3-git-send-email-ehabkost@redhat.com>
9ae3a8
    Patchwork-id: 52252
9ae3a8
    O-Subject: [PATCH v2 2/3] target-i386: Update model values on Conroe/Penryn/Nehalem CPU models
9ae3a8
    Bugzilla: 861210
9ae3a8
    RH-Acked-by: Bandan Das <bsd@redhat.com>
9ae3a8
    RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
    RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
    
9ae3a8
    Bugzilla: 861210
9ae3a8
    (cherry picked from commit ffce9ebbb69363dfe7605585cdad58ea3847edf4)
9ae3a8
    
9ae3a8
    The CPUID model values on Conroe, Penryn, and Nehalem are too
9ae3a8
    conservative and don't reflect the values found on real Conroe, Penryn,
9ae3a8
    and Nehalem CPUs.
9ae3a8
    
9ae3a8
    This causes at least one known problems: Windows XP disables sysenter
9ae3a8
    when (family == 6 && model <= 2), but Skype tries to use the sysenter
9ae3a8
    instruction anyway because it is reported as available on CPUID, making
9ae3a8
    it crash.
9ae3a8
    
9ae3a8
    This patch sets appropriate model values that correspond to real Conroe,
9ae3a8
    Penryn, and Nehalem CPUs.
9ae3a8
    
9ae3a8
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
    Signed-off-by: Andreas Färber <afaerber@suse.de>
9ae3a8
    Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
    ---
9ae3a8
     hw/i386/pc_piix.c    |  4 ++++
9ae3a8
     hw/i386/pc_q35.c     |  4 ++++
9ae3a8
     include/hw/i386/pc.h | 16 ++++++++++++++++
9ae3a8
     target-i386/cpu.c    |  6 +++---
9ae3a8
     4 files changed, 27 insertions(+), 3 deletions(-)
9ae3a8
    
9ae3a8
    Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
9ae3a8
index d8d74a3..b52034d 100644
9ae3a8
--- a/hw/i386/pc_piix.c
9ae3a8
+++ b/hw/i386/pc_piix.c
9ae3a8
@@ -338,6 +338,10 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
9ae3a8
     .hot_add_cpu = pc_hot_add_cpu,
9ae3a8
     .max_cpus = 255,
9ae3a8
     .is_default = 1,
9ae3a8
+    .compat_props = (GlobalProperty[]) {
9ae3a8
+        PC_COMPAT_1_5,
9ae3a8
+        { /* end of list */ }
9ae3a8
+    },
9ae3a8
     DEFAULT_MACHINE_OPTIONS,
9ae3a8
 };
9ae3a8
 
9ae3a8
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
9ae3a8
index 9bcad00..0092032 100644
9ae3a8
--- a/hw/i386/pc_q35.c
9ae3a8
+++ b/hw/i386/pc_q35.c
9ae3a8
@@ -224,6 +224,10 @@ static QEMUMachine pc_q35_machine_v1_5 = {
9ae3a8
     .init = pc_q35_init,
9ae3a8
     .hot_add_cpu = pc_hot_add_cpu,
9ae3a8
     .max_cpus = 255,
9ae3a8
+    .compat_props = (GlobalProperty[]) {
9ae3a8
+        PC_COMPAT_1_5,
9ae3a8
+        { /* end of list */ }
9ae3a8
+    },
9ae3a8
     DEFAULT_MACHINE_OPTIONS,
9ae3a8
 };
9ae3a8
 
9ae3a8
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
9ae3a8
index 0242fec..4d6c9bf 100644
9ae3a8
--- a/include/hw/i386/pc.h
9ae3a8
+++ b/include/hw/i386/pc.h
9ae3a8
@@ -186,7 +186,23 @@ int pvpanic_init(ISABus *bus);
9ae3a8
 
9ae3a8
 int e820_add_entry(uint64_t, uint64_t, uint32_t);
9ae3a8
 
9ae3a8
+#define PC_COMPAT_1_5 \
9ae3a8
+        {\
9ae3a8
+            .driver   = "Conroe-" TYPE_X86_CPU,\
9ae3a8
+            .property = "model",\
9ae3a8
+            .value    = stringify(2),\
9ae3a8
+        },{\
9ae3a8
+            .driver   = "Penryn-" TYPE_X86_CPU,\
9ae3a8
+            .property = "model",\
9ae3a8
+            .value    = stringify(2),\
9ae3a8
+        },{\
9ae3a8
+            .driver   = "Nehalem-" TYPE_X86_CPU,\
9ae3a8
+            .property = "model",\
9ae3a8
+            .value    = stringify(2),\
9ae3a8
+        }
9ae3a8
+
9ae3a8
 #define PC_COMPAT_1_4 \
9ae3a8
+        PC_COMPAT_1_5, \
9ae3a8
         {\
9ae3a8
             .driver   = "scsi-hd",\
9ae3a8
             .property = "discard_granularity",\
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index ae8e682..012819a 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -672,7 +672,7 @@ static x86_def_t builtin_x86_defs[] = {
9ae3a8
         .level = 2,
9ae3a8
         .vendor = CPUID_VENDOR_INTEL,
9ae3a8
         .family = 6,
9ae3a8
-        .model = 2,
9ae3a8
+        .model = 15,
9ae3a8
         .stepping = 3,
9ae3a8
         .features[FEAT_1_EDX] =
9ae3a8
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9ae3a8
@@ -694,7 +694,7 @@ static x86_def_t builtin_x86_defs[] = {
9ae3a8
         .level = 2,
9ae3a8
         .vendor = CPUID_VENDOR_INTEL,
9ae3a8
         .family = 6,
9ae3a8
-        .model = 2,
9ae3a8
+        .model = 23,
9ae3a8
         .stepping = 3,
9ae3a8
         .features[FEAT_1_EDX] =
9ae3a8
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
9ae3a8
@@ -717,7 +717,7 @@ static x86_def_t builtin_x86_defs[] = {
9ae3a8
         .level = 2,
9ae3a8
         .vendor = CPUID_VENDOR_INTEL,
9ae3a8
         .family = 6,
9ae3a8
-        .model = 2,
9ae3a8
+        .model = 26,
9ae3a8
         .stepping = 3,
9ae3a8
         .features[FEAT_1_EDX] =
9ae3a8
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |