[PULL 4/9] target/i386: Adjust feature level according to FEAT_7_1_EDX

Paolo Bonzini posted 9 patches 2 years, 7 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, John Snow <jsnow@redhat.com>, Cleber Rosa <crosa@redhat.com>, Beraldo Leal <bleal@redhat.com>, Michael Roth <michael.roth@amd.com>, Konstantin Kostiuk <kkostiuk@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
[PULL 4/9] target/i386: Adjust feature level according to FEAT_7_1_EDX
Posted by Paolo Bonzini 2 years, 7 months ago
From: Tao Su <tao1.su@linux.intel.com>

If FEAT_7_1_EAX is 0 and FEAT_7_1_EDX is non-zero, as is the case
with a Granite Rapids host and
'-cpu host,-avx-vnni,-avx512-bf16,-fzrm,-fsrs,-fsrc,-amx-fp16', we can't
get CPUID_7_1 leaf even though CPUID_7_1_EDX has non-zero value.

Update cpuid_level_func7 according to CPUID_7_1_EDX, otherwise
guest may report wrong maximum number sub-leaves in leaf 07H.

Fixes: eaaa197d5b11 ("target/i386: Add support for AVX-VNNI-INT8 in CPUID enumeration")
Cc: qemu-stable@nongnu.org
Signed-off-by: Tao Su <tao1.su@linux.intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-ID: <20230706054949.66556-2-tao1.su@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b5688cabb4f..952744af97c 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6880,6 +6880,7 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
         x86_cpu_adjust_feat_level(cpu, FEAT_6_EAX);
         x86_cpu_adjust_feat_level(cpu, FEAT_7_0_ECX);
         x86_cpu_adjust_feat_level(cpu, FEAT_7_1_EAX);
+        x86_cpu_adjust_feat_level(cpu, FEAT_7_1_EDX);
         x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_EDX);
         x86_cpu_adjust_feat_level(cpu, FEAT_8000_0001_ECX);
         x86_cpu_adjust_feat_level(cpu, FEAT_8000_0007_EDX);
-- 
2.41.0
Re: [PULL 4/9] target/i386: Adjust feature level according to FEAT_7_1_EDX
Posted by Michael Tokarev 2 years, 6 months ago
07.07.2023 17:04, Paolo Bonzini wrote:
> From: Tao Su <tao1.su@linux.intel.com>
> 
> If FEAT_7_1_EAX is 0 and FEAT_7_1_EDX is non-zero, as is the case
> with a Granite Rapids host and
> '-cpu host,-avx-vnni,-avx512-bf16,-fzrm,-fsrs,-fsrc,-amx-fp16', we can't
> get CPUID_7_1 leaf even though CPUID_7_1_EDX has non-zero value.
> 
> Update cpuid_level_func7 according to CPUID_7_1_EDX, otherwise
> guest may report wrong maximum number sub-leaves in leaf 07H.
> 
> Fixes: eaaa197d5b11 ("target/i386: Add support for AVX-VNNI-INT8 in CPUID enumeration")
> Cc: qemu-stable@nongnu.org

This patch is not applicable for any stable qemu releases, since the
commit it fixes (eaaa197d5b11, which also introduced FEAT_7_1_EDX) is
not in any released version, it is v8.0.0-290-geaaa197d5b.

This is just for the information (I'm not picking it up for stable),
there's nothing wrong with it tagged for stable initially.

Thanks!

/mjt