arch/arm64/kvm/hyp/nvhe/psci-relay.c:152:21: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Sat Dec 26 2020 - 18:18:46 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f838f8d2b694cf9d524dc4423e9dd2db13892f3f
commit: cdf367192766ad11a03e8d5098556be43b8eb6b0 KVM: arm64: Intercept host's CPU_ON SMCs
date: 3 weeks ago
config: arm64-randconfig-s032-20201223 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cdf367192766ad11a03e8d5098556be43b8eb6b0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout cdf367192766ad11a03e8d5098556be43b8eb6b0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64

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


"sparse warnings: (new ones prefixed by >>)"
>> arch/arm64/kvm/hyp/nvhe/psci-relay.c:152:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got struct psci_boot_args * @@
arch/arm64/kvm/hyp/nvhe/psci-relay.c:152:21: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/arm64/kvm/hyp/nvhe/psci-relay.c:152:21: sparse: got struct psci_boot_args *
>> arch/arm64/kvm/hyp/nvhe/psci-relay.c:153:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got struct kvm_nvhe_init_params * @@
arch/arm64/kvm/hyp/nvhe/psci-relay.c:153:23: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/arm64/kvm/hyp/nvhe/psci-relay.c:153:23: sparse: got struct kvm_nvhe_init_params *
>> arch/arm64/kvm/hyp/nvhe/psci-relay.c:179:22: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got struct kvm_host_data * @@
arch/arm64/kvm/hyp/nvhe/psci-relay.c:179:22: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/arm64/kvm/hyp/nvhe/psci-relay.c:179:22: sparse: got struct kvm_host_data *
arch/arm64/kvm/hyp/nvhe/psci-relay.c:180:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got struct psci_boot_args * @@
arch/arm64/kvm/hyp/nvhe/psci-relay.c:180:21: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/arm64/kvm/hyp/nvhe/psci-relay.c:180:21: sparse: got struct psci_boot_args *

vim +152 arch/arm64/kvm/hyp/nvhe/psci-relay.c

129
130 static int psci_cpu_on(u64 func_id, struct kvm_cpu_context *host_ctxt)
131 {
132 DECLARE_REG(u64, mpidr, host_ctxt, 1);
133 DECLARE_REG(unsigned long, pc, host_ctxt, 2);
134 DECLARE_REG(unsigned long, r0, host_ctxt, 3);
135
136 unsigned int cpu_id;
137 struct psci_boot_args *boot_args;
138 struct kvm_nvhe_init_params *init_params;
139 int ret;
140
141 /*
142 * Find the logical CPU ID for the given MPIDR. The search set is
143 * the set of CPUs that were online at the point of KVM initialization.
144 * Booting other CPUs is rejected because their cpufeatures were not
145 * checked against the finalized capabilities. This could be relaxed
146 * by doing the feature checks in hyp.
147 */
148 cpu_id = find_cpu_id(mpidr);
149 if (cpu_id == INVALID_CPU_ID)
150 return PSCI_RET_INVALID_PARAMS;
151
> 152 boot_args = per_cpu_ptr(hyp_symbol_addr(cpu_on_args), cpu_id);
> 153 init_params = per_cpu_ptr(hyp_symbol_addr(kvm_init_params), cpu_id);
154
155 /* Check if the target CPU is already being booted. */
156 if (!try_acquire_boot_args(boot_args))
157 return PSCI_RET_ALREADY_ON;
158
159 boot_args->pc = pc;
160 boot_args->r0 = r0;
161 wmb();
162
163 ret = psci_call(func_id, mpidr,
164 __hyp_pa(hyp_symbol_addr(kvm_hyp_cpu_entry)),
165 __hyp_pa(init_params));
166
167 /* If successful, the lock will be released by the target CPU. */
168 if (ret != PSCI_RET_SUCCESS)
169 release_boot_args(boot_args);
170
171 return ret;
172 }
173
174 asmlinkage void __noreturn kvm_host_psci_cpu_entry(bool is_cpu_on)
175 {
176 struct psci_boot_args *boot_args;
177 struct kvm_cpu_context *host_ctxt;
178
> 179 host_ctxt = &this_cpu_ptr(hyp_symbol_addr(kvm_host_data))->host_ctxt;
180 boot_args = this_cpu_ptr(hyp_symbol_addr(cpu_on_args));
181
182 cpu_reg(host_ctxt, 0) = boot_args->r0;
183 write_sysreg_el2(boot_args->pc, SYS_ELR);
184 release_boot_args(boot_args);
185
186 __host_enter(host_ctxt);
187 }
188

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip