kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: Expose new cpu features to guest
@ 2017-11-22  7:27 Yang Zhong
  2017-11-24  2:35 ` kbuild test robot
  2017-12-05 21:43 ` Radim Krčmář
  0 siblings, 2 replies; 6+ messages in thread
From: Yang Zhong @ 2017-11-22  7:27 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, yang.zhong

Intel IceLake cpu has added new cpu features,AVX512_VBMI2/GFNI/
VAES/VPCLMULQDQ/AVX512_VNNI/AVX512_BITALG. Those new cpu features
need expose to guest VM.

The bit definition:
CPUID.(EAX=7,ECX=0):ECX[bit 06] AVX512_VBMI2
CPUID.(EAX=7,ECX=0):ECX[bit 08] GFNI
CPUID.(EAX=7,ECX=0):ECX[bit 09] VAES
CPUID.(EAX=7,ECX=0):ECX[bit 10] VPCLMULQDQ
CPUID.(EAX=7,ECX=0):ECX[bit 11] AVX512_VNNI
CPUID.(EAX=7,ECX=0):ECX[bit 12] AVX512_BITALG

The release document ref below link:
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

The kernel dependency commit in kvm.git:
(c128dbfa0f879f8ce7b79054037889b0b2240728)

Signed-off-by: Yang Zhong <yang.zhong@intel.com>
---
 arch/x86/kvm/cpuid.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 0099e10..c604dd5 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -387,8 +387,9 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 
 	/* cpuid 7.0.ecx*/
 	const u32 kvm_cpuid_7_0_ecx_x86_features =
-		F(AVX512VBMI) | F(LA57) | F(PKU) |
-		0 /*OSPKE*/ | F(AVX512_VPOPCNTDQ);
+		F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ |
+		F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
+		F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
 
 	/* cpuid 7.0.edx*/
 	const u32 kvm_cpuid_7_0_edx_x86_features =
-- 
1.9.1

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

* Re: [PATCH] KVM: Expose new cpu features to guest
  2017-11-22  7:27 [PATCH] KVM: Expose new cpu features to guest Yang Zhong
@ 2017-11-24  2:35 ` kbuild test robot
  2017-11-24  4:29   ` Zhong, Yang
  2017-11-24 10:14   ` Zhong, Yang
  2017-12-05 21:43 ` Radim Krčmář
  1 sibling, 2 replies; 6+ messages in thread
From: kbuild test robot @ 2017-11-24  2:35 UTC (permalink / raw)
  To: Yang Zhong; +Cc: kbuild-all, kvm, pbonzini, yang.zhong

[-- Attachment #1: Type: text/plain, Size: 3457 bytes --]

Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.14]
[cannot apply to kvm/linux-next next-20171122]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yang-Zhong/KVM-Expose-new-cpu-features-to-guest/20171124-085014
config: i386-randconfig-x001-201747 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   arch/x86/kvm/cpuid.c: In function '__do_cpuid_ent':
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VBMI2' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
   arch/x86/kvm/cpuid.c:68:18: note: each undeclared identifier is reported only once for each function it appears in
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_GFNI' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:21: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                        ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VAES' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:31: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                  ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VPCLMULQDQ' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:41: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                            ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VNNI' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:3: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_BITALG' undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:20: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
                       ^

vim +/X86_FEATURE_AVX512_VBMI2 +68 arch/x86/kvm/cpuid.c

4ff41732 Paolo Bonzini 2014-02-24  67  
5c404cab Paolo Bonzini 2014-12-03 @68  #define F(x) bit(X86_FEATURE_##x)
5c404cab Paolo Bonzini 2014-12-03  69  

:::::: The code at line 68 was first introduced by commit
:::::: 5c404cabd1b5c125653ac573cb9284bdf42b658a KVM: x86: use F() macro throughout cpuid.c

:::::: TO: Paolo Bonzini <pbonzini@redhat.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31853 bytes --]

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

* RE: [PATCH] KVM: Expose new cpu features to guest
  2017-11-24  2:35 ` kbuild test robot
@ 2017-11-24  4:29   ` Zhong, Yang
  2017-11-24 10:14   ` Zhong, Yang
  1 sibling, 0 replies; 6+ messages in thread
From: Zhong, Yang @ 2017-11-24  4:29 UTC (permalink / raw)
  To: lkp; +Cc: kbuild-all@01.org, kvm@vger.kernel.org, pbonzini@redhat.com

Hello all,

My code base is newest kvm.git and my patch is based on commit ID: c128dbfa0f879f8ce7b79054037889b0b2240728,
which has define those variables, Many thanks!

Regards,

Yang 


-----Original Message-----
From: lkp 
Sent: Friday, November 24, 2017 10:36 AM
To: Zhong, Yang <yang.zhong@intel.com>
Cc: kbuild-all@01.org; kvm@vger.kernel.org; pbonzini@redhat.com; Zhong, Yang <yang.zhong@intel.com>
Subject: Re: [PATCH] KVM: Expose new cpu features to guest

Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.14]
[cannot apply to kvm/linux-next next-20171122] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yang-Zhong/KVM-Expose-new-cpu-features-to-guest/20171124-085014
config: i386-randconfig-x001-201747 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   arch/x86/kvm/cpuid.c: In function '__do_cpuid_ent':
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VBMI2' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
   arch/x86/kvm/cpuid.c:68:18: note: each undeclared identifier is reported only once for each function it appears in
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_GFNI' undeclared 
>> (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:21: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                        ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VAES' undeclared 
>> (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:31: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                  ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VPCLMULQDQ' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:41: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                            ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VNNI' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:3: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_BITALG' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:20: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
                       ^

vim +/X86_FEATURE_AVX512_VBMI2 +68 arch/x86/kvm/cpuid.c

4ff41732 Paolo Bonzini 2014-02-24  67
5c404cab Paolo Bonzini 2014-12-03 @68  #define F(x) bit(X86_FEATURE_##x) 5c404cab Paolo Bonzini 2014-12-03  69  

:::::: The code at line 68 was first introduced by commit
:::::: 5c404cabd1b5c125653ac573cb9284bdf42b658a KVM: x86: use F() macro throughout cpuid.c

:::::: TO: Paolo Bonzini <pbonzini@redhat.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* RE: [PATCH] KVM: Expose new cpu features to guest
  2017-11-24  2:35 ` kbuild test robot
  2017-11-24  4:29   ` Zhong, Yang
@ 2017-11-24 10:14   ` Zhong, Yang
  1 sibling, 0 replies; 6+ messages in thread
From: Zhong, Yang @ 2017-11-24 10:14 UTC (permalink / raw)
  To: lkp, pbonzini@redhat.com; +Cc: kbuild-all@01.org, kvm@vger.kernel.org

Hello Paolo,

This issue is caused by wrong code base, the test apply my patch based on Linux 4.14 commit ID

#test code base 
commit bebc6082da0a9f5d47a1ea2edc099bf671058bd4
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Nov 12 10:46:13 2017 -0800

    Linux 4.14

My patch dependency ID:c128dbfa0f879f8ce7b79054037889b0b2240728, which is more newer than Linux 4.14.

This is reason why the build can't find those definitions.

Regards,

Yang


-----Original Message-----
From: Zhong, Yang 
Sent: Friday, November 24, 2017 12:30 PM
To: lkp <lkp@intel.com>
Cc: kbuild-all@01.org; kvm@vger.kernel.org; pbonzini@redhat.com
Subject: RE: [PATCH] KVM: Expose new cpu features to guest

Hello all,

My code base is newest kvm.git and my patch is based on commit ID: c128dbfa0f879f8ce7b79054037889b0b2240728,
which has define those variables, Many thanks!

Regards,

Yang 


-----Original Message-----
From: lkp
Sent: Friday, November 24, 2017 10:36 AM
To: Zhong, Yang <yang.zhong@intel.com>
Cc: kbuild-all@01.org; kvm@vger.kernel.org; pbonzini@redhat.com; Zhong, Yang <yang.zhong@intel.com>
Subject: Re: [PATCH] KVM: Expose new cpu features to guest

Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.14]
[cannot apply to kvm/linux-next next-20171122] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yang-Zhong/KVM-Expose-new-cpu-features-to-guest/20171124-085014
config: i386-randconfig-x001-201747 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   arch/x86/kvm/cpuid.c: In function '__do_cpuid_ent':
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VBMI2' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
   arch/x86/kvm/cpuid.c:68:18: note: each undeclared identifier is reported only once for each function it appears in
    #define F(x) bit(X86_FEATURE_##x)
                     ^
