virtio_ring: enable premapped mode whatever use_dma_api
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Sat, 11 May 2024 03:14:01 +0000 (11:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 14 May 2024 00:07:41 +0000 (17:07 -0700)
Now, we have virtio DMA APIs, the driver can be the premapped
mode whatever the virtio core uses dma api or not.

So remove the limit of checking use_dma_api from
virtqueue_set_dma_premapped().

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20240511031404.30903-2-xuanzhuo@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/virtio/virtio_ring.c

index 6f7e5010a6735daf093952bad0025f0acd356253..2a972752ff1bc4809ce841a4119b386b93c9d61a 100644 (file)
@@ -2782,7 +2782,7 @@ EXPORT_SYMBOL_GPL(virtqueue_resize);
  *
  * Returns zero or a negative error.
  * 0: success.
- * -EINVAL: vring does not use the dma api, so we can not enable premapped mode.
+ * -EINVAL: too late to enable premapped mode, the vq already contains buffers.
  */
 int virtqueue_set_dma_premapped(struct virtqueue *_vq)
 {
@@ -2798,11 +2798,6 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq)
                return -EINVAL;
        }
 
-       if (!vq->use_dma_api) {
-               END_USE(vq);
-               return -EINVAL;
-       }
-
        vq->premapped = true;
        vq->do_unmap = false;