lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb749626-1d9e-138f-c673-14b52fe7170c@linux.intel.com>
Date:   Mon, 24 Jun 2019 11:10:03 +0800
From:   Jing Liu <jing2.liu@...ux.intel.com>
To:     Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, jing2.liu@...el.com
Subject: Re: [PATCH RFC] kvm: x86: Expose AVX512_BF16 feature to guest

Hi Paolo,

After thinking more, I found way to satisfy all cases in a easy way.
How about things like this?

@@ -507,12 +510,26 @@ static inline int __do_cpuid_ent(struct 
kvm_cpuid_entry2 *entry, u32 fu
                          * if the host doesn't support it.
                          */
                         entry->edx |= F(ARCH_CAPABILITIES);
+               } else if (index == 1) {
+                       entry->eax &= kvm_cpuid_7_1_eax_x86_features;
+                       entry->ebx = 0;
+                       entry->ecx = 0;
+                       entry->edx = 0;
                 } else {
+                       entry->eax = 0;
                         entry->ebx = 0;
                         entry->ecx = 0;
                         entry->edx = 0;
                 }
-               entry->eax = 0;
+
+               if (index == 0 && entry->eax >= 1) {
+                       entry[1].eax &= kvm_cpuid_7_1_eax_x86_features;
+                       entry[1].ebx = 0;
+                       entry[1].ecx = 0;
+                       entry[1].edx = 0;
+                       entry[1].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
+                       ++*nent;
+               }
                 break;
         }


Or you prefer that I update this into another version later?

Thanks!
Jing

On 6/20/2019 11:09 PM, Liu, Jing2 wrote:
> Hi Paolo,
> 
> On 6/20/2019 8:16 PM, Paolo Bonzini wrote:
>> On 20/06/19 13:21, Jing Liu wrote:
>>> +        for (i = 1; i <= times; i++) {
>>> +            if (*nent >= maxnent)
>>> +                goto out;
>>> +            do_cpuid_1_ent(&entry[i], function, i);
>>> +            entry[i].eax &= F(AVX512_BF16);
>>> +            entry[i].ebx = 0;
>>> +            entry[i].ecx = 0;
>>> +            entry[i].edx = 0;
>>> +            entry[i].flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
>>> +            ++*nent;
>>
>> This woud be wrong for i > 1, so instead make this
>>
>>     if (entry->eax >= 1)
>>
> 
> I am confused about the @index parameter. @index seems not used for
> every case except 0x07. Since the caller function only has @index=0, so
> all other cases except 0x07 put cpuid info from subleaf=0 to max subleaf.
> 
> What do you think about @index in current function? Does it mean, we
> need put cpuid from index to max subleaf to @entry[i]? If so, the logic
> seems as follows,
> 
> if (index == 0) {
>      // Put subleaf 0 into @entry
>      // Put subleaf 1 into @entry[1]
> } else if (index < entry->eax) {
>      // Put subleaf 1 into @entry
> } else {
>      // Put all zero into @entry
> }
> 
> But this seems not identical with other cases, for current caller
> function. Or we can simply ignore @index in 0x07 and just put all possible
> subleaf info back?
> 
>> and define F(AVX512_BF16) as a new constant kvm_cpuid_7_1_eax_features.
>>
> Got it.
> 
> 
> Thanks,
> Jing
> 
>> Paolo
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