>> arch/x86/kvm/cpuid.c:391:3: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_GFNI' undeclared 
>> (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:21: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                        ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VAES' undeclared 
>> (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:31: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                  ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_VPCLMULQDQ' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:391:41: note: in expansion of macro 'F'
      F(AVX512_VBMI2) | F(GFNI) | F(VAES) | F(VPCLMULQDQ) |
                                            ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_VNNI' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:3: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
      ^
>> arch/x86/kvm/cpuid.c:68:18: error: 'X86_FEATURE_AVX512_BITALG' 
>> undeclared (first use in this function)
    #define F(x) bit(X86_FEATURE_##x)
                     ^
   arch/x86/kvm/cpuid.c:392:20: note: in expansion of macro 'F'
      F(AVX512_VNNI) | F(AVX512_BITALG) | F(AVX512_VPOPCNTDQ);
                       ^

vim +/X86_FEATURE_AVX512_VBMI2 +68 arch/x86/kvm/cpuid.c

4ff41732 Paolo Bonzini 2014-02-24  67
5c404cab Paolo Bonzini 2014-12-03 @68  #define F(x) bit(X86_FEATURE_##x) 5c404cab Paolo Bonzini 2014-12-03  69  

:::::: The code at line 68 was first introduced by commit
:::::: 5c404cabd1b5c125653ac573cb9284bdf42b658a KVM: x86: use F() macro throughout cpuid.c

:::::: TO: Paolo Bonzini <pbonzini@redhat.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

* Re: [PATCH] KVM: Expose new cpu features to guest
  2017-11-22  7:27 [PATCH] KVM: Expose new cpu features to guest Yang Zhong
  2017-11-24  2:35 ` kbuild test robot
@ 2017-12-05 21:43 ` Radim Krčmář
  2017-12-07  2:05   ` Yang Zhong
  1 sibling, 1 reply; 6+ messages in thread
From: Radim Krčmář @ 2017-12-05 21:43 UTC (permalink / raw)
  To: Yang Zhong; +Cc: kvm, pbonzini

2017-11-22 15:27+0800, Yang Zhong:
> Intel IceLake cpu has added new cpu features,AVX512_VBMI2/GFNI/
> VAES/VPCLMULQDQ/AVX512_VNNI/AVX512_BITALG. Those new cpu features
> need expose to guest VM.
> 
> The bit definition:
> CPUID.(EAX=7,ECX=0):ECX[bit 06] AVX512_VBMI2
> CPUID.(EAX=7,ECX=0):ECX[bit 08] GFNI
> CPUID.(EAX=7,ECX=0):ECX[bit 09] VAES
> CPUID.(EAX=7,ECX=0):ECX[bit 10] VPCLMULQDQ
> CPUID.(EAX=7,ECX=0):ECX[bit 11] AVX512_VNNI
> CPUID.(EAX=7,ECX=0):ECX[bit 12] AVX512_BITALG
> 
> The release document ref below link:
> https://software.intel.com/sites/default/files/managed/c5/15/\
> architecture-instruction-set-extensions-programming-reference.pdf
> 
> The kernel dependency commit in kvm.git:
> (c128dbfa0f879f8ce7b79054037889b0b2240728)
> 
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> ---

Queued, thanks.

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

* Re: [PATCH] KVM: Expose new cpu features to guest
  2017-12-05 21:43 ` Radim Krčmář
@ 2017-12-07  2:05   ` Yang Zhong
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Zhong @ 2017-12-07  2:05 UTC (permalink / raw)
  To: Radim Krčmář; +Cc: kvm, pbonzini, yang.zhong

On Tue, Dec 05, 2017 at 10:43:20PM +0100, Radim Krčmář wrote:
> 2017-11-22 15:27+0800, Yang Zhong:
> > Intel IceLake cpu has added new cpu features,AVX512_VBMI2/GFNI/
> > VAES/VPCLMULQDQ/AVX512_VNNI/AVX512_BITALG. Those new cpu features
> > need expose to guest VM.
> > 
> > The bit definition:
> > CPUID.(EAX=7,ECX=0):ECX[bit 06] AVX512_VBMI2
> > CPUID.(EAX=7,ECX=0):ECX[bit 08] GFNI
> > CPUID.(EAX=7,ECX=0):ECX[bit 09] VAES
> > CPUID.(EAX=7,ECX=0):ECX[bit 10] VPCLMULQDQ
> > CPUID.(EAX=7,ECX=0):ECX[bit 11] AVX512_VNNI
> > CPUID.(EAX=7,ECX=0):ECX[bit 12] AVX512_BITALG
> > 
> > The release document ref below link:
> > https://software.intel.com/sites/default/files/managed/c5/15/\
> > architecture-instruction-set-extensions-programming-reference.pdf
> > 
> > The kernel dependency commit in kvm.git:
> > (c128dbfa0f879f8ce7b79054037889b0b2240728)
> > 
> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> > ---
> 
> Queued, thanks.

  Hello Radim,

  Thanks a lot!

  Regards,

  Yang

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

end of thread, other threads:[~2017-12-07  2:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22  7:27 [PATCH] KVM: Expose new cpu features to guest Yang Zhong
2017-11-24  2:35 ` kbuild test robot
2017-11-24  4:29   ` Zhong, Yang
2017-11-24 10:14   ` Zhong, Yang
2017-12-05 21:43 ` Radim Krčmář
2017-12-07  2:05   ` Yang Zhong

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