Skip to contentSkip to conversation

Conroe/Penryn/Nehalem CPUID family/level fixes

PATCH Applied Eduardo Habkost 3 participants 7 messages May 27, 2013 – May 30, 2013

lore
Share & tools
lore
#0 lore raw

cover Conroe/Penryn/Nehalem CPUID family/level fixes

This series changes the CPUID family and level fields of the Conroe, Penryn, and Nehalem CPU models.

Testing: those model/level values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

Eduardo Habkost (3):
pc: create pc-*-1.6 machine-types
target-i386: update model values on Conroe/Penryn/Nehalem CPU models
target-i386: set level=4 on Conroe/Penryn/Nehalem

 hw/i386/pc_piix.c    | 18 ++++++++++++++++--
 hw/i386/pc_q35.c     | 16 +++++++++++++++-
 include/hw/i386/pc.h | 28 ++++++++++++++++++++++++++++
 target-i386/cpu.c    | 12 ++++++------
 4 files changed, 65 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/3 pc: create pc-*-1.6 machine-types

Some CPU model fixes are going to be included and they will require compatibility properties in the pc-*-1.5 machine-types.

---
 hw/i386/pc_piix.c | 14 ++++++++++++--
 hw/i386/pc_q35.c  | 12 +++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)
hw/i386/pc_piix.c +12 -2
index 43ab480..c4e0391 100644
@@ -328,8 +328,8 @@ static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 }
 #endif
 
