All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/6] x86 fixes for -rc1
@ 2020-07-16 18:18 Eduardo Habkost
  2020-07-16 18:18 ` [PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model Eduardo Habkost
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:18 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Roman Bolshakov, Eduardo Habkost,
	Cameron Esfahani, Richard Henderson

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(-)

-- 
2.26.2




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
@ 2020-07-16 18:18 ` Eduardo Habkost
  2020-07-16 18:18 ` [PULL 2/6] i386/cpu: Don't add unavailable_features to env->user_features Eduardo Habkost
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:18 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Eduardo Habkost, Xiaoyao Li, Chenyi Qiang, Cameron Esfahani,
	Roman Bolshakov, Paolo Bonzini, Richard Henderson

From: Xiaoyao Li <xiaoyao.li@intel.com>

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().

Cc: Chenyi Qiang <chenyi.qiang@intel.com>
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20200713174436.41070-2-xiaoyao.li@intel.com>
[ehabkost: fix coding style]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1e5123251d..caf0334f3a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 2/6] i386/cpu: Don't add unavailable_features to env->user_features
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
  2020-07-16 18:18 ` [PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model Eduardo Habkost
@ 2020-07-16 18:18 ` Eduardo Habkost
  2020-07-16 18:19 ` [PULL 3/6] target/i386: add fast short REP MOV support Eduardo Habkost
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:18 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Eduardo Habkost, Xiaoyao Li, Cameron Esfahani, Roman Bolshakov,
	Paolo Bonzini, Richard Henderson

From: Xiaoyao Li <xiaoyao.li@intel.com>

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")
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20200713174436.41070-3-xiaoyao.li@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index caf0334f3a..93b62b2eca 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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;
         }
     }
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 3/6] target/i386: add fast short REP MOV support
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
  2020-07-16 18:18 ` [PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model Eduardo Habkost
  2020-07-16 18:18 ` [PULL 2/6] i386/cpu: Don't add unavailable_features to env->user_features Eduardo Habkost
@ 2020-07-16 18:19 ` Eduardo Habkost
  2020-07-16 18:19 ` [PULL 4/6] target/i386: fix model number and add missing features for Icelake-Server CPU model Eduardo Habkost
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:19 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Eduardo Habkost, Chenyi Qiang, Cameron Esfahani, Roman Bolshakov,
	Paolo Bonzini, Richard Henderson

From: Chenyi Qiang <chenyi.qiang@intel.com>

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.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Message-Id: <20200714084148.26690-2-chenyi.qiang@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.h | 2 ++
 target/i386/cpu.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 37fffa5cac..e1a5c174dc 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -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 */
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 93b62b2eca..3885826bc4 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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,
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 4/6] target/i386: fix model number and add missing features for Icelake-Server CPU model
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
                   ` (2 preceding siblings ...)
  2020-07-16 18:19 ` [PULL 3/6] target/i386: add fast short REP MOV support Eduardo Habkost
@ 2020-07-16 18:19 ` Eduardo Habkost
  2020-07-16 18:19 ` [PULL 5/6] target/i386: add the missing vmx features for Skylake-Server and Cascadelake-Server CPU models Eduardo Habkost
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:19 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Eduardo Habkost, Chenyi Qiang, Cameron Esfahani, Roman Bolshakov,
	Paolo Bonzini, Richard Henderson

From: Chenyi Qiang <chenyi.qiang@intel.com>

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.

Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Message-Id: <20200714084148.26690-3-chenyi.qiang@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3885826bc4..132ef90421 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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 */ }
         }
     },
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 5/6] target/i386: add the missing vmx features for Skylake-Server and Cascadelake-Server CPU models
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
                   ` (3 preceding siblings ...)
  2020-07-16 18:19 ` [PULL 4/6] target/i386: fix model number and add missing features for Icelake-Server CPU model Eduardo Habkost
@ 2020-07-16 18:19 ` Eduardo Habkost
  2020-07-16 18:19 ` [PULL 6/6] i386: hvf: Explicitly set CR4 guest/host mask Eduardo Habkost
  2020-07-17  9:38 ` [PULL 0/6] x86 fixes for -rc1 Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:19 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Eduardo Habkost, Chenyi Qiang, Cameron Esfahani, Roman Bolshakov,
	Paolo Bonzini, Richard Henderson

From: Chenyi Qiang <chenyi.qiang@intel.com>

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

Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
Message-Id: <20200714084148.26690-4-chenyi.qiang@intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 132ef90421..588f32e136 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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 */ }
         }
     },
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 6/6] i386: hvf: Explicitly set CR4 guest/host mask
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
                   ` (4 preceding siblings ...)
  2020-07-16 18:19 ` [PULL 5/6] target/i386: add the missing vmx features for Skylake-Server and Cascadelake-Server CPU models Eduardo Habkost
@ 2020-07-16 18:19 ` Eduardo Habkost
  2020-07-17  9:38 ` [PULL 0/6] x86 fixes for -rc1 Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Eduardo Habkost @ 2020-07-16 18:19 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Paolo Bonzini, Roman Bolshakov, Eduardo Habkost,
	Cameron Esfahani, Richard Henderson

From: Roman Bolshakov <r.bolshakov@yadro.com>

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")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Message-Id: <20200714090726.41082-1-r.bolshakov@yadro.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/hvf/vmx.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/hvf/vmx.h b/target/i386/hvf/vmx.h
index 75ba1e2a5f..587b1b8375 100644
--- a/target/i386/hvf/vmx.h
+++ b/target/i386/hvf/vmx.h
@@ -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);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PULL 0/6] x86 fixes for -rc1
  2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
                   ` (5 preceding siblings ...)
  2020-07-16 18:19 ` [PULL 6/6] i386: hvf: Explicitly set CR4 guest/host mask Eduardo Habkost
@ 2020-07-17  9:38 ` Peter Maydell
  6 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2020-07-17  9:38 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Roman Bolshakov, QEMU Developers,
	Cameron Esfahani, Richard Henderson

On Thu, 16 Jul 2020 at 19:19, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> 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)


Applied, thanks.

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

-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-17  9:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 18:18 [PULL 0/6] x86 fixes for -rc1 Eduardo Habkost
2020-07-16 18:18 ` [PULL 1/6] i368/cpu: Clear env->user_features after loading versioned CPU model Eduardo Habkost
2020-07-16 18:18 ` [PULL 2/6] i386/cpu: Don't add unavailable_features to env->user_features Eduardo Habkost
2020-07-16 18:19 ` [PULL 3/6] target/i386: add fast short REP MOV support Eduardo Habkost
2020-07-16 18:19 ` [PULL 4/6] target/i386: fix model number and add missing features for Icelake-Server CPU model Eduardo Habkost
2020-07-16 18:19 ` [PULL 5/6] target/i386: add the missing vmx features for Skylake-Server and Cascadelake-Server CPU models Eduardo Habkost
2020-07-16 18:19 ` [PULL 6/6] i386: hvf: Explicitly set CR4 guest/host mask Eduardo Habkost
2020-07-17  9:38 ` [PULL 0/6] x86 fixes for -rc1 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.