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: x86_64-rhel-8.3 compiler: gcc-11 (Debian 11.3.0-5) 11.3.0 reproduce (this is a W=1 build): # 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 make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kvm/ 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: In function '__kvm_mmu_map_gpa': arch/x86/kvm/mmu/mmu.c:6756:30: error: 'KVM_MEM_ATTR_PRIVATE' undeclared (first use in this function); did you mean 'KVM_MEM_PRIVATE'? 6756 | attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED; | ^~~~~~~~~~~~~~~~~~~~ | KVM_MEM_PRIVATE arch/x86/kvm/mmu/mmu.c:6756:30: note: each undeclared identifier is reported only once for each function it appears in arch/x86/kvm/mmu/mmu.c:6756:53: error: 'KVM_MEM_ATTR_SHARED' undeclared (first use in this function) 6756 | attr = map_private ? KVM_MEM_ATTR_PRIVATE : KVM_MEM_ATTR_SHARED; | ^~~~~~~~~~~~~~~~~~~ >> arch/x86/kvm/mmu/mmu.c:6764:15: error: implicit declaration of function 'kvm_vm_reserve_mem_attr' [-Werror=implicit-function-declaration] 6764 | ret = kvm_vm_reserve_mem_attr(kvm, start, end); | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from arch/x86/kvm/irq.h:15, from arch/x86/kvm/mmu/mmu.c:18: >> arch/x86/kvm/mmu/mmu.c:6774:36: error: implicit declaration of function 'kvm_vm_set_mem_attr' [-Werror=implicit-function-declaration] 6774 | KVM_BUG_ON(kvm_vm_set_mem_attr(kvm, attr, start, end), kvm); | ^~~~~~~~~~~~~~~~~~~ include/linux/kvm_host.h:863:22: note: in definition of macro 'KVM_BUG_ON' 863 | int __ret = (cond); \ | ^~~~ In file included from include/linux/list_lru.h:14, from include/linux/fs.h:13, from include/linux/huge_mm.h:8, from include/linux/mm.h:703, from include/linux/kvm_host.h:16, from arch/x86/kvm/irq.h:15, from arch/x86/kvm/mmu/mmu.c:18: arch/x86/kvm/mmu/mmu.c: In function '__mem_attr_is_mixed': arch/x86/kvm/mmu/mmu.c:7197:27: error: 'struct kvm' has no member named 'mem_attr_array' 7197 | XA_STATE(xas, &kvm->mem_attr_array, start); | ^~ include/linux/xarray.h:1348:15: note: in definition of macro '__XA_STATE' 1348 | .xa = array, \ | ^~~~~ arch/x86/kvm/mmu/mmu.c:7197:9: note: in expansion of macro 'XA_STATE' 7197 | XA_STATE(xas, &kvm->mem_attr_array, start); | ^~~~~~~~ arch/x86/kvm/mmu/mmu.c: In function 'mem_attr_is_mixed': arch/x86/kvm/mmu/mmu.c:7242:29: error: 'struct kvm' has no member named 'mem_attr_array' 7242 | entry = xa_load(&kvm->mem_attr_array, start); | ^~ arch/x86/kvm/mmu/mmu.c:7249:33: error: 'struct kvm' has no member named 'mem_attr_array' 7249 | if (xa_load(&kvm->mem_attr_array, gfn) != entry) { | ^~ arch/x86/kvm/mmu/mmu.c: At top level: arch/x86/kvm/mmu/mmu.c:7293:6: warning: no previous prototype for 'kvm_arch_update_mem_attr' [-Wmissing-prototypes] 7293 | void kvm_arch_update_mem_attr(struct kvm *kvm, unsigned int attr, | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/printk.h:10, from include/linux/kernel.h:29, from include/linux/cpumask.h:10, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from arch/x86/kvm/irq.h:13, from arch/x86/kvm/mmu/mmu.c:18: arch/x86/kvm/mmu/mmu.c: In function 'kvm_arch_update_mem_attr': arch/x86/kvm/mmu/mmu.c:7302:29: error: 'KVM_MEM_ATTR_PRIVATE' undeclared (first use in this function); did you mean 'KVM_MEM_PRIVATE'? 7302 | WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), | ^~~~~~~~~~~~~~~~~~~~ include/linux/once_lite.h:28:41: note: in definition of macro 'DO_ONCE_LITE_IF' 28 | bool __ret_do_once = !!(condition); \ | ^~~~~~~~~ arch/x86/kvm/mmu/mmu.c:7302:9: note: in expansion of macro 'WARN_ONCE' 7302 | WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), | ^~~~~~~~~ arch/x86/kvm/mmu/mmu.c:7302:52: error: 'KVM_MEM_ATTR_SHARED' undeclared (first use in this function) 7302 | WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), | ^~~~~~~~~~~~~~~~~~~ include/linux/once_lite.h:28:41: note: in definition of macro 'DO_ONCE_LITE_IF' 28 | bool __ret_do_once = !!(condition); \ | ^~~~~~~~~ arch/x86/kvm/mmu/mmu.c:7302:9: note: in expansion of macro 'WARN_ONCE' 7302 | WARN_ONCE(!(attr & (KVM_MEM_ATTR_PRIVATE | KVM_MEM_ATTR_SHARED)), | ^~~~~~~~~ cc1: some warnings being treated as errors 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