-static QEMUMachine pc_i440fx_machine_v1_5 = {
-    .name = "pc-i440fx-1.5",
+static QEMUMachine pc_i440fx_machine_v1_6 = {
+    .name = "pc-i440fx-1.6",
     .alias = "pc",
     .desc = "Standard PC (i440FX + PIIX, 1996)",
     .init = pc_init_pci,
@@ -339,6 +339,15 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
     DEFAULT_MACHINE_OPTIONS,
 };
 
+static QEMUMachine pc_i440fx_machine_v1_5 = {
+    .name = "pc-i440fx-1.5",
+    .desc = "Standard PC (i440FX + PIIX, 1996)",
+    .init = pc_init_pci,
+    .hot_add_cpu = pc_hot_add_cpu,
+    .max_cpus = 255,
+    DEFAULT_MACHINE_OPTIONS,
+};
+
 static QEMUMachine pc_i440fx_machine_v1_4 = {
     .name = "pc-i440fx-1.4",
     .desc = "Standard PC (i440FX + PIIX, 1996)",
@@ -731,6 +740,7 @@ static QEMUMachine xenfv_machine = {
 
 static void pc_machine_init(void)
 {
+    qemu_register_machine(&pc_i440fx_machine_v1_6);
     qemu_register_machine(&pc_i440fx_machine_v1_5);
     qemu_register_machine(&pc_i440fx_machine_v1_4);
     qemu_register_machine(&pc_machine_v1_3);
hw/i386/pc_q35.c +11 -1
index 7888dfe..db5c46e 100644
@@ -215,9 +215,18 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
     pc_q35_init(args);
 }
 
+static QEMUMachine pc_q35_machine_v1_6 = {
+    .name = "pc-q35-1.6",
+    .alias = "q35",
+    .desc = "Standard PC (Q35 + ICH9, 2009)",
+    .init = pc_q35_init,
+    .hot_add_cpu = pc_hot_add_cpu,
+    .max_cpus = 255,
+    DEFAULT_MACHINE_OPTIONS,
+};
+
 static QEMUMachine pc_q35_machine_v1_5 = {
     .name = "pc-q35-1.5",
-    .alias = "q35",
     .desc = "Standard PC (Q35 + ICH9, 2009)",
     .init = pc_q35_init,
     .hot_add_cpu = pc_hot_add_cpu,
@@ -239,6 +248,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
 
 static void pc_q35_machine_init(void)
 {
+    qemu_register_machine(&pc_q35_machine_v1_6);
     qemu_register_machine(&pc_q35_machine_v1_5);
     qemu_register_machine(&pc_q35_machine_v1_4);
 }
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 2/3 target-i386: update model values on Conroe/Penryn/Nehalem CPU models

In reply to Eduardo Habkost

The CPUID model values on Conroe, Penryn, and Nehalem are too conservative and don't reflect the values found on real Conroe, Penryn, and Nehalem CPUs.

This causes at least one known problems: Windows XP disables sysenter when (family == 6 && model <= 2), but Skype tries to use the sysenter instruction anyway because it is reported as available on CPUID, making it crash.

This patch sets appropriate model values that correspond to real Conroe, Penryn, and Nehalem CPUs.

---
Testing: those family/model values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

---
 hw/i386/pc_piix.c    |  4 ++++
 hw/i386/pc_q35.c     |  4 ++++
 include/hw/i386/pc.h | 16 ++++++++++++++++
 target-i386/cpu.c    |  6 +++---
 4 files changed, 27 insertions(+), 3 deletions(-)
hw/i386/pc_piix.c +4 -0
index c4e0391..b3c835e 100644
@@ -345,6 +345,10 @@ static QEMUMachine pc_i440fx_machine_v1_5 = {
     .init = pc_init_pci,
     .hot_add_cpu = pc_hot_add_cpu,
     .max_cpus = 255,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_5,
+        { /* end of list */ }
+    },
     DEFAULT_MACHINE_OPTIONS,
 };
 
hw/i386/pc_q35.c +4 -0
index db5c46e..bb0ce6a 100644
@@ -231,6 +231,10 @@ static QEMUMachine pc_q35_machine_v1_5 = {
     .init = pc_q35_init,
     .hot_add_cpu = pc_hot_add_cpu,
     .max_cpus = 255,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_5,
+        { /* end of list */ }
+    },
     DEFAULT_MACHINE_OPTIONS,
 };
 
include/hw/i386/pc.h +16 -0
index 663426c..8883b37 100644
@@ -182,7 +182,23 @@ int pvpanic_init(ISABus *bus);
 
 int e820_add_entry(uint64_t, uint64_t, uint32_t);
 
+#define PC_COMPAT_1_5 \
+        {\
+            .driver   = "Conroe-" TYPE_X86_CPU,\
+            .property = "model",\
+            .value    = stringify(2),\
+        },{\
+            .driver   = "Penryn-" TYPE_X86_CPU,\
+            .property = "model",\
+            .value    = stringify(2),\
+        },{\
+            .driver   = "Nehalem-" TYPE_X86_CPU,\
+            .property = "model",\
+            .value    = stringify(2),\
+        }
+
 #define PC_COMPAT_1_4 \
+        PC_COMPAT_1_5, \
         {\
             .driver   = "scsi-hd",\
             .property = "discard_granularity",\
target-i386/cpu.c +3 -3
index 1a501d9..6b48562 100644
@@ -672,7 +672,7 @@ static x86_def_t builtin_x86_defs[] = {
         .level = 2,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
-        .model = 2,
+        .model = 15,
         .stepping = 3,
         .features[FEAT_1_EDX] =
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
@@ -694,7 +694,7 @@ static x86_def_t builtin_x86_defs[] = {
         .level = 2,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
-        .model = 2,
+        .model = 23,
         .stepping = 3,
         .features[FEAT_1_EDX] =
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
@@ -717,7 +717,7 @@ static x86_def_t builtin_x86_defs[] = {
         .level = 2,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
-        .model = 2,
+        .model = 26,
         .stepping = 3,
         .features[FEAT_1_EDX] =
             CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 3/3 target-i386: set level=4 on Conroe/Penryn/Nehalem

In reply to Eduardo Habkost

The CPUID level value on Conroe, Penryn, and Nehalem are too low. This causes at least one known problem: the -smp "threads" option doesn't work as expect if level is < 4, because thread count information is provided to the guest on CPUID[EAX=4,ECX=2].EAX

---
Testing: those level values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

---
 include/hw/i386/pc.h | 12 ++++++++++++
 target-i386/cpu.c    |  6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)
include/hw/i386/pc.h +12 -0
index 8883b37..4351f39 100644
@@ -188,13 +188,25 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
             .property = "model",\
             .value    = stringify(2),\
         },{\
+            .driver   = "Conroe-" TYPE_X86_CPU,\
+            .property = "level",\
+            .value    = stringify(2),\
+        },{\
             .driver   = "Penryn-" TYPE_X86_CPU,\
             .property = "model",\
             .value    = stringify(2),\
         },{\
+            .driver   = "Penryn-" TYPE_X86_CPU,\
+            .property = "level",\
+            .value    = stringify(2),\
+        },{\
             .driver   = "Nehalem-" TYPE_X86_CPU,\
             .property = "model",\
             .value    = stringify(2),\
+        },{\
+            .driver   = "Nehalem-" TYPE_X86_CPU,\
+            .property = "level",\
+            .value    = stringify(2),\
         }
 
 #define PC_COMPAT_1_4 \
target-i386/cpu.c +3 -3
index 6b48562..762baad 100644
@@ -669,7 +669,7 @@ static x86_def_t builtin_x86_defs[] = {
     },
     {
         .name = "Conroe",
-        .level = 2,
+        .level = 4,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
         .model = 15,
@@ -691,7 +691,7 @@ static x86_def_t builtin_x86_defs[] = {
     },
     {
         .name = "Penryn",
-        .level = 2,
+        .level = 4,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
         .model = 23,
@@ -714,7 +714,7 @@ static x86_def_t builtin_x86_defs[] = {
     },
     {
         .name = "Nehalem",
-        .level = 2,
+        .level = 4,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 6,
         .model = 26,
Signature · 1 line
1.8.1.4
#4 lore raw
In reply to Eduardo Habkost

Am 27.05.2013 22:23, schrieb Eduardo Habkost:

Quoted 8 lines

This series changes the CPUID family and level fields of the Conroe, Penryn, and Nehalem CPU models.

Testing: those model/level values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

Quoted 4 lines

Eduardo Habkost (3):
pc: create pc-*-1.6 machine-types
target-i386: update model values on Conroe/Penryn/Nehalem CPU models
target-i386: set level=4 on Conroe/Penryn/Nehalem

Series looks good. Since we're not under time pressure yet will give others some more time for review.

Andreas

Quoted 7 lines
 hw/i386/pc_piix.c    | 18 ++++++++++++++++--
 hw/i386/pc_q35.c     | 16 +++++++++++++++-
 include/hw/i386/pc.h | 28 ++++++++++++++++++++++++++++
 target-i386/cpu.c    | 12 ++++++------
 4 files changed, 65 insertions(+), 9 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on the v1 series
#5 lore raw
In reply to Eduardo Habkost
Quoted 13 lines · On Mon, 27 May 2013 17:23:52 -0300 Eduardo Habkost <[email protected]> wrote:

This series changes the CPUID family and level fields of the Conroe, Penryn, and Nehalem CPU models.

Testing: those model/level values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

Eduardo Habkost (3):
pc: create pc-*-1.6 machine-types
target-i386: update model values on Conroe/Penryn/Nehalem CPU models
target-i386: set level=4 on Conroe/Penryn/Nehalem

Quoted 6 lines
 hw/i386/pc_piix.c    | 18 ++++++++++++++++--
 hw/i386/pc_q35.c     | 16 +++++++++++++++-
 include/hw/i386/pc.h | 28 ++++++++++++++++++++++++++++
 target-i386/cpu.c    | 12 ++++++------
 4 files changed, 65 insertions(+), 9 deletions(-)
#6 lore raw

Am 28.05.2013 11:31, schrieb Igor Mammedov:

Quoted 16 lines
Quoted 13 lines · On Mon, 27 May 2013 17:23:52 -0300 Eduardo Habkost <[email protected]> wrote:

This series changes the CPUID family and level fields of the Conroe, Penryn, and Nehalem CPU models.

Testing: those model/level values have been in use on Red Hat Enterprise Linux since version 6.0 (released in 2010). The fix wasn't submitted to QEMU earlier because we didn't have a good mechanism and clear procedure to update CPUID values of existing CPU models in QEMU.

Eduardo Habkost (3):
pc: create pc-*-1.6 machine-types
target-i386: update model values on Conroe/Penryn/Nehalem CPU models
target-i386: set level=4 on Conroe/Penryn/Nehalem

Quoted 8 lines
Quoted 6 lines
 hw/i386/pc_piix.c    | 18 ++++++++++++++++--
 hw/i386/pc_q35.c     | 16 +++++++++++++++-
 include/hw/i386/pc.h | 28 ++++++++++++++++++++++++++++
 target-i386/cpu.c    | 12 ++++++------
 4 files changed, 65 insertions(+), 9 deletions(-)

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

mst also has a patch adding a 1.6 i440fx machine, so this may need merging.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg