[intel-tdx:kvm-upstream-workaround 625/846] arch/x86/kvm/mmu/mmu.c:4234:14: error: implicit declaration of function 'kvm_mem_is_private'; did you mean 'kvm_gpa_private'?

From: kernel test robot
Date: Mon Aug 08 2022 - 01:29:13 EST


tree: https://github.com/intel/tdx.git kvm-upstream-workaround
head: d2f4a2362378fcfa26297befc778815836aecd3b
commit: c88b7037e410dea368496319a8427f8924a7585f [625/846] KVM: x86/mmu: Let vcpu re-try when faulting page type conflict
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220808/202208081351.yf7GwyHy-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/c88b7037e410dea368496319a8427f8924a7585f
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream-workaround
git checkout c88b7037e410dea368496319a8427f8924a7585f
# 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:696:53: error: incompatible type for argument 1 of 'kvm_mmu_topup_memory_cache'
696 | 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:1369:61: note: expected 'struct kvm_mmu_memory_cache *' but argument is of type 'struct kvm_mmu_memory_cache'
1369 | int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
arch/x86/kvm/mmu/mmu.c: In function 'kvm_faultin_pfn':
>> arch/x86/kvm/mmu/mmu.c:4234:14: error: implicit declaration of function 'kvm_mem_is_private'; did you mean 'kvm_gpa_private'? [-Werror=implicit-function-declaration]
4234 | (kvm_mem_is_private(vcpu->kvm, fault->gfn) != fault->is_private))
| ^~~~~~~~~~~~~~~~~~
| kvm_gpa_private
arch/x86/kvm/mmu/mmu.c: In function 'kvm_mmu_zap_collapsible_spte':
arch/x86/kvm/mmu/mmu.c:6565:19: warning: variable 'pfn' set but not used [-Wunused-but-set-variable]
6565 | kvm_pfn_t pfn;
| ^~~
arch/x86/kvm/mmu/mmu.c: In function 'mmu_topup_shadow_page_cache':
arch/x86/kvm/mmu/mmu.c:698:1: error: control reaches end of non-void function [-Werror=return-type]
698 | }
| ^
cc1: some warnings being treated as errors


vim +4234 arch/x86/kvm/mmu/mmu.c

4200
4201 static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
4202 {
4203 struct kvm_memory_slot *slot = fault->slot;
4204 bool async;
4205
4206 /*
4207 * Retry the page fault if the gfn hit a memslot that is being deleted
4208 * or moved. This ensures any existing SPTEs for the old memslot will
4209 * be zapped before KVM inserts a new MMIO SPTE for the gfn.
4210 */
4211 if (slot && (slot->flags & KVM_MEMSLOT_INVALID))
4212 return RET_PF_RETRY;
4213
4214 if (!kvm_is_visible_memslot(slot)) {
4215 /* Don't expose private memslots to L2. */
4216 if (is_guest_mode(vcpu)) {
4217 fault->slot = NULL;
4218 fault->pfn = KVM_PFN_NOSLOT;
4219 fault->map_writable = false;
4220 return RET_PF_CONTINUE;
4221 }
4222 /*
4223 * If the APIC access page exists but is disabled, go directly
4224 * to emulation without caching the MMIO access or creating a
4225 * MMIO SPTE. That way the cache doesn't need to be purged
4226 * when the AVIC is re-enabled.
4227 */
4228 if (slot && slot->id == APIC_ACCESS_PAGE_PRIVATE_MEMSLOT &&
4229 !kvm_apicv_activated(vcpu->kvm))
4230 return RET_PF_EMULATE;
4231 }
4232
4233 if (kvm_gfn_shared_mask(vcpu->kvm) &&
> 4234 (kvm_mem_is_private(vcpu->kvm, fault->gfn) != fault->is_private))
4235 return RET_PF_RETRY;
4236
4237 async = false;
4238 fault->pfn = __gfn_to_pfn_memslot(slot, fault->gfn, false, &async,
4239 fault->write, &fault->map_writable,
4240 &fault->hva);
4241 if (!async)
4242 return RET_PF_CONTINUE; /* *pfn has correct page already */
4243
4244 if (!fault->prefetch && kvm_can_do_async_pf(vcpu)) {
4245 trace_kvm_try_async_get_page(fault->addr, fault->gfn);
4246 if (kvm_find_async_pf_gfn(vcpu, fault->gfn)) {
4247 trace_kvm_async_pf_doublefault(fault->addr, fault->gfn);
4248 kvm_make_request(KVM_REQ_APF_HALT, vcpu);
4249 return RET_PF_RETRY;
4250 } else if (kvm_arch_setup_async_pf(vcpu, fault->addr, fault->gfn)) {
4251 return RET_PF_RETRY;
4252 }
4253 }
4254
4255 fault->pfn = __gfn_to_pfn_memslot(slot, fault->gfn, false, NULL,
4256 fault->write, &fault->map_writable,
4257 &fault->hva);
4258 return RET_PF_CONTINUE;
4259 }
4260

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