Re: [PATCH v1] KVM: x86: expose AVX512_BF16 feature to guest

From: Jing Liu
Date: Mon Jul 15 2019 - 07:05:22 EST




On 7/15/2019 2:06 PM, Wanpeng Li wrote:
On Sat, 13 Jul 2019 at 18:40, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:

On 11/07/19 07:49, Jing Liu wrote:
AVX512 BFLOAT16 instructions support 16-bit BFLOAT16 floating-point
format (BF16) for deep learning optimization.

Intel adds AVX512 BFLOAT16 feature in CooperLake, which is CPUID.7.1.EAX[5].

Detailed information of the CPUID bit can be found here,
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf.

Signed-off-by: Jing Liu <jing2.liu@xxxxxxxxxxxxxxx>
---

[...]
/home/kernel/data/kvm/arch/x86/kvm//cpuid.c: In function âdo_cpuid_7_maskâ:
./include/linux/kernel.h:819:29: warning: comparison of distinct
pointer types lacks a cast
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
./include/linux/kernel.h:833:4: note: in expansion of macro â__typecheckâ
(__typecheck(x, y) && __no_side_effects(x, y))
^
./include/linux/kernel.h:843:24: note: in expansion of macro â__safe_cmpâ
__builtin_choose_expr(__safe_cmp(x, y), \
^
./include/linux/kernel.h:852:19: note: in expansion of macro â__careful_cmpâ
#define min(x, y) __careful_cmp(x, y, <)
^
/home/kernel/data/kvm/arch/x86/kvm//cpuid.c:377:16: note: in expansion
of macro âminâ
entry->eax = min(entry->eax, 1);
^

Thanks for the information.

This warning would be fixed by changing to
entry->eax = min(entry->eax, (u32)1);

@Paolo, sorry for trouble. Would you mind if I re-send?

Jing