Hi Yang, Thank you for the patch! Yet something to improve: [auto build test ERROR on kvm/linux-next] [also build test ERROR on v5.11-rc6 next-20210125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Yang-Weijiang/Introduce-support-for-guest-CET-feature/20210203-193042 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/bc17249d58e9e7a1b49ad5d8a4f504e3dda0263d git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Weijiang/Introduce-support-for-guest-CET-feature/20210203-193042 git checkout bc17249d58e9e7a1b49ad5d8a4f504e3dda0263d # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): arch/x86/kvm/x86.c: In function 'kvm_set_cr0': >> arch/x86/kvm/x86.c:870:53: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'? 870 | if (!(cr0 & X86_CR0_WP) && kvm_read_cr4_bits(vcpu, X86_CR4_CET)) | ^~~~~~~~~~~ | X86_CR4_MCE arch/x86/kvm/x86.c:870:53: note: each undeclared identifier is reported only once for each function it appears in arch/x86/kvm/x86.c: In function 'kvm_set_cr4': arch/x86/kvm/x86.c:1039:13: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'? 1039 | if ((cr4 & X86_CR4_CET) && !(kvm_read_cr0(vcpu) & X86_CR0_WP)) | ^~~~~~~~~~~ | X86_CR4_MCE arch/x86/kvm/x86.c: In function 'is_xsaves_msr': arch/x86/kvm/x86.c:3631:18: error: 'MSR_IA32_U_CET' undeclared (first use in this function); did you mean 'MSR_IA32_TSC'? 3631 | return index == MSR_IA32_U_CET || | ^~~~~~~~~~~~~~ | MSR_IA32_TSC arch/x86/kvm/x86.c:3632:19: error: 'MSR_IA32_PL0_SSP' undeclared (first use in this function); did you mean 'MSR_IA32_MCG_ESP'? 3632 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP); | ^~~~~~~~~~~~~~~~ | MSR_IA32_MCG_ESP arch/x86/kvm/x86.c:3632:48: error: 'MSR_IA32_PL3_SSP' undeclared (first use in this function); did you mean 'MSR_IA32_MCG_ESP'? 3632 | (index >= MSR_IA32_PL0_SSP && index <= MSR_IA32_PL3_SSP); | ^~~~~~~~~~~~~~~~ | MSR_IA32_MCG_ESP arch/x86/kvm/x86.c: In function 'kvm_arch_hardware_setup': >> arch/x86/kvm/x86.h:428:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'? 428 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \ | ^~~~~~~~~~~~~~~~~ arch/x86/kvm/x86.c:10303:55: note: in definition of macro '__kvm_cpu_cap_has' 10303 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f) | ^ arch/x86/kvm/x86.c:10304:22: note: in expansion of macro '__cr4_reserved_bits' 10304 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_); | ^~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/x86.h:429:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'? 429 | !__cpu_has(__c, X86_FEATURE_IBT)) \ | ^~~~~~~~~~~~~~~ arch/x86/kvm/x86.c:10303:55: note: in definition of macro '__kvm_cpu_cap_has' 10303 | #define __kvm_cpu_cap_has(UNUSED_, f) kvm_cpu_cap_has(f) | ^ arch/x86/kvm/x86.c:10304:22: note: in expansion of macro '__cr4_reserved_bits' 10304 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_); | ^~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kvm/cpuid.h:5, from arch/x86/kvm/mmu.h:7, from arch/x86/kvm/x86.c:22: >> arch/x86/kvm/x86.h:430:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'? 430 | __reserved_bits |= X86_CR4_CET; \ | ^~~~~~~~~~~ arch/x86/kvm/x86.c:10304:22: note: in expansion of macro '__cr4_reserved_bits' 10304 | cr4_reserved_bits = __cr4_reserved_bits(__kvm_cpu_cap_has, UNUSED_); | ^~~~~~~~~~~~~~~~~~~ In file included from arch/x86/include/asm/thread_info.h:53, from include/linux/thread_info.h:38, from arch/x86/include/asm/preempt.h:7, from include/linux/preempt.h:78, from include/linux/percpu.h:6, from include/linux/context_tracking_state.h:5, from include/linux/hardirq.h:5, from include/linux/kvm_host.h:7, from arch/x86/kvm/x86.c:19: arch/x86/kvm/x86.c: In function 'kvm_arch_check_processor_compat': >> arch/x86/kvm/x86.h:428:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'? 428 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \ | ^~~~~~~~~~~~~~~~~ arch/x86/include/asm/cpufeature.h:118:24: note: in definition of macro 'cpu_has' 118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ | ^~~ arch/x86/kvm/x86.c:10337:6: note: in expansion of macro '__cr4_reserved_bits' 10337 | if (__cr4_reserved_bits(cpu_has, c) != | ^~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/x86.h:429:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'? 429 | !__cpu_has(__c, X86_FEATURE_IBT)) \ | ^~~~~~~~~~~~~~~ arch/x86/include/asm/cpufeature.h:118:24: note: in definition of macro 'cpu_has' 118 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ | ^~~ arch/x86/kvm/x86.c:10337:6: note: in expansion of macro '__cr4_reserved_bits' 10337 | if (__cr4_reserved_bits(cpu_has, c) != | ^~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kvm/cpuid.h:5, from arch/x86/kvm/mmu.h:7, from arch/x86/kvm/x86.c:22: >> arch/x86/kvm/x86.h:430:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'? 430 | __reserved_bits |= X86_CR4_CET; \ | ^~~~~~~~~~~ arch/x86/kvm/x86.c:10337:6: note: in expansion of macro '__cr4_reserved_bits' 10337 | if (__cr4_reserved_bits(cpu_has, c) != | ^~~~~~~~~~~~~~~~~~~ arch/x86/kvm/x86.c: In function 'is_xsaves_msr': arch/x86/kvm/x86.c:3633:1: error: control reaches end of non-void function [-Werror=return-type] 3633 | } | ^ cc1: some warnings being treated as errors -- In file included from arch/x86/kvm/cpuid.h:5, from arch/x86/kvm/cpuid.c:21: arch/x86/kvm/cpuid.c: In function 'kvm_vcpu_after_set_cpuid': >> arch/x86/kvm/x86.h:428:22: error: 'X86_FEATURE_SHSTK' undeclared (first use in this function); did you mean 'X86_FEATURE_EST'? 428 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \ | ^~~~~~~~~~~~~~~~~ arch/x86/kvm/cpuid.c:195:6: note: in expansion of macro '__cr4_reserved_bits' 195 | __cr4_reserved_bits(guest_cpuid_has, vcpu); | ^~~~~~~~~~~~~~~~~~~ arch/x86/kvm/x86.h:428:22: note: each undeclared identifier is reported only once for each function it appears in 428 | if (!__cpu_has(__c, X86_FEATURE_SHSTK) && \ | ^~~~~~~~~~~~~~~~~ arch/x86/kvm/cpuid.c:195:6: note: in expansion of macro '__cr4_reserved_bits' 195 | __cr4_reserved_bits(guest_cpuid_has, vcpu); | ^~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/x86.h:429:22: error: 'X86_FEATURE_IBT' undeclared (first use in this function); did you mean 'X86_FEATURE_IBS'? 429 | !__cpu_has(__c, X86_FEATURE_IBT)) \ | ^~~~~~~~~~~~~~~ arch/x86/kvm/cpuid.c:195:6: note: in expansion of macro '__cr4_reserved_bits' 195 | __cr4_reserved_bits(guest_cpuid_has, vcpu); | ^~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/x86.h:430:22: error: 'X86_CR4_CET' undeclared (first use in this function); did you mean 'X86_CR4_MCE'? 430 | __reserved_bits |= X86_CR4_CET; \ | ^~~~~~~~~~~ arch/x86/kvm/cpuid.c:195:6: note: in expansion of macro '__cr4_reserved_bits' 195 | __cr4_reserved_bits(guest_cpuid_has, vcpu); | ^~~~~~~~~~~~~~~~~~~ vim +870 arch/x86/kvm/x86.c 841 842 cr0 &= ~CR0_RESERVED_BITS; 843 844 if ((cr0 & X86_CR0_NW) && !(cr0 & X86_CR0_CD)) 845 return 1; 846 847 if ((cr0 & X86_CR0_PG) && !(cr0 & X86_CR0_PE)) 848 return 1; 849 850 #ifdef CONFIG_X86_64 851 if ((vcpu->arch.efer & EFER_LME) && !is_paging(vcpu) && 852 (cr0 & X86_CR0_PG)) { 853 int cs_db, cs_l; 854 855 if (!is_pae(vcpu)) 856 return 1; 857 kvm_x86_ops.get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 858 if (cs_l) 859 return 1; 860 } 861 #endif 862 if (!(vcpu->arch.efer & EFER_LME) && (cr0 & X86_CR0_PG) && 863 is_pae(vcpu) && ((cr0 ^ old_cr0) & pdptr_bits) && 864 !load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu))) 865 return 1; 866 867 if (!(cr0 & X86_CR0_PG) && kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)) 868 return 1; 869 > 870 if (!(cr0 & X86_CR0_WP) && kvm_read_cr4_bits(vcpu, X86_CR4_CET)) 871 return 1; 872 873 kvm_x86_ops.set_cr0(vcpu, cr0); 874 875 kvm_post_set_cr0(vcpu, old_cr0, cr0); 876 877 return 0; 878 } 879 EXPORT_SYMBOL_GPL(kvm_set_cr0); 880 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org