[arm-platforms:kvm-arm64/nv-wip-v5.0-rc5 93/96] arch/arm/kvm/../../../virt/kvm/arm/mmu.c:2057:9: error: too few arguments to function 'kvm_s2_handle_perm_fault'
From: kbuild test robot <hidden>
Date: 2019-02-21 18:17:12
tree: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git kvm-arm64/nv-wip-v5.0-rc5 head: 89419a20770a8ec94400940e3db1c4d5c276b470 commit: cba70b22f9e5628f0f2ec22b5a5dc388cce8ee7f [93/96] fixup! KVM: arm64: nv: Handle shadow stage 2 page faults config: arm-axm55xx_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 8.2.0-11) 8.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout cba70b22f9e5628f0f2ec22b5a5dc388cce8ee7f # save the attached .config to linux build tree GCC_VERSION=8.2.0 make.cross ARCH=arm All error/warnings (new ones prefixed by >>): arch/arm/kvm/../../../virt/kvm/arm/mmu.c: In function 'kvm_handle_guest_abort':
quoted
arch/arm/kvm/../../../virt/kvm/arm/mmu.c:2057:40: warning: passing argument 2 of 'kvm_s2_handle_perm_fault' makes integer from pointer without a cast [-Wint-conversion]
ret = kvm_s2_handle_perm_fault(vcpu, &nested_trans);
^~~~~~~~~~~~~
In file included from arch/arm/kvm/../../../virt/kvm/arm/mmu.c:28:
arch/arm/include/asm/kvm_mmu.h:468:21: note: expected 'phys_addr_t' {aka 'long long unsigned int'} but argument is of type 'struct kvm_s2_trans *'
phys_addr_t ipa,
~~~~~~~~~~~~^~~quoted
arch/arm/kvm/../../../virt/kvm/arm/mmu.c:2057:9: error: too few arguments to function 'kvm_s2_handle_perm_fault'
ret = kvm_s2_handle_perm_fault(vcpu, &nested_trans);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/arm/kvm/../../../virt/kvm/arm/mmu.c:28:
arch/arm/include/asm/kvm_mmu.h:467:19: note: declared here
static inline int kvm_s2_handle_perm_fault(struct kvm_vcpu *vcpu,
^~~~~~~~~~~~~~~~~~~~~~~~
vim +/kvm_s2_handle_perm_fault +2057 arch/arm/kvm/../../../virt/kvm/arm/mmu.c
1972
1973 /**
1974 * kvm_handle_guest_abort - handles all 2nd stage aborts
1975 * @vcpu: the VCPU pointer
1976 * @run: the kvm_run structure
1977 *
1978 * Any abort that gets to the host is almost guaranteed to be caused by a
1979 * missing second stage translation table entry, which can mean that either the
1980 * guest simply needs more memory and we must allocate an appropriate page or it
1981 * can mean that the guest tried to access I/O memory, which is emulated by user
1982 * space. The distinction is based on the IPA causing the fault and whether this
1983 * memory region has been registered as standard RAM by user space.
1984 */
1985 int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run)
1986 {
1987 unsigned long fault_status;
1988 phys_addr_t fault_ipa; /* The address we faulted on */
1989 phys_addr_t ipa; /* Always the IPA in the L1 guest phys space */
1990 struct kvm_memory_slot *memslot;
1991 struct kvm_s2_trans nested_trans;
1992 unsigned long hva;
1993 bool is_iabt, write_fault, writable;
1994 gfn_t gfn;
1995 int ret, idx;
1996
1997 fault_status = kvm_vcpu_trap_get_fault_type(vcpu);
1998
1999 ipa = fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
2000 is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
2001
2002 /* Synchronous External Abort? */
2003 if (kvm_vcpu_dabt_isextabt(vcpu)) {
2004 /*
2005 * For RAS the host kernel may handle this abort.
2006 * There is no need to pass the error into the guest.
2007 */
2008 if (!handle_guest_sea(fault_ipa, kvm_vcpu_get_hsr(vcpu)))
2009 return 1;
2010
2011 if (unlikely(!is_iabt)) {
2012 kvm_inject_vabt(vcpu);
2013 return 1;
2014 }
2015 }
2016
2017 trace_kvm_guest_fault(*vcpu_pc(vcpu), kvm_vcpu_get_hsr(vcpu),
2018 kvm_vcpu_get_hfar(vcpu), fault_ipa);
2019
2020 /* Check the stage-2 fault is trans. fault or write fault */
2021 if (fault_status != FSC_FAULT && fault_status != FSC_PERM &&
2022 fault_status != FSC_ACCESS) {
2023 /*
2024 * We must never see an address size fault on shadow stage 2
2025 * page table walk, because we would have injected an addr
2026 * size fault when we walked the nested s2 page and not
2027 * create the shadow entry.
2028 */
2029 kvm_err("Unsupported FSC: EC=%#x xFSC=%#lx ESR_EL2=%#lx\n",
2030 kvm_vcpu_trap_get_class(vcpu),
2031 (unsigned long)kvm_vcpu_trap_get_fault(vcpu),
2032 (unsigned long)kvm_vcpu_get_hsr(vcpu));
2033 return -EFAULT;
2034 }
2035
2036 idx = srcu_read_lock(&vcpu->kvm->srcu);
2037
2038 /*
2039 * We may have faulted on a shadow stage 2 page table if we are
2040 * running a nested guest. In this case, we have to resolve the L2
2041 * IPA to the L1 IPA first, before knowing what kind of memory should
2042 * back the L1 IPA.
2043 *
2044 * If the shadow stage 2 page table walk faults, then we simply inject
2045 * this to the guest and carry on.
2046 */
2047 if (kvm_is_shadow_s2_fault(vcpu)) {
2048 u32 esr;
2049
2050 ret = kvm_walk_nested_s2(vcpu, fault_ipa, &nested_trans);
2051 esr = kvm_s2_trans_esr(&nested_trans);
2052 if (esr)
2053 kvm_inject_s2_fault(vcpu, esr);
2054 if (ret)
2055 goto out_unlock;
2056 2057 ret = kvm_s2_handle_perm_fault(vcpu, &nested_trans);
2058 esr = kvm_s2_trans_esr(&nested_trans);
2059 if (esr)
2060 kvm_inject_s2_fault(vcpu, esr);
2061 if (ret)
2062 goto out_unlock;
2063
2064 ipa = kvm_s2_trans_output(&nested_trans);
2065 }
2066
2067 gfn = ipa >> PAGE_SHIFT;
2068 memslot = gfn_to_memslot(vcpu->kvm, gfn);
2069 hva = gfn_to_hva_memslot_prot(memslot, gfn, &writable);
2070 write_fault = kvm_is_write_fault(vcpu);
2071 if (kvm_is_error_hva(hva) || (write_fault && !writable)) {
2072 if (is_iabt) {
2073 /* Prefetch Abort on I/O address */
2074 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
2075 ret = 1;
2076 goto out_unlock;
2077 }
2078
2079 /*
2080 * Check for a cache maintenance operation. Since we
2081 * ended-up here, we know it is outside of any memory
2082 * slot. But we can't find out if that is for a device,
2083 * or if the guest is just being stupid. The only thing
2084 * we know for sure is that this range cannot be cached.
2085 *
2086 * So let's assume that the guest is just being
2087 * cautious, and skip the instruction.
2088 */
2089 if (kvm_vcpu_dabt_is_cm(vcpu)) {
2090 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
2091 ret = 1;
2092 goto out_unlock;
2093 }
2094
2095 /*
2096 * The IPA is reported as [MAX:12], so we need to
2097 * complement it with the bottom 12 bits from the
2098 * faulting VA. This is always 12 bits, irrespective
2099 * of the page size.
2100 */
2101 ipa |= kvm_vcpu_get_hfar(vcpu) & ((1 << 12) - 1);
2102 ret = io_mem_abort(vcpu, run, ipa);
2103 goto out_unlock;
2104 }
2105
2106 /* Userspace should not be able to register out-of-bounds IPAs */
2107 VM_BUG_ON(ipa >= kvm_phys_size(vcpu->kvm));
2108
2109 if (fault_status == FSC_ACCESS) {
2110 handle_access_fault(vcpu, fault_ipa);
2111 ret = 1;
2112 goto out_unlock;
2113 }
2114
2115 ret = user_mem_abort(vcpu, fault_ipa, &nested_trans,
2116 memslot, hva, fault_status);
2117 if (ret == 0)
2118 ret = 1;
2119 out_unlock:
2120 srcu_read_unlock(&vcpu->kvm->srcu, idx);
2121 return ret;
2122 }
2123
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation Attachments
- .config.gz [application/gzip] 20401 bytes
- (unnamed) [text/plain] 176 bytes · preview