[PATCH 14/24] drm/virtio: implement blob resources: probe for host visible region
kernel test robot
lkp at intel.com
Sun Aug 16 13:10:16 UTC 2020
Hi Gurchetan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip linus/master next-20200814]
[cannot apply to tegra-drm/drm/tegra/for-next drm/drm-next drm-exynos/exynos-drm-next v5.8]
[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/Gurchetan-Singh/Blob-prerequisites-blob-resources/20200814-104250
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-m021-20200816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
smatch warnings:
drivers/gpu/drm/virtio/virtgpu_kms.c:227 virtio_gpu_init() error: uninitialized symbol 'ret'.
# https://github.com/0day-ci/linux/commit/ded3d7b8bb13eb8599f8d410f184521214e13328
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Gurchetan-Singh/Blob-prerequisites-blob-resources/20200814-104250
git checkout ded3d7b8bb13eb8599f8d410f184521214e13328
vim +/ret +227 drivers/gpu/drm/virtio/virtgpu_kms.c
62fb7a5e10962a Gerd Hoffmann 2014-10-28 94
d516e75c71c985 Ezequiel Garcia 2019-01-08 95 int virtio_gpu_init(struct drm_device *dev)
dc5698e80cf724 Dave Airlie 2013-09-09 96 {
dc5698e80cf724 Dave Airlie 2013-09-09 97 static vq_callback_t *callbacks[] = {
dc5698e80cf724 Dave Airlie 2013-09-09 98 virtio_gpu_ctrl_ack, virtio_gpu_cursor_ack
dc5698e80cf724 Dave Airlie 2013-09-09 99 };
f7ad26ff952b3c Stefan Hajnoczi 2015-12-17 100 static const char * const names[] = { "control", "cursor" };
dc5698e80cf724 Dave Airlie 2013-09-09 101
dc5698e80cf724 Dave Airlie 2013-09-09 102 struct virtio_gpu_device *vgdev;
dc5698e80cf724 Dave Airlie 2013-09-09 103 /* this will expand later */
dc5698e80cf724 Dave Airlie 2013-09-09 104 struct virtqueue *vqs[2];
62fb7a5e10962a Gerd Hoffmann 2014-10-28 105 u32 num_scanouts, num_capsets;
dc5698e80cf724 Dave Airlie 2013-09-09 106 int ret;
dc5698e80cf724 Dave Airlie 2013-09-09 107
18e51064c42ca3 Daniel Vetter 2017-05-24 108 if (!virtio_has_feature(dev_to_virtio(dev->dev), VIRTIO_F_VERSION_1))
dc5698e80cf724 Dave Airlie 2013-09-09 109 return -ENODEV;
dc5698e80cf724 Dave Airlie 2013-09-09 110
dc5698e80cf724 Dave Airlie 2013-09-09 111 vgdev = kzalloc(sizeof(struct virtio_gpu_device), GFP_KERNEL);
dc5698e80cf724 Dave Airlie 2013-09-09 112 if (!vgdev)
dc5698e80cf724 Dave Airlie 2013-09-09 113 return -ENOMEM;
dc5698e80cf724 Dave Airlie 2013-09-09 114
dc5698e80cf724 Dave Airlie 2013-09-09 115 vgdev->ddev = dev;
dc5698e80cf724 Dave Airlie 2013-09-09 116 dev->dev_private = vgdev;
18e51064c42ca3 Daniel Vetter 2017-05-24 117 vgdev->vdev = dev_to_virtio(dev->dev);
dc5698e80cf724 Dave Airlie 2013-09-09 118 vgdev->dev = dev->dev;
dc5698e80cf724 Dave Airlie 2013-09-09 119
dc5698e80cf724 Dave Airlie 2013-09-09 120 spin_lock_init(&vgdev->display_info_lock);
f6e6d9eff0b4e9 David Stevens 2020-08-13 121 spin_lock_init(&vgdev->resource_export_lock);
1938d1ae32fefa Matthew Wilcox 2018-09-26 122 ida_init(&vgdev->ctx_id_ida);
1938d1ae32fefa Matthew Wilcox 2018-09-26 123 ida_init(&vgdev->resource_ida);
dc5698e80cf724 Dave Airlie 2013-09-09 124 init_waitqueue_head(&vgdev->resp_wq);
dc5698e80cf724 Dave Airlie 2013-09-09 125 virtio_gpu_init_vq(&vgdev->ctrlq, virtio_gpu_dequeue_ctrl_func);
dc5698e80cf724 Dave Airlie 2013-09-09 126 virtio_gpu_init_vq(&vgdev->cursorq, virtio_gpu_dequeue_cursor_func);
dc5698e80cf724 Dave Airlie 2013-09-09 127
f54d1867005c33 Chris Wilson 2016-10-25 128 vgdev->fence_drv.context = dma_fence_context_alloc(1);
dc5698e80cf724 Dave Airlie 2013-09-09 129 spin_lock_init(&vgdev->fence_drv.lock);
dc5698e80cf724 Dave Airlie 2013-09-09 130 INIT_LIST_HEAD(&vgdev->fence_drv.fences);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 131 INIT_LIST_HEAD(&vgdev->cap_cache);
dc5698e80cf724 Dave Airlie 2013-09-09 132 INIT_WORK(&vgdev->config_changed_work,
dc5698e80cf724 Dave Airlie 2013-09-09 133 virtio_gpu_config_changed_work_func);
dc5698e80cf724 Dave Airlie 2013-09-09 134
f0c6cef7e7174b Gerd Hoffmann 2019-08-30 135 INIT_WORK(&vgdev->obj_free_work,
f0c6cef7e7174b Gerd Hoffmann 2019-08-30 136 virtio_gpu_array_put_free_work);
f0c6cef7e7174b Gerd Hoffmann 2019-08-30 137 INIT_LIST_HEAD(&vgdev->obj_free_list);
f0c6cef7e7174b Gerd Hoffmann 2019-08-30 138 spin_lock_init(&vgdev->obj_free_lock);
f0c6cef7e7174b Gerd Hoffmann 2019-08-30 139
ff2ac58a45914c Laurent Vivier 2017-01-24 140 #ifdef __LITTLE_ENDIAN
62fb7a5e10962a Gerd Hoffmann 2014-10-28 141 if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_VIRGL))
62fb7a5e10962a Gerd Hoffmann 2014-10-28 142 vgdev->has_virgl_3d = true;
ff2ac58a45914c Laurent Vivier 2017-01-24 143 #endif
b4b01b4995fb15 Gerd Hoffmann 2018-10-30 144 if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_EDID)) {
b4b01b4995fb15 Gerd Hoffmann 2018-10-30 145 vgdev->has_edid = true;
b4b01b4995fb15 Gerd Hoffmann 2018-10-30 146 }
5edbb56082567d Gerd Hoffmann 2020-02-07 147 if (virtio_has_feature(vgdev->vdev, VIRTIO_RING_F_INDIRECT_DESC)) {
5edbb56082567d Gerd Hoffmann 2020-02-07 148 vgdev->has_indirect = true;
5edbb56082567d Gerd Hoffmann 2020-02-07 149 }
f6e6d9eff0b4e9 David Stevens 2020-08-13 150 if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_RESOURCE_UUID)) {
f6e6d9eff0b4e9 David Stevens 2020-08-13 151 vgdev->has_resource_assign_uuid = true;
f6e6d9eff0b4e9 David Stevens 2020-08-13 152 }
bfb6d04f29ac99 Gerd Hoffmann 2020-08-13 153 if (virtio_has_feature(vgdev->vdev, VIRTIO_GPU_F_RESOURCE_BLOB)) {
bfb6d04f29ac99 Gerd Hoffmann 2020-08-13 154 vgdev->has_resource_blob = true;
bfb6d04f29ac99 Gerd Hoffmann 2020-08-13 155 }
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 156 if (virtio_get_shm_region(vgdev->vdev, &vgdev->host_visible_region,
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 157 VIRTIO_GPU_SHM_ID_HOST_VISIBLE)) {
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 158 if (!devm_request_mem_region(&vgdev->vdev->dev,
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 159 vgdev->host_visible_region.addr,
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 160 vgdev->host_visible_region.len,
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 161 dev_name(&vgdev->vdev->dev))) {
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 162 DRM_ERROR("Could not reserve host visible region\n");
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 163 goto err_vqs;
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 164 }
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 165
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 166 DRM_INFO("Host memory window: 0x%lx +0x%lx\n",
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 167 (unsigned long)vgdev->host_visible_region.addr,
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 168 (unsigned long)vgdev->host_visible_region.len);
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 169 vgdev->has_host_visible = true;
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 170 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 171
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 172 DRM_INFO("features: %cvirgl %cedid %cresource_blob %chost_visible\n",
9e370dfec4fee8 Gerd Hoffmann 2019-10-18 173 vgdev->has_virgl_3d ? '+' : '-',
bfb6d04f29ac99 Gerd Hoffmann 2020-08-13 174 vgdev->has_edid ? '+' : '-',
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 175 vgdev->has_resource_blob ? '+' : '-',
ded3d7b8bb13eb Gerd Hoffmann 2020-08-13 176 vgdev->has_host_visible ? '+' : '-');
9e370dfec4fee8 Gerd Hoffmann 2019-10-18 177
9b2bbdb2275884 Michael S. Tsirkin 2017-03-06 178 ret = virtio_find_vqs(vgdev->vdev, 2, vqs, callbacks, names, NULL);
dc5698e80cf724 Dave Airlie 2013-09-09 179 if (ret) {
dc5698e80cf724 Dave Airlie 2013-09-09 180 DRM_ERROR("failed to find virt queues\n");
dc5698e80cf724 Dave Airlie 2013-09-09 181 goto err_vqs;
dc5698e80cf724 Dave Airlie 2013-09-09 182 }
dc5698e80cf724 Dave Airlie 2013-09-09 183 vgdev->ctrlq.vq = vqs[0];
dc5698e80cf724 Dave Airlie 2013-09-09 184 vgdev->cursorq.vq = vqs[1];
dc5698e80cf724 Dave Airlie 2013-09-09 185 ret = virtio_gpu_alloc_vbufs(vgdev);
dc5698e80cf724 Dave Airlie 2013-09-09 186 if (ret) {
dc5698e80cf724 Dave Airlie 2013-09-09 187 DRM_ERROR("failed to alloc vbufs\n");
dc5698e80cf724 Dave Airlie 2013-09-09 188 goto err_vbufs;
dc5698e80cf724 Dave Airlie 2013-09-09 189 }
dc5698e80cf724 Dave Airlie 2013-09-09 190
dc5698e80cf724 Dave Airlie 2013-09-09 191 /* get display info */
dc5698e80cf724 Dave Airlie 2013-09-09 192 virtio_cread(vgdev->vdev, struct virtio_gpu_config,
dc5698e80cf724 Dave Airlie 2013-09-09 193 num_scanouts, &num_scanouts);
dc5698e80cf724 Dave Airlie 2013-09-09 194 vgdev->num_scanouts = min_t(uint32_t, num_scanouts,
dc5698e80cf724 Dave Airlie 2013-09-09 195 VIRTIO_GPU_MAX_SCANOUTS);
dc5698e80cf724 Dave Airlie 2013-09-09 196 if (!vgdev->num_scanouts) {
dc5698e80cf724 Dave Airlie 2013-09-09 197 DRM_ERROR("num_scanouts is zero\n");
dc5698e80cf724 Dave Airlie 2013-09-09 198 ret = -EINVAL;
dc5698e80cf724 Dave Airlie 2013-09-09 199 goto err_scanouts;
dc5698e80cf724 Dave Airlie 2013-09-09 200 }
62fb7a5e10962a Gerd Hoffmann 2014-10-28 201 DRM_INFO("number of scanouts: %d\n", num_scanouts);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 202
62fb7a5e10962a Gerd Hoffmann 2014-10-28 203 virtio_cread(vgdev->vdev, struct virtio_gpu_config,
62fb7a5e10962a Gerd Hoffmann 2014-10-28 204 num_capsets, &num_capsets);
62fb7a5e10962a Gerd Hoffmann 2014-10-28 205 DRM_INFO("number of cap sets: %d\n", num_capsets);
dc5698e80cf724 Dave Airlie 2013-09-09 206
d516e75c71c985 Ezequiel Garcia 2019-01-08 207 virtio_gpu_modeset_init(vgdev);
dc5698e80cf724 Dave Airlie 2013-09-09 208
dc5698e80cf724 Dave Airlie 2013-09-09 209 virtio_device_ready(vgdev->vdev);
dc5698e80cf724 Dave Airlie 2013-09-09 210
62fb7a5e10962a Gerd Hoffmann 2014-10-28 211 if (num_capsets)
62fb7a5e10962a Gerd Hoffmann 2014-10-28 212 virtio_gpu_get_capsets(vgdev, num_capsets);
b4b01b4995fb15 Gerd Hoffmann 2018-10-30 213 if (vgdev->has_edid)
b4b01b4995fb15 Gerd Hoffmann 2018-10-30 214 virtio_gpu_cmd_get_edids(vgdev);
441012aff674c8 Dave Airlie 2015-06-16 215 virtio_gpu_cmd_get_display_info(vgdev);
234489ea55f81a Gerd Hoffmann 2020-02-14 216 virtio_gpu_notify(vgdev);
441012aff674c8 Dave Airlie 2015-06-16 217 wait_event_timeout(vgdev->resp_wq, !vgdev->display_info_pending,
441012aff674c8 Dave Airlie 2015-06-16 218 5 * HZ);
dc5698e80cf724 Dave Airlie 2013-09-09 219 return 0;
dc5698e80cf724 Dave Airlie 2013-09-09 220
dc5698e80cf724 Dave Airlie 2013-09-09 221 err_scanouts:
dc5698e80cf724 Dave Airlie 2013-09-09 222 virtio_gpu_free_vbufs(vgdev);
dc5698e80cf724 Dave Airlie 2013-09-09 223 err_vbufs:
dc5698e80cf724 Dave Airlie 2013-09-09 224 vgdev->vdev->config->del_vqs(vgdev->vdev);
dc5698e80cf724 Dave Airlie 2013-09-09 225 err_vqs:
dc5698e80cf724 Dave Airlie 2013-09-09 226 kfree(vgdev);
dc5698e80cf724 Dave Airlie 2013-09-09 @227 return ret;
dc5698e80cf724 Dave Airlie 2013-09-09 228 }
dc5698e80cf724 Dave Airlie 2013-09-09 229
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 47589 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200816/876fd1f5/attachment-0001.gz>
More information about the dri-devel
mailing list