[intel-tdx:kvm-upstream-workaround 601/846] arch/x86/kvm/mmu/mmu.c:689:53: error: incompatible type for argument 1 of 'kvm_mmu_topup_memory_cache'

From: kernel test robot
Date: Sun Aug 07 2022 - 23:36:14 EST


tree: https://github.com/intel/tdx.git kvm-upstream-workaround
head: d2f4a2362378fcfa26297befc778815836aecd3b
commit: 8aa5fe0bd8b2e79634440087c32a5d32b4dbe1af [601/846] KVM: x86/mmu: Allow non-zero value for non-present SPTE
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220808/202208081156.UDyRF0Eq-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/8aa5fe0bd8b2e79634440087c32a5d32b4dbe1af
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream-workaround
git checkout 8aa5fe0bd8b2e79634440087c32a5d32b4dbe1af
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/x86/kvm/mmu/mmu.c: In function 'mmu_topup_shadow_page_cache':
>> arch/x86/kvm/mmu/mmu.c:689:53: error: incompatible type for argument 1 of 'kvm_mmu_topup_memory_cache'
689 | return kvm_mmu_topup_memory_cache(vcpu->arch.mmu_shadow_page_cache,
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
| |
| struct kvm_mmu_memory_cache
In file included from arch/x86/kvm/irq.h:15,
from arch/x86/kvm/mmu/mmu.c:18:
include/linux/kvm_host.h:1353:61: note: expected 'struct kvm_mmu_memory_cache *' but argument is of type 'struct kvm_mmu_memory_cache'
1353 | int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
arch/x86/kvm/mmu/mmu.c: In function 'kvm_mmu_zap_collapsible_spte':
arch/x86/kvm/mmu/mmu.c:6484:19: warning: variable 'pfn' set but not used [-Wunused-but-set-variable]
6484 | kvm_pfn_t pfn;
| ^~~
arch/x86/kvm/mmu/mmu.c: In function 'mmu_topup_shadow_page_cache':
arch/x86/kvm/mmu/mmu.c:691:1: error: control reaches end of non-void function [-Werror=return-type]
691 | }
| ^
cc1: some warnings being treated as errors


vim +/kvm_mmu_topup_memory_cache +689 arch/x86/kvm/mmu/mmu.c

666
667 static int mmu_topup_shadow_page_cache(struct kvm_vcpu *vcpu)
668 {
669 struct kvm_mmu_memory_cache *mc = &vcpu->arch.mmu_shadow_page_cache;
670 int start, end, i, r;
671
672 start = kvm_mmu_memory_cache_nr_free_objects(mc);
673 r = kvm_mmu_topup_memory_cache(mc, PT64_ROOT_MAX_LEVEL);
674
675 /*
676 * Note, topup may have allocated objects even if it failed to allocate
677 * the minimum number of objects required to make forward progress _at
678 * this time_. Initialize newly allocated objects even on failure, as
679 * userspace can free memory and rerun the vCPU in response to -ENOMEM.
680 */
681 end = kvm_mmu_memory_cache_nr_free_objects(mc);
682 for (i = start; i < end; i++)
683 kvm_init_shadow_page(mc->objects[i]);
684 return r;
685 }
686 #else
687 static int mmu_topup_shadow_page_cache(struct kvm_vcpu *vcpu)
688 {
> 689 return kvm_mmu_topup_memory_cache(vcpu->arch.mmu_shadow_page_cache,
690 PT64_ROOT_MAX_LEVEL);
691 }
692 #endif /* CONFIG_X86_64 */
693

--
0-DAY CI Kernel Test Service
https://01.org/lkp