Skip to contentSkip to conversation

x86 fixes for -rc1

GIT PULL Applied Eduardo Habkost 2 participants 8 messages Jul 16, 2020 – Jul 17, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit ee5128bb00f90dd301991d80d1db5224ce924c84:

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2020-07-16 13:12:05 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 818b9f111d64b40661d08f5e23236ac1ca5df505:

i386: hvf: Explicitly set CR4 guest/host mask (2020-07-16 14:15:13 -0400)

----------------------------------------------------------------
x86 fixes for -rc1

Fixes for x86 that missed hard freeze:
* Don't trigger warnings for features set by CPU model versions (Xiaoyao Li)
* Missing features in Icelake-Server, Skylake-Server, Cascadelake-Server CPU models (Chenyi Qiang)
* Fix hvf x86_64 guest boot crash (Roman Bolshakov)

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

Chenyi Qiang (3):
target/i386: add fast short REP MOV support target/i386: fix model number and add missing features for
Icelake-Server CPU model
target/i386: add the missing vmx features for Skylake-Server and
Cascadelake-Server CPU models

Roman Bolshakov (1):
i386: hvf: Explicitly set CR4 guest/host mask

Xiaoyao Li (2):
i368/cpu: Clear env->user_features after loading versioned CPU model i386/cpu: Don't add unavailable_features to env->user_features

 target/i386/cpu.h     |  2 ++
 target/i386/hvf/vmx.h |  1 +
 target/i386/cpu.c     | 38 ++++++++++++++++++++++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

[PULL 2/6] i386/cpu: Don't add unavailable_features to env->user_features

From: Xiaoyao Li <[email protected]>

Features unavailable due to absent of their dependent features should not be added to env->user_features. env->user_features only contains the feature explicity specified with -feature/+feature by user.

Fixes 99e24dbdaa68 ("target/i386: introduce generic feature dependency mechanism")

Message-Id: <[email protected]>

---
 target/i386/cpu.c | 1 -
 1 file changed, 1 deletion(-)
target/i386/cpu.c +0 -1
index caf0334f3a..93b62b2eca 100644
@@ -6371,7 +6371,6 @@ static void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
                                       unavailable_features & env->user_features[d->to.index],
                                       "This feature depends on other features that were not requested");
 
-            env->user_features[d->to.index] |= unavailable_features;
             env->features[d->to.index] &= ~unavailable_features;
         }
     }
Signature · 1 line
2.26.2
#2 lore raw

[PULL 5/6] target/i386: add the missing vmx features for Skylake-Server and Cascadelake-Server CPU models

In reply to Eduardo Habkost

From: Chenyi Qiang <[email protected]>

Add the missing vmx features in Skylake-Server and Cascadelake-Server CPU models based on the output of Paolo's script.

Message-Id: <[email protected]>

---
 target/i386/cpu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
target/i386/cpu.c +14 -0
index 132ef90421..588f32e136 100644
@@ -3034,6 +3034,13 @@ static X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ }
                 }
             },
+            {
+                .version = 4,
+                .props = (PropValue[]) {
+                    { "vmx-eptp-switching", "on" },
+                    { /* end of list */ }
+                }
+            },
             { /* end of list */ }
         }
     },
@@ -3158,6 +3165,13 @@ static X86CPUDefinition builtin_x86_defs[] = {
                   { /* end of list */ }
               },
             },
+            { .version = 4,
+              .note = "ARCH_CAPABILITIES, no TSX",
+              .props = (PropValue[]) {
+                  { "vmx-eptp-switching", "on" },
+                  { /* end of list */ }
+              },
+            },
             { /* end of list */ }
         }
     },
Signature · 1 line
2.26.2
#3 lore raw

[PULL 3/6] target/i386: add fast short REP MOV support

In reply to Eduardo Habkost

From: Chenyi Qiang <[email protected]>

For CPUs support fast short REP MOV[CPUID.(EAX=7,ECX=0):EDX(bit4)], e.g Icelake and Tigerlake, expose it to the guest VM.

Message-Id: <[email protected]>

---
 target/i386/cpu.h | 2 ++
 target/i386/cpu.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
target/i386/cpu.h +2 -0
index 37fffa5cac..e1a5c174dc 100644
@@ -775,6 +775,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_0_EDX_AVX512_4VNNIW     (1U << 2)
 /* AVX512 Multiply Accumulation Single Precision */
 #define CPUID_7_0_EDX_AVX512_4FMAPS     (1U << 3)
+/* Fast Short Rep Mov */
+#define CPUID_7_0_EDX_FSRM              (1U << 4)
 /* AVX512 Vector Pair Intersection to a Pair of Mask Registers */
 #define CPUID_7_0_EDX_AVX512_VP2INTERSECT (1U << 8)
 /* SERIALIZE instruction */
target/i386/cpu.c +1 -1
index 93b62b2eca..3885826bc4 100644
@@ -984,7 +984,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
             NULL, NULL, "avx512-4vnniw", "avx512-4fmaps",
-            NULL, NULL, NULL, NULL,
+            "fsrm", NULL, NULL, NULL,
             "avx512-vp2intersect", NULL, "md-clear", NULL,
             NULL, NULL, "serialize", NULL,
             "tsx-ldtrk", NULL, NULL /* pconfig */, NULL,
Signature · 1 line
2.26.2
#4 lore raw

[PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model

In reply to Eduardo Habkost

From: Xiaoyao Li <[email protected]>

Features defined in versioned CPU model are recorded in env->user_features since they are updated as property. It's unwated because they are not user specified.

Simply clear env->user_features as a fix. It won't clear user specified features because user specified features are filled to env->user_features later in x86_cpu_expand_features().

Message-Id: <[email protected]>

[ehabkost: fix coding style]
---
 target/i386/cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)
target/i386/cpu.c +7 -0
index 1e5123251d..caf0334f3a 100644
@@ -5159,6 +5159,13 @@ static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model)
     object_property_set_str(OBJECT(cpu), "vendor", vendor, &error_abort);
 
     x86_cpu_apply_version_props(cpu, model);
+
+    /*
+     * Properties in versioned CPU model are not user specified features.
+     * We can simply clear env->user_features here since it will be filled later
+     * in x86_cpu_expand_features() based on plus_features and minus_features.
+     */
+    memset(&env->user_features, 0, sizeof(env->user_features));
 }
 
 #ifndef CONFIG_USER_ONLY
Signature · 1 line
2.26.2
#5 lore raw

[PULL 6/6] i386: hvf: Explicitly set CR4 guest/host mask

In reply to Eduardo Habkost

From: Roman Bolshakov <[email protected]>

Removal of register reset omitted initialization of CR4 guest/host mask. x86_64 guests aren't booting without it.

Fixes 5009ef22c6bb2 ("i386: hvf: Don't duplicate register reset")

Message-Id: <[email protected]>

---
 target/i386/hvf/vmx.h | 1 +
 1 file changed, 1 insertion(+)
target/i386/hvf/vmx.h +1 -0
index 75ba1e2a5f..587b1b8375 100644
@@ -166,6 +166,7 @@ static inline void macvm_set_cr4(hv_vcpuid_t vcpu, uint64_t cr4)
 
     wvmcs(vcpu, VMCS_GUEST_CR4, guest_cr4);
     wvmcs(vcpu, VMCS_CR4_SHADOW, cr4);
+    wvmcs(vcpu, VMCS_CR4_MASK, CR4_VMXE);
 
     hv_vcpu_invalidate_tlb(vcpu);
     hv_vcpu_flush(vcpu);
Signature · 1 line
2.26.2
#6 lore raw

[PULL 4/6] target/i386: fix model number and add missing features for Icelake-Server CPU model

In reply to Eduardo Habkost

From: Chenyi Qiang <[email protected]>

Add the missing features(sha_ni, avx512ifma, rdpid, fsrm, vmx-rdseed-exit, vmx-pml, vmx-eptp-switching) and change the model number to 106 in the Icelake-Server-v4 CPU model.

Message-Id: <[email protected]>

---
 target/i386/cpu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
target/i386/cpu.c +14 -0
index 3885826bc4..132ef90421 100644
@@ -3512,6 +3512,20 @@ static X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ }
                 },
             },
+            {
+                .version = 4,
+                .props = (PropValue[]) {
+                    { "sha-ni", "on" },
+                    { "avx512ifma", "on" },
+                    { "rdpid", "on" },
+                    { "fsrm", "on" },
+                    { "vmx-rdseed-exit", "on" },
+                    { "vmx-pml", "on" },
+                    { "vmx-eptp-switching", "on" },
+                    { "model", "106" },
+                    { /* end of list */ }
+                },
+            },
             { /* end of list */ }
         }
     },
Signature · 1 line
2.26.2
#7 lore raw
In reply to Eduardo Habkost
Quoted 16 lines · Eduardo Habkost

The following changes since commit ee5128bb00f90dd301991d80d1db5224ce924c84:

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2020-07-16 13:12:05 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 818b9f111d64b40661d08f5e23236ac1ca5df505:

i386: hvf: Explicitly set CR4 guest/host mask (2020-07-16 14:15:13 -0400)

----------------------------------------------------------------
x86 fixes for -rc1

Quoted 6 lines

Fixes for x86 that missed hard freeze:
* Don't trigger warnings for features set by CPU model versions (Xiaoyao Li)
* Missing features in Icelake-Server, Skylake-Server, Cascadelake-Server CPU models (Chenyi Qiang)
* Fix hvf x86_64 guest boot crash (Roman Bolshakov)

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM