Commit c900b2a4 authored by Chia-I Wu's avatar Chia-I Wu Committed by Gerd Hoffmann

drm/virtio: move the check for vqs_ready earlier

When vqs_ready is false, vq should be considered invalid and we
should not check vq->num_free.  After this change, a fenced command
queued before the vqs are ready will have fence id 0 and will be
considered done.
Signed-off-by: default avatarChia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20200205181955.202485-9-olvaffe@gmail.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 6ebe8661
...@@ -333,6 +333,14 @@ static bool virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, ...@@ -333,6 +333,14 @@ static bool virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
again: again:
spin_lock(&vgdev->ctrlq.qlock); spin_lock(&vgdev->ctrlq.qlock);
if (!vgdev->vqs_ready) {
spin_unlock(&vgdev->ctrlq.qlock);
if (fence && vbuf->objs)
virtio_gpu_array_unlock_resv(vbuf->objs);
return notify;
}
if (vq->num_free < elemcnt) { if (vq->num_free < elemcnt) {
spin_unlock(&vgdev->ctrlq.qlock); spin_unlock(&vgdev->ctrlq.qlock);
wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= elemcnt); wait_event(vgdev->ctrlq.ack_queue, vq->num_free >= elemcnt);
...@@ -351,11 +359,6 @@ static bool virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, ...@@ -351,11 +359,6 @@ static bool virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,
} }
} }
if (!vgdev->vqs_ready) {
spin_unlock(&vgdev->ctrlq.qlock);
return notify;
}
ret = virtqueue_add_sgs(vq, sgs, outcnt, incnt, vbuf, GFP_ATOMIC); ret = virtqueue_add_sgs(vq, sgs, outcnt, incnt, vbuf, GFP_ATOMIC);
WARN_ON(ret); WARN_ON(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment