x86 fixes
The following changes since commit c5d128ffeb5357df1ea3e6de0c13b3d6a09f6064:
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20160927' into staging (2016-09-30 23:45:56 +0100)
are available in the git repository at:
git://github.com/ehabkost/qemu.git tags/x86-pull-request
for you to fetch changes up to 339892d758efb2d0954160d41736a0eac9875d67:
target-i386: Correct family/model/stepping for Opteron_G3 (2016-10-03 16:06:43 -0300)
----------------------------------------------------------------
x86 bug fixes
Fix for a XSAVE regression when using "-cpu host", and a fix on the Opteron_G3 CPU model.
----------------------------------------------------------------
Eduardo Habkost (1):
target-i386: Report known CPUID[EAX=0xD,ECX=0]:EAX bits as migratable
Evgeny Yakovlev (1):
target-i386: Correct family/model/stepping for Opteron_G3
include/hw/i386/pc.h | 15 +++++++++++++++ target-i386/cpu.c | 25 ++++++++++++++----------- 2 files changed, 29 insertions(+), 11 deletions(-)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 1/2] target-i386: Report known CPUID[EAX=0xD, ECX=0]:EAX bits as migratable
A regression was introduced by commit 96193c22a "target-i386:
Move xsave component mask to features array": all CPUID[EAX=0xD,ECX=0]:EAX bits were being reported as unmigratable because they don't have feature names defined. This broke "-cpu host" because it enables only migratable features by default.
This adds a new field to FeatureWordInfo: migratable_flags, which will make those features be reported as migratable even if they don't have a property name defined.
--- target-i386/cpu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
target-i386/cpu.c +11 -8
@@ -258,6 +258,7 @@ typedef struct FeatureWordInfo {int cpuid_reg;/* output register (R_* constant) */ uint32_t tcg_features;/* Feature flags supported by TCG */ uint32_t unmigratable_flags;/* Feature flags known to be unmigratable */ +uint32_t migratable_flags;/* Feature flags known to be migratable */ } FeatureWordInfo;static FeatureWordInfo feature_word_info[FEATURE_WORDS ] = {
@@ -494,6 +495,10 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { .cpuid_needs_ecx = true, .cpuid_ecx = 0, .cpuid_reg = R_EAX, .tcg_features = ~0U, + .migratable_flags =XSTATE_FP_MASK |XSTATE_SSE_MASK | +XSTATE_YMM_MASK |XSTATE_BNDREGS_MASK |XSTATE_BNDCSR_MASK | +XSTATE_OPMASK_MASK | XSTATE_ZMM_Hi256_MASK | XSTATE_Hi16_ZMM_MASK | + XSTATE_PKRU_MASK, }, [FEAT_XSAVE_COMP_HI] = { .cpuid_eax = 0xD,
@@ -600,15 +605,13 @@ static uint32_t x86_cpu_get_migratable_flags(FeatureWord w)for (i =0 ; i <32 ; i++) {uint32_t f =1U << i; -/* If the feature name is unknown, it is not supported by QEMU yet */ -if (!wi->feat_names[i]) { -continue ; - } -/* Skip features known to QEMU, but explicitly marked as unmigratable */ -if (wi->unmigratable_flags & f) { -continue ; + +/* If the feature name is known, it is implicitly considered migratable, +* unless it is explicitly set in unmigratable_flags */ +if ((wi->migratable_flags & f) || + (wi->feat_names[i] && !(wi->unmigratable_flags & f))) { + r |= f; } - r |= f; }return r; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 2/2] target-i386: Correct family/model/stepping for Opteron_G3
In reply to Eduardo HabkostFrom: Evgeny Yakovlev <[email protected]>
Current CPU definition for AMD Opteron third generation includes features like SSE4a and LAHF_LM support in emulated CPUID. These features are present in K8 rev.E or K10 CPUs and later. However, current G3 family and model describe 2nd generation K8 cores instead.
This is incorrect but was considered harmless until our tests found a problem with linux kernels >= 3.10 (and maybe earlier) which specifically check for Opteron K8 model when parsing CPUID leaf 0x80000001:
http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c?v=3.16#L552
This code will disable LAHF_LM feature in /proc/cpuinfo if model number is inconsistent.
This change sets Opteron_G3 family/model/stepping to 16/2/3 which is a proper Opteron 3rd generation 2350 CPU.
--- include/hw/i386/pc.h | 15 +++++++++++++++ target-i386/cpu.c | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-)
include/hw/i386/pc.h +15 -0
@@ -379,6 +379,21 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); .driver = TYPE_X86_CPU,\ .property = "full-cpuid-auto-level",\ .value = "off",\ + },\ + {\ + .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ + .property = "family",\ + .value = "15",\ + },\ + {\ + .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ + .property = "model",\ + .value = "6",\ + },\ + {\ + .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ + .property = "stepping",\ + .value = "1",\ }, #define PC_COMPAT_2_6 \
target-i386/cpu.c +3 -3
@@ -1428,9 +1428,9 @@ static X86CPUDefinition builtin_x86_defs[] = { .name = "Opteron_G3", .level = 5, .vendor = CPUID_VENDOR_AMD, - .family = 15, - .model = 6, - .stepping = 1, + .family = 16, + .model = 2, + .stepping = 3, .features[FEAT_1_EDX ] =CPUID_VME |CPUID_SSE2 |CPUID_SSE |CPUID_FXSR |CPUID_MMX | CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
Signature · 1 line
2.7.4
Peter Maydell
AppliedQuoted 12 lines · Eduardo Habkost
The following changes since commit
c5d128ffeb5357df1ea3e6de0c13b3d6a09f6064:Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20160927' into staging (2016-09-30 23:45:56 +0100)
are available in the git repository at:
git://github.com/ehabkost/qemu.gittags/x86-pull-requestfor you to fetch changes up to
339892d758efb2d0954160d41736a0eac9875d67:target-i386: Correct family/model/stepping for
Opteron_G3(2016-10-03 16:06:43 -0300)
Quoted 7 lines
----------------------------------------------------------------
x86 bug fixesFix for a XSAVE regression when using "-cpu host", and a fix on the
Opteron_G3CPU model.----------------------------------------------------------------
Applied, thanks.
-- PMM