Skip to contentSkip to conversation

X86 fixes, 2015-11-17

GIT PULL Applied Eduardo Habkost 2 participants 4 messages Nov 17, 2015 – Nov 18, 2015

lore
Share & tools
lore
#0 lore raw

The following changes since commit 9be060f5278dc0d732ebfcf2bf0a293f88b833eb:

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2015-11-17 11:33:38 +0000)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/x86-pull-request

for you to fetch changes up to 33b5e8c03ae7a62d320d3c5c1104fe297d5c300d:

target-i386: Disable rdtscp on Opteron_G* CPU models (2015-11-17 17:05:59 -0200)

----------------------------------------------------------------
X86 fixes, 2015-11-17

Two X86 fixes, hopefully in time for -rc1.

----------------------------------------------------------------

Eduardo Habkost (1):
target-i386: Disable rdtscp on Opteron_G* CPU models

Richard Henderson (1):
target-i386: Fix mulx for identical target regs

 include/hw/i386/pc.h    | 17 +++++++++++++++++
 target-i386/cpu.c       | 12 ++++++++----
 target-i386/translate.c |  4 +++-
 3 files changed, 28 insertions(+), 5 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

[Qemu-devel] [PULL 1/2] target-i386: Fix mulx for identical target regs

From: Richard Henderson <[email protected]>

The Intel specification clearly indicates that the low part of the result is written first and the high part of the result is written second; thus if ModRM:reg and VEX.vvvv are identical, the final result should be the high part of the result.

At present, TCG may either produce incorrect results or crash with --enable-checking.

---
 target-i386/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target-i386/translate.c +3 -1
index fbe4f80..a3dd167 100644
@@ -3848,8 +3848,10 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
                     break;
 #ifdef TARGET_X86_64
                 case MO_64:
-                    tcg_gen_mulu2_i64(cpu_regs[s->vex_v], cpu_regs[reg],
+                    tcg_gen_mulu2_i64(cpu_T[0], cpu_T[1],
                                       cpu_T[0], cpu_regs[R_EDX]);
+                    tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T[0]);
+                    tcg_gen_mov_i64(cpu_regs[reg], cpu_T[1]);
                     break;
 #endif
                 }
Signature · 1 line
2.1.0
#2 lore raw

[Qemu-devel] [PULL 2/2] target-i386: Disable rdtscp on Opteron_G* CPU models

In reply to Eduardo Habkost

KVM can't virtualize rdtscp on AMD CPUs yet, so there's no point in enabling it by default on AMD CPU models, as all we are getting are confused users because of the "host doesn't support requested feature" warnings.

Disable rdtscp on Opteron_G* models, but keep compatibility on pc-*-2.4 and older (just in case there are people are doing funny stuff using AMD CPU models on Intel hosts).

---
 include/hw/i386/pc.h | 17 +++++++++++++++++
 target-i386/cpu.c    | 12 ++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)
include/hw/i386/pc.h +17 -0
index 4bbc0ff..854c330 100644
@@ -347,8 +347,25 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
             .driver   = "qemu32" "-" TYPE_X86_CPU,\
             .property = "popcnt",\
             .value    = "on",\
+        },{\
+            .driver   = "Opteron_G2" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G4" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
+        },{\
+            .driver   = "Opteron_G5" "-" TYPE_X86_CPU,\
+            .property = "rdtscp",\
+            .value    = "on",\
         },
 
+
 #define PC_COMPAT_2_3 \
         PC_COMPAT_2_4 \
         HW_COMPAT_2_3 \
target-i386/cpu.c +8 -4
index e5f1c5b..11e5e39 100644
@@ -1244,8 +1244,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_DE | CPUID_FP87,
         .features[FEAT_1_ECX] =
             CPUID_EXT_CX16 | CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_FXSR |
+            CPUID_EXT2_LM | CPUID_EXT2_FXSR |
             CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PSE36 |
             CPUID_EXT2_PAT | CPUID_EXT2_CMOV | CPUID_EXT2_MCA |
             CPUID_EXT2_PGE | CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL |
@@ -1273,8 +1274,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .features[FEAT_1_ECX] =
             CPUID_EXT_POPCNT | CPUID_EXT_CX16 | CPUID_EXT_MONITOR |
             CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_FXSR |
+            CPUID_EXT2_LM | CPUID_EXT2_FXSR |
             CPUID_EXT2_MMX | CPUID_EXT2_NX | CPUID_EXT2_PSE36 |
             CPUID_EXT2_PAT | CPUID_EXT2_CMOV | CPUID_EXT2_MCA |
             CPUID_EXT2_PGE | CPUID_EXT2_MTRR | CPUID_EXT2_SYSCALL |
@@ -1305,8 +1307,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_POPCNT | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 |
             CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ |
             CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP |
+            CPUID_EXT2_LM |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
@@ -1340,8 +1343,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 |
             CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_FMA |
             CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3,
+        /* Missing: CPUID_EXT2_RDTSCP */
         .features[FEAT_8000_0001_EDX] =
-            CPUID_EXT2_LM | CPUID_EXT2_RDTSCP |
+            CPUID_EXT2_LM |
             CPUID_EXT2_PDPE1GB | CPUID_EXT2_FXSR | CPUID_EXT2_MMX |
             CPUID_EXT2_NX | CPUID_EXT2_PSE36 | CPUID_EXT2_PAT |
             CPUID_EXT2_CMOV | CPUID_EXT2_MCA | CPUID_EXT2_PGE |
Signature · 1 line
2.1.0
#3 lore raw
In reply to Eduardo Habkost
Quoted 17 lines · Eduardo Habkost

The following changes since commit 9be060f5278dc0d732ebfcf2bf0a293f88b833eb:

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2015-11-17 11:33:38 +0000)

are available in the git repository at:

git://github.com/ehabkost/qemu.git tags/x86-pull-request

for you to fetch changes up to 33b5e8c03ae7a62d320d3c5c1104fe297d5c300d:

target-i386: Disable rdtscp on Opteron_G* CPU models (2015-11-17 17:05:59 -0200)

----------------------------------------------------------------
X86 fixes, 2015-11-17

Two X86 fixes, hopefully in time for -rc1.

Quoted 7 lines

----------------------------------------------------------------

Eduardo Habkost (1):
target-i386: Disable rdtscp on Opteron_G* CPU models

Richard Henderson (1):
target-i386: Fix mulx for identical target regs

Applied, thanks.

-- PMM