Hi David,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on vhost/linux-next]
[also build test WARNING on v5.10-rc7]
[cannot apply to xen-tip/linux-next kvm/linux-next next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/David-Woodhouse/KVM-Add-Xen-hype...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
config: x86_64-randconfig-s021-20201210 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-179-ga00755aa-dirty
#
https://github.com/0day-ci/linux/commit/ac2b425f8c484a711fe7b2a01e875fd95...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
David-Woodhouse/KVM-Add-Xen-hypercall-and-shared-info-pages/20201206-190926
git checkout ac2b425f8c484a711fe7b2a01e875fd95248ac20
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
> arch/x86/kvm/xen.c:67:46: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void const [noderef] __user * @@
got unsigned char [usertype] * @@
arch/x86/kvm/xen.c:67:46: sparse: expected
void const [noderef] __user *
arch/x86/kvm/xen.c:67:46: sparse: got unsigned char [usertype] *
vim +67 arch/x86/kvm/xen.c
17
18 int kvm_xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
19 {
20 struct kvm *kvm = vcpu->kvm;
21 u32 page_num = data & ~PAGE_MASK;
22 u64 page_addr = data & PAGE_MASK;
23
24 /*
25 * If Xen hypercall intercept is enabled, fill the hypercall
26 * page with VMCALL/VMMCALL instructions since that's what
27 * we catch. Else the VMM has provided the hypercall pages
28 * with instructions of its own choosing, so use those.
29 */
30 if (kvm_xen_hypercall_enabled(kvm)) {
31 u8 instructions[32];
32 int i;
33
34 if (page_num)
35 return 1;
36
37 /* mov imm32, %eax */
38 instructions[0] = 0xb8;
39
40 /* vmcall / vmmcall */
41 kvm_x86_ops.patch_hypercall(vcpu, instructions + 5);
42
43 /* ret */
44 instructions[8] = 0xc3;
45
46 /* int3 to pad */
47 memset(instructions + 9, 0xcc, sizeof(instructions) - 9);
48
49 for (i = 0; i < PAGE_SIZE / sizeof(instructions); i++) {
50 *(u32 *)&instructions[1] = i;
51 if (kvm_vcpu_write_guest(vcpu,
52 page_addr + (i * sizeof(instructions)),
53 instructions, sizeof(instructions)))
54 return 1;
55 }
56 } else {
57 int lm = is_long_mode(vcpu);
58 u8 *blob_addr = lm ? (u8 *)(long)kvm->arch.xen_hvm_config.blob_addr_64
59 : (u8 *)(long)kvm->arch.xen_hvm_config.blob_addr_32;
60 u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
61 : kvm->arch.xen_hvm_config.blob_size_32;
62 u8 *page;
63
64 if (page_num >= blob_size)
65 return 1;
66
67 page = memdup_user(blob_addr + (page_num * PAGE_SIZE),
PAGE_SIZE);
68 if (IS_ERR(page))
69 return PTR_ERR(page);
70
71 if (kvm_vcpu_write_guest(vcpu, page_addr, page, PAGE_SIZE)) {
72 kfree(page);
73 return 1;
74 }
75 }
76 return 0;
77 }
78
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org