mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-27 08:05:27 +08:00
drm/virtio: return virtio_gpu_queue errors
In case queuing virtio commands fails (can happen when the device got unplugged) pass up the error. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Link: http://patchwork.freedesktop.org/patch/msgid/20200908070723.6394-3-kraxel@redhat.com
This commit is contained in:
parent
d6005d3dde
commit
b7170f9457
@ -320,13 +320,13 @@ static struct sg_table *vmalloc_to_sgt(char *data, uint32_t size, int *sg_ents)
|
||||
return sgt;
|
||||
}
|
||||
|
||||
static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf,
|
||||
struct virtio_gpu_fence *fence,
|
||||
int elemcnt,
|
||||
struct scatterlist **sgs,
|
||||
int outcnt,
|
||||
int incnt)
|
||||
static int virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf,
|
||||
struct virtio_gpu_fence *fence,
|
||||
int elemcnt,
|
||||
struct scatterlist **sgs,
|
||||
int outcnt,
|
||||
int incnt)
|
||||
{
|
||||
struct virtqueue *vq = vgdev->ctrlq.vq;
|
||||
int ret, idx;
|
||||
@ -335,7 +335,7 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
|
||||
if (fence && vbuf->objs)
|
||||
virtio_gpu_array_unlock_resv(vbuf->objs);
|
||||
free_vbuf(vgdev, vbuf);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vgdev->has_indirect)
|
||||
@ -373,15 +373,16 @@ again:
|
||||
spin_unlock(&vgdev->ctrlq.qlock);
|
||||
|
||||
drm_dev_exit(idx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf,
|
||||
struct virtio_gpu_fence *fence)
|
||||
static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf,
|
||||
struct virtio_gpu_fence *fence)
|
||||
{
|
||||
struct scatterlist *sgs[3], vcmd, vout, vresp;
|
||||
struct sg_table *sgt = NULL;
|
||||
int elemcnt = 0, outcnt = 0, incnt = 0;
|
||||
int elemcnt = 0, outcnt = 0, incnt = 0, ret;
|
||||
|
||||
/* set up vcmd */
|
||||
sg_init_one(&vcmd, vbuf->buf, vbuf->size);
|
||||
@ -398,7 +399,7 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
if (!sgt) {
|
||||
if (fence && vbuf->objs)
|
||||
virtio_gpu_array_unlock_resv(vbuf->objs);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
elemcnt += sg_ents;
|
||||
@ -419,13 +420,14 @@ static void virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
incnt++;
|
||||
}
|
||||
|
||||
virtio_gpu_queue_ctrl_sgs(vgdev, vbuf, fence, elemcnt, sgs, outcnt,
|
||||
incnt);
|
||||
ret = virtio_gpu_queue_ctrl_sgs(vgdev, vbuf, fence, elemcnt, sgs, outcnt,
|
||||
incnt);
|
||||
|
||||
if (sgt) {
|
||||
sg_free_table(sgt);
|
||||
kfree(sgt);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void virtio_gpu_notify(struct virtio_gpu_device *vgdev)
|
||||
@ -444,10 +446,10 @@ void virtio_gpu_notify(struct virtio_gpu_device *vgdev)
|
||||
virtqueue_notify(vgdev->ctrlq.vq);
|
||||
}
|
||||
|
||||
static void virtio_gpu_queue_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf)
|
||||
static int virtio_gpu_queue_ctrl_buffer(struct virtio_gpu_device *vgdev,
|
||||
struct virtio_gpu_vbuffer *vbuf)
|
||||
{
|
||||
virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, NULL);
|
||||
return virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, NULL);
|
||||
}
|
||||
|
||||
static void virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev,
|
||||
|
Loading…
Reference in New Issue
Block a user