Skip to contentSkip to conversation

target-i386: Remove POPCNT from qemu64 and qemu32 CPU models

PATCH In review Eduardo Habkost 2 participants 2 messages Nov 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: Remove POPCNT from qemu64 and qemu32 CPU models

POPCNT is not available on Penryn and older and on Opteron_G2 and older, and we want to make the default CPU runnable in most hosts, so it won't be enabled by default in KVM mode.

We should eventually have all features supported by TCG enabled by default in TCG mode, but as we don't have a good mechanism today to ensure we have different defaults in KVM and TCG mode, disable POPCNT in the qemu64 and qemu32 CPU models entirely.

---
This patch needs to be applied after the series:
Subject: [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by
default in KVM mode (in most hosts)

---
 include/hw/i386/pc.h | 10 ++++++++++
 target-i386/cpu.c    |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)
include/hw/i386/pc.h +10 -0
index 8b54863..4bbc0ff 100644
@@ -337,6 +337,16 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "qemu64" "-" TYPE_X86_CPU,\
             .property = "abm",\
             .value    = "on",\
+        },\
+        {\
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
+            .property = "popcnt",\
+            .value    = "on",\
+        },\
+        {\
+            .driver   = "qemu32" "-" TYPE_X86_CPU,\
+            .property = "popcnt",\
+            .value    = "on",\
         },
 
 #define PC_COMPAT_2_3 \
target-i386/cpu.c +2 -2
index 35cd267..5a62ef5 100644
@@ -671,7 +671,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
             CPUID_PSE36,
         .features[FEAT_1_ECX] =
-            CPUID_EXT_SSE3 | CPUID_EXT_CX16 | CPUID_EXT_POPCNT,
+            CPUID_EXT_SSE3 | CPUID_EXT_CX16,
         .features[FEAT_8000_0001_EDX] =
             CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
         .features[FEAT_8000_0001_ECX] =
@@ -771,7 +771,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_1_EDX] =
             PPRO_FEATURES,
         .features[FEAT_1_ECX] =
-            CPUID_EXT_SSE3 | CPUID_EXT_POPCNT,
+            CPUID_EXT_SSE3,
         .xlevel = 0x80000004,
     },
     {
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 55 lines · Eduardo Habkost

POPCNT is not available on Penryn and older and on Opteron_G2 and older, and we want to make the default CPU runnable in most hosts, so it won't be enabled by default in KVM mode.

We should eventually have all features supported by TCG enabled by default in TCG mode, but as we don't have a good mechanism today to ensure we have different defaults in KVM and TCG mode, disable POPCNT in the qemu64 and qemu32 CPU models entirely.

---
This patch needs to be applied after the series:
Subject: [PATCH v2 0/3] target-i386: Don't trigger CPUID warnings by
default in KVM mode (in most hosts)

---
 include/hw/i386/pc.h | 10 ++++++++++
 target-i386/cpu.c    |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)
include/hw/i386/pc.h +10 -0
index 8b54863..4bbc0ff 100644
@@ -337,6 +337,16 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "qemu64" "-" TYPE_X86_CPU,\
             .property = "abm",\
             .value    = "on",\
+        },\
+        {\
+            .driver   = "qemu64" "-" TYPE_X86_CPU,\
+            .property = "popcnt",\
+            .value    = "on",\
+        },\
+        {\
+            .driver   = "qemu32" "-" TYPE_X86_CPU,\
+            .property = "popcnt",\
+            .value    = "on",\
         },
 
 #define PC_COMPAT_2_3 \
target-i386/cpu.c +1 -1
index 35cd267..5a62ef5 100644
@@ -671,7 +671,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
             CPUID_PSE36,
         .features[FEAT_1_ECX] =
-            CPUID_EXT_SSE3 | CPUID_EXT_CX16 | CPUID_EXT_POPCNT,
+            CPUID_EXT_SSE3 | CPUID_EXT_CX16,
         .features[FEAT_8000_0001_EDX] =
             CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
         .features[FEAT_8000_0001_ECX] =

target-i386/cpu.c static X86CPUDefinition builtin_x86_defs[] = { · line 777

Quoted 8 lines
target-i386/cpu.c +1 -1
@@ -771,7 +771,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_1_EDX] =
             PPRO_FEATURES,
         .features[FEAT_1_ECX] =
-            CPUID_EXT_SSE3 | CPUID_EXT_POPCNT,
+            CPUID_EXT_SSE3,
         .xlevel = 0x80000004,
     },
     {