tree: https://github.com/intel/tdx.git kvm-upstream-workaround head: 699e64cb199ffac8cf4c8eff2e96fed94fcf5a0b commit: 79cfc130e36a7754977af7460dc752188073d103 [124/350] KVM: x86/tdp_mmu: implement MapGPA hypercall for TDX config: i386-randconfig-a013-20220926 compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel/tdx/commit/79cfc130e36a7754977af7460dc752188073d103 git remote add intel-tdx https://github.com/intel/tdx.git git fetch --no-tags intel-tdx kvm-upstream-workaround git checkout 79cfc130e36a7754977af7460dc752188073d103 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): arch/x86/kvm/mmu/mmu.c:6756:23: error: use of undeclared identifier 'KVM_MEM_ATTR_PRIVATE' attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED; ^ arch/x86/kvm/mmu/mmu.c:6756:46: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED' attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED; ^ >> arch/x86/kvm/mmu/mmu.c:6764:8: error: implicit declaration of function 'kvm_vm_reserve_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = kvm_vm_reserve_mem_attr(kvm, start, end); ^ >> arch/x86/kvm/mmu/mmu.c:6774:15: error: implicit declaration of function 'kvm_vm_set_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm); ^ arch/x86/kvm/mmu/mmu.c:6774:15: note: did you mean 'kvm_vm_reserve_mem_attr'? arch/x86/kvm/mmu/mmu.c:6764:8: note: 'kvm_vm_reserve_mem_attr' declared here ret = kvm_vm_reserve_mem_attr(kvm, start, end); ^ arch/x86/kvm/mmu/mmu.c:6776:15: error: implicit declaration of function 'kvm_vm_set_mem_attr' is invalid in C99 [-Werror,-Wimplicit-function-declaration] KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, s), kvm); ^ arch/x86/kvm/mmu/mmu.c:7197:22: error: no member named 'mem_attr_array' in 'struct kvm' XA_STATE(xas, &kvm->mem_attr_array, start); ~~~ ^ include/linux/xarray.h:1369:36: note: expanded from macro 'XA_STATE' struct xa_state name = __XA_STATE(array, index, 0, 0) ^~~~~ include/linux/xarray.h:1348:8: note: expanded from macro '__XA_STATE' .xa = array, \ ^~~~~ arch/x86/kvm/mmu/mmu.c:7242:24: error: no member named 'mem_attr_array' in 'struct kvm' entry = xa_load(&kvm->mem_attr_array, start); ~~~ ^ arch/x86/kvm/mmu/mmu.c:7249:21: error: no member named 'mem_attr_array' in 'struct kvm' if (xa_load(&kvm->mem_attr_array, gfn) != entry) { ~~~ ^ arch/x86/kvm/mmu/mmu.c:7302:22: error: use of undeclared identifier 'KVM_MEM_ATTR_PRIVATE' WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), ^ arch/x86/kvm/mmu/mmu.c:7302:45: error: use of undeclared identifier 'KVM_MEM_ATTR_SHARED' WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), ^ arch/x86/kvm/mmu/mmu.c:7293:6: warning: no previous prototype for function 'kvm_arch_update_mem_attr' [-Wmissing-prototypes] void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr, ^ arch/x86/kvm/mmu/mmu.c:7293:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr, ^ static 1 warning and 10 errors generated. vim +/kvm_vm_reserve_mem_attr +6764 arch/x86/kvm/mmu/mmu.c 6745 6746 int __kvm_mmu_map_gpa(struct kvm *kvm, gfn_t *startp, gfn_t end, 6747 bool map_private) 6748 { 6749 gfn_t start = *startp; 6750 int attr; 6751 int ret; 6752 6753 if (!kvm_gfn_shared_mask(kvm)) 6754 return -EOPNOTSUPP; 6755 > 6756 attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED; 6757 start = start & ~kvm_gfn_shared_mask(kvm); 6758 end = end & ~kvm_gfn_shared_mask(kvm); 6759 6760 /* 6761 * To make the following kvm_vm_set_mem_attr() success within spinlock 6762 * without memory allocation. 6763 */ > 6764 ret = kvm_vm_reserve_mem_attr(kvm, start, end); 6765 if (ret) 6766 return ret; 6767 6768 write_lock(&kvm->mmu_lock); 6769 if (is_tdp_mmu_enabled(kvm)) { 6770 gfn_t s = start; 6771 6772 ret = kvm_tdp_mmu_map_gpa(kvm, &s, end, map_private); 6773 if (!ret) { > 6774 KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm); 6775 } else if (ret == -EAGAIN) { 6776 KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, s), kvm); 6777 start = s; 6778 } 6779 } else { 6780 ret = -EOPNOTSUPP; 6781 } 6782 write_unlock(&kvm->mmu_lock); 6783 6784 if (ret == -EAGAIN) { 6785 if (map_private) 6786 *startp = kvm_gfn_private(kvm, start); 6787 else 6788 *startp = kvm_gfn_shared(kvm, start); 6789 } 6790 return ret; 6791 } 6792 EXPORT_SYMBOL_GPL(__kvm_mmu_map_gpa); 6793 -- 0-DAY CI Kernel Test Service https://01.org/lkp