From: Paolo Bonzini <pbonzini@redhat.com>
To: Jing Liu <jing2.liu@linux.intel.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1] x86: Intel AVX512_BF16 feature enabling
Date: Mon, 22 Jul 2019 13:50:21 +0200 [thread overview]
Message-ID: <3bc3b6f0-a6f8-39a7-b7d4-39b18916cc44@redhat.com> (raw)
In-Reply-To: <4e381ae0-78d5-afb6-9a4d-b58d0daa60ba@linux.intel.com>
On 22/07/19 04:59, Jing Liu wrote:
>
>
> On 7/19/2019 4:10 PM, Paolo Bonzini wrote:
>> On 19/07/19 09:20, Jing Liu wrote:
>>>> Then CPUID[7,0].EAX is set automatically to 0 or 1 depending on whether
>>>> BF16 is enabled or not.
>>>
>>> Could I ask why don't we directly check BF16 enabling when
>>> cpu_x86_cpuid(env, 7, 0, ...) during kvm_arch_init_vcpu ?
>>
>> Because the code for setting CPUID is common for all accelerators (there
>> are five supported: KVM, HAX, HVF, TCG, WHPX).
>>
>>> What is the use of the two new properties? Are they used for users
>>> setting parameters when boot up guest, and why we need users setting
>>> func7 level?
>>
>> For example to test guests with CPUID[7,0].EAX==1, even if the host does
>> not have BF16.
>
> Thanks. :)
>>
>>
>>> @@ -5075,6 +5101,10 @@ static void x86_cpu_expand_features(X86CPU *cpu,
>>> Error **errp)
>>> x86_cpu_adjust_feat_level(cpu, FEAT_SVM);
>>> x86_cpu_adjust_feat_level(cpu, FEAT_XSAVE);
>>>
>>> + if ((env->features[FEAT_7_1_EAX] & CPUID_7_1_EAX_AVX512_BF16) &&
>>> + kvm_enabled()) {
>>
>> No need to check KVM. You could also do just
>> x86_cpu_adjust_feat_level(cpu, FEAT_7_1_EAX) and set
>> cpu->min_level_func7 in x86_cpu_adjust_feat_level with something like
>>
>> if (eax == 7) {
>> x86_cpu_adjust_level(cpu, &env->cpu_min_level_func7,
>> fi->cpuid.ecx);
>> }
>>
>
> Got it. One question I'm wondering is, is it possible for users setting
> an invalid property like level-func7=2? Do we need some protection?
No, it's still not found in Intel silicon, but in principle you could
have higher indices than 1. So it's okay, if something breaks it's the
fault of whoever set the option!
Paolo
next prev parent reply other threads:[~2019-07-22 11:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 5:38 [Qemu-devel] [PATCH v1] x86: Intel AVX512_BF16 feature enabling Jing Liu
2019-07-11 5:47 ` no-reply
2019-07-18 4:55 ` Jing Liu
2019-07-18 8:15 ` Paolo Bonzini
2019-07-19 7:20 ` Jing Liu
2019-07-19 8:10 ` Paolo Bonzini
2019-07-22 2:59 ` Jing Liu
2019-07-22 11:50 ` Paolo Bonzini [this message]
2019-07-24 12:05 ` Jing Liu
2019-07-24 12:12 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3bc3b6f0-a6f8-39a7-b7d4-39b18916cc44@redhat.com \
--to=pbonzini@redhat.com \
--cc=jing2.liu@linux.intel.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).