arch/x86/hyperv/ivm.c:43:25: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Thu Nov 18 2021 - 22:20:41 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4c388a8e740d3235a194f330c8ef327deef710f6
commit: 810a521265023a1d5c6c081ea2d216bc63d422f5 x86/hyperv: Add new hvcall guest address host visibility support
date: 3 weeks ago
config: i386-randconfig-s002-20211109 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=810a521265023a1d5c6c081ea2d216bc63d422f5
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 810a521265023a1d5c6c081ea2d216bc63d422f5
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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/x86/hyperv/ivm.c:43:25: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void [noderef] __percpu ** @@
arch/x86/hyperv/ivm.c:43:25: sparse: expected void const [noderef] __percpu *__vpp_verify
arch/x86/hyperv/ivm.c:43:25: sparse: got void [noderef] __percpu **

vim +43 arch/x86/hyperv/ivm.c

15
16 /*
17 * hv_mark_gpa_visibility - Set pages visible to host via hvcall.
18 *
19 * In Isolation VM, all guest memory is encrypted from host and guest
20 * needs to set memory visible to host via hvcall before sharing memory
21 * with host.
22 */
23 static int hv_mark_gpa_visibility(u16 count, const u64 pfn[],
24 enum hv_mem_host_visibility visibility)
25 {
26 struct hv_gpa_range_for_visibility **input_pcpu, *input;
27 u16 pages_processed;
28 u64 hv_status;
29 unsigned long flags;
30
31 /* no-op if partition isolation is not enabled */
32 if (!hv_is_isolation_supported())
33 return 0;
34
35 if (count > HV_MAX_MODIFY_GPA_REP_COUNT) {
36 pr_err("Hyper-V: GPA count:%d exceeds supported:%lu\n", count,
37 HV_MAX_MODIFY_GPA_REP_COUNT);
38 return -EINVAL;
39 }
40
41 local_irq_save(flags);
42 input_pcpu = (struct hv_gpa_range_for_visibility **)
> 43 this_cpu_ptr(hyperv_pcpu_input_arg);
44 input = *input_pcpu;
45 if (unlikely(!input)) {
46 local_irq_restore(flags);
47 return -EINVAL;
48 }
49
50 input->partition_id = HV_PARTITION_ID_SELF;
51 input->host_visibility = visibility;
52 input->reserved0 = 0;
53 input->reserved1 = 0;
54 memcpy((void *)input->gpa_page_list, pfn, count * sizeof(*pfn));
55 hv_status = hv_do_rep_hypercall(
56 HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY, count,
57 0, input, &pages_processed);
58 local_irq_restore(flags);
59
60 if (hv_result_success(hv_status))
61 return 0;
62 else
63 return -EFAULT;
64 }
65

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

Attachment: .config.gz
Description: application/gzip