[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202004070836.2rR1RdSI%lkp@intel.com>
Date: Tue, 7 Apr 2020 08:15:42 +0800
From: kbuild test robot <lkp@...el.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: kbuild-all@...ts.01.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org
Subject: [vhost:vhost 32/44] drivers/gpu/drm/virtio/virtgpu_ioctl.c:113:7:
error: implicit declaration of function 'copy_from_user'; did you mean
'sg_copy_from_buffer'?
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost
head: 4e6ebec0de18aaea5f5f814b25bfcae3751c6369
commit: 013a472de94693ba05696d59e7df3224c20a22e6 [32/44] virtio: stop using legacy struct vring in kernel
config: m68k-allmodconfig (attached as .config)
compiler: m68k-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
git checkout 013a472de94693ba05696d59e7df3224c20a22e6
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
drivers/gpu/drm/virtio/virtgpu_ioctl.c: In function 'virtio_gpu_execbuffer_ioctl':
>> drivers/gpu/drm/virtio/virtgpu_ioctl.c:113:7: error: implicit declaration of function 'copy_from_user'; did you mean 'sg_copy_from_buffer'? [-Werror=implicit-function-declaration]
113 | if (copy_from_user(bo_handles, user_bo_handles,
| ^~~~~~~~~~~~~~
| sg_copy_from_buffer
drivers/gpu/drm/virtio/virtgpu_ioctl.c: In function 'virtio_gpu_getparam_ioctl':
>> drivers/gpu/drm/virtio/virtgpu_ioctl.c:196:6: error: implicit declaration of function 'copy_to_user' [-Werror=implicit-function-declaration]
196 | if (copy_to_user(u64_to_user_ptr(param->value), &value, sizeof(int)))
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +113 drivers/gpu/drm/virtio/virtgpu_ioctl.c
62fb7a5e10962a Gerd Hoffmann 2014-10-28 46
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 47 /*
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 48 * Usage of execbuffer:
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 49 * Relocations need to take into account the full VIRTIO_GPUDrawable size.
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 50 * However, the command as passed from user space must *not* contain the initial
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 51 * VIRTIO_GPUReleaseInfo struct (first XXX bytes)
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 52 */
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 53 static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
62fb7a5e10962a Gerd Hoffmann 2014-10-28 54 struct drm_file *drm_file)
62fb7a5e10962a Gerd Hoffmann 2014-10-28 55 {
5c32c3dd8501b0 Gustavo Padovan 2016-08-31 56 struct drm_virtgpu_execbuffer *exbuf = data;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 57 struct virtio_gpu_device *vgdev = dev->dev_private;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 58 struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv;
2cd7b6f08bc4cf Robert Foss 2018-11-12 59 struct virtio_gpu_fence *out_fence;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 60 int ret;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 61 uint32_t *bo_handles = NULL;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 62 void __user *user_bo_handles = NULL;
da758d51968a88 Gerd Hoffmann 2019-08-29 63 struct virtio_gpu_object_array *buflist = NULL;
2cd7b6f08bc4cf Robert Foss 2018-11-12 64 struct sync_file *sync_file;
2cd7b6f08bc4cf Robert Foss 2018-11-12 65 int in_fence_fd = exbuf->fence_fd;
2cd7b6f08bc4cf Robert Foss 2018-11-12 66 int out_fence_fd = -1;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 67 void *buf;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 68
62fb7a5e10962a Gerd Hoffmann 2014-10-28 69 if (vgdev->has_virgl_3d == false)
62fb7a5e10962a Gerd Hoffmann 2014-10-28 70 return -ENOSYS;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 71
a56f9c868ccf56 Robert Foss 2018-11-12 72 if ((exbuf->flags & ~VIRTGPU_EXECBUF_FLAGS))
a56f9c868ccf56 Robert Foss 2018-11-12 73 return -EINVAL;
a56f9c868ccf56 Robert Foss 2018-11-12 74
a56f9c868ccf56 Robert Foss 2018-11-12 75 exbuf->fence_fd = -1;
a56f9c868ccf56 Robert Foss 2018-11-12 76
2cd7b6f08bc4cf Robert Foss 2018-11-12 77 if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_IN) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 78 struct dma_fence *in_fence;
2cd7b6f08bc4cf Robert Foss 2018-11-12 79
2cd7b6f08bc4cf Robert Foss 2018-11-12 80 in_fence = sync_file_get_fence(in_fence_fd);
2cd7b6f08bc4cf Robert Foss 2018-11-12 81
2cd7b6f08bc4cf Robert Foss 2018-11-12 82 if (!in_fence)
2cd7b6f08bc4cf Robert Foss 2018-11-12 83 return -EINVAL;
2cd7b6f08bc4cf Robert Foss 2018-11-12 84
2cd7b6f08bc4cf Robert Foss 2018-11-12 85 /*
2cd7b6f08bc4cf Robert Foss 2018-11-12 86 * Wait if the fence is from a foreign context, or if the fence
2cd7b6f08bc4cf Robert Foss 2018-11-12 87 * array contains any fence from a foreign context.
2cd7b6f08bc4cf Robert Foss 2018-11-12 88 */
2cd7b6f08bc4cf Robert Foss 2018-11-12 89 ret = 0;
2cd7b6f08bc4cf Robert Foss 2018-11-12 90 if (!dma_fence_match_context(in_fence, vgdev->fence_drv.context))
2cd7b6f08bc4cf Robert Foss 2018-11-12 91 ret = dma_fence_wait(in_fence, true);
2cd7b6f08bc4cf Robert Foss 2018-11-12 92
2cd7b6f08bc4cf Robert Foss 2018-11-12 93 dma_fence_put(in_fence);
2cd7b6f08bc4cf Robert Foss 2018-11-12 94 if (ret)
2cd7b6f08bc4cf Robert Foss 2018-11-12 95 return ret;
2cd7b6f08bc4cf Robert Foss 2018-11-12 96 }
2cd7b6f08bc4cf Robert Foss 2018-11-12 97
2cd7b6f08bc4cf Robert Foss 2018-11-12 98 if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_OUT) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 99 out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
2cd7b6f08bc4cf Robert Foss 2018-11-12 100 if (out_fence_fd < 0)
2cd7b6f08bc4cf Robert Foss 2018-11-12 101 return out_fence_fd;
2cd7b6f08bc4cf Robert Foss 2018-11-12 102 }
2cd7b6f08bc4cf Robert Foss 2018-11-12 103
62fb7a5e10962a Gerd Hoffmann 2014-10-28 104 if (exbuf->num_bo_handles) {
2098105ec65cb3 Michal Hocko 2017-05-17 105 bo_handles = kvmalloc_array(exbuf->num_bo_handles,
2098105ec65cb3 Michal Hocko 2017-05-17 106 sizeof(uint32_t), GFP_KERNEL);
da758d51968a88 Gerd Hoffmann 2019-08-29 107 if (!bo_handles) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 108 ret = -ENOMEM;
2cd7b6f08bc4cf Robert Foss 2018-11-12 109 goto out_unused_fd;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 110 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 111
4b013bb2d3a4a3 Gurchetan Singh 2019-06-04 112 user_bo_handles = u64_to_user_ptr(exbuf->bo_handles);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 @113 if (copy_from_user(bo_handles, user_bo_handles,
62fb7a5e10962a Gerd Hoffmann 2014-10-28 114 exbuf->num_bo_handles * sizeof(uint32_t))) {
62fb7a5e10962a Gerd Hoffmann 2014-10-28 115 ret = -EFAULT;
2cd7b6f08bc4cf Robert Foss 2018-11-12 116 goto out_unused_fd;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 117 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 118
da758d51968a88 Gerd Hoffmann 2019-08-29 119 buflist = virtio_gpu_array_from_handles(drm_file, bo_handles,
da758d51968a88 Gerd Hoffmann 2019-08-29 120 exbuf->num_bo_handles);
da758d51968a88 Gerd Hoffmann 2019-08-29 121 if (!buflist) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 122 ret = -ENOENT;
2cd7b6f08bc4cf Robert Foss 2018-11-12 123 goto out_unused_fd;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 124 }
2098105ec65cb3 Michal Hocko 2017-05-17 125 kvfree(bo_handles);
2cd7b6f08bc4cf Robert Foss 2018-11-12 126 bo_handles = NULL;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 127 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 128
da758d51968a88 Gerd Hoffmann 2019-08-29 129 if (buflist) {
da758d51968a88 Gerd Hoffmann 2019-08-29 130 ret = virtio_gpu_array_lock_resv(buflist);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 131 if (ret)
da758d51968a88 Gerd Hoffmann 2019-08-29 132 goto out_unused_fd;
da758d51968a88 Gerd Hoffmann 2019-08-29 133 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 134
e1218b8c0cc1f8 David Riley 2019-09-11 135 buf = vmemdup_user(u64_to_user_ptr(exbuf->command), exbuf->size);
7ad61e6b4a79c5 Markus Elfring 2016-08-18 136 if (IS_ERR(buf)) {
7ad61e6b4a79c5 Markus Elfring 2016-08-18 137 ret = PTR_ERR(buf);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 138 goto out_unresv;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 139 }
9fdd90c0f42440 Robert Foss 2018-11-12 140
2cd7b6f08bc4cf Robert Foss 2018-11-12 141 out_fence = virtio_gpu_fence_alloc(vgdev);
2cd7b6f08bc4cf Robert Foss 2018-11-12 142 if(!out_fence) {
9fdd90c0f42440 Robert Foss 2018-11-12 143 ret = -ENOMEM;
2cd7b6f08bc4cf Robert Foss 2018-11-12 144 goto out_memdup;
2cd7b6f08bc4cf Robert Foss 2018-11-12 145 }
2cd7b6f08bc4cf Robert Foss 2018-11-12 146
2cd7b6f08bc4cf Robert Foss 2018-11-12 147 if (out_fence_fd >= 0) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 148 sync_file = sync_file_create(&out_fence->f);
2cd7b6f08bc4cf Robert Foss 2018-11-12 149 if (!sync_file) {
2cd7b6f08bc4cf Robert Foss 2018-11-12 150 dma_fence_put(&out_fence->f);
2cd7b6f08bc4cf Robert Foss 2018-11-12 151 ret = -ENOMEM;
2cd7b6f08bc4cf Robert Foss 2018-11-12 152 goto out_memdup;
2cd7b6f08bc4cf Robert Foss 2018-11-12 153 }
2cd7b6f08bc4cf Robert Foss 2018-11-12 154
2cd7b6f08bc4cf Robert Foss 2018-11-12 155 exbuf->fence_fd = out_fence_fd;
2cd7b6f08bc4cf Robert Foss 2018-11-12 156 fd_install(out_fence_fd, sync_file->file);
9fdd90c0f42440 Robert Foss 2018-11-12 157 }
2cd7b6f08bc4cf Robert Foss 2018-11-12 158
62fb7a5e10962a Gerd Hoffmann 2014-10-28 159 virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
da758d51968a88 Gerd Hoffmann 2019-08-29 160 vfpriv->ctx_id, buflist, out_fence);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 161 return 0;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 162
2cd7b6f08bc4cf Robert Foss 2018-11-12 163 out_memdup:
e1218b8c0cc1f8 David Riley 2019-09-11 164 kvfree(buf);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 165 out_unresv:
da758d51968a88 Gerd Hoffmann 2019-08-29 166 if (buflist)
da758d51968a88 Gerd Hoffmann 2019-08-29 167 virtio_gpu_array_unlock_resv(buflist);
2cd7b6f08bc4cf Robert Foss 2018-11-12 168 out_unused_fd:
2cd7b6f08bc4cf Robert Foss 2018-11-12 169 kvfree(bo_handles);
da758d51968a88 Gerd Hoffmann 2019-08-29 170 if (buflist)
da758d51968a88 Gerd Hoffmann 2019-08-29 171 virtio_gpu_array_put_free(buflist);
2cd7b6f08bc4cf Robert Foss 2018-11-12 172
2cd7b6f08bc4cf Robert Foss 2018-11-12 173 if (out_fence_fd >= 0)
2cd7b6f08bc4cf Robert Foss 2018-11-12 174 put_unused_fd(out_fence_fd);
2cd7b6f08bc4cf Robert Foss 2018-11-12 175
62fb7a5e10962a Gerd Hoffmann 2014-10-28 176 return ret;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 177 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 178
62fb7a5e10962a Gerd Hoffmann 2014-10-28 179 static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
62fb7a5e10962a Gerd Hoffmann 2014-10-28 180 struct drm_file *file_priv)
62fb7a5e10962a Gerd Hoffmann 2014-10-28 181 {
62fb7a5e10962a Gerd Hoffmann 2014-10-28 182 struct virtio_gpu_device *vgdev = dev->dev_private;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 183 struct drm_virtgpu_getparam *param = data;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 184 int value;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 185
62fb7a5e10962a Gerd Hoffmann 2014-10-28 186 switch (param->param) {
62fb7a5e10962a Gerd Hoffmann 2014-10-28 187 case VIRTGPU_PARAM_3D_FEATURES:
62fb7a5e10962a Gerd Hoffmann 2014-10-28 188 value = vgdev->has_virgl_3d == true ? 1 : 0;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 189 break;
9a191b11490645 Dave Airlie 2018-02-21 190 case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
9a191b11490645 Dave Airlie 2018-02-21 191 value = 1;
9a191b11490645 Dave Airlie 2018-02-21 192 break;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 193 default:
62fb7a5e10962a Gerd Hoffmann 2014-10-28 194 return -EINVAL;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 195 }
4b013bb2d3a4a3 Gurchetan Singh 2019-06-04 @196 if (copy_to_user(u64_to_user_ptr(param->value), &value, sizeof(int)))
62fb7a5e10962a Gerd Hoffmann 2014-10-28 197 return -EFAULT;
4b013bb2d3a4a3 Gurchetan Singh 2019-06-04 198
62fb7a5e10962a Gerd Hoffmann 2014-10-28 199 return 0;
62fb7a5e10962a Gerd Hoffmann 2014-10-28 200 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 201
:::::: The code at line 113 was first introduced by commit
:::::: 62fb7a5e10962ac6ae2a2d2dbd3aedcb2a3e3257 virtio-gpu: add 3d/virgl support
:::::: TO: Gerd Hoffmann <kraxel@...hat.com>
:::::: CC: Gerd Hoffmann <kraxel@...hat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (53030 bytes)
Powered by blists - more mailing lists