]> git.baikalelectronics.ru Git - kernel.git/commit
vringh: iterate on iotlb_translate to handle large translations
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 24 Jun 2022 07:56:56 +0000 (09:56 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 11 Aug 2022 08:06:37 +0000 (04:06 -0400)
commit06509212babf85e88e09da9fe0f8efc2da01d71b
tree6b1fba451ea14b42c44fed31826f48d3c5df4fd8
parent2dd1f02dd781649f5cf24a7d098abb31d7811711
vringh: iterate on iotlb_translate to handle large translations

iotlb_translate() can return -ENOBUFS if the bio_vec is not big enough
to contain all the ranges for translation.
This can happen for example if the VMM maps a large bounce buffer,
without using hugepages, that requires more than 16 ranges to translate
the addresses.

To handle this case, let's extend iotlb_translate() to also return the
number of bytes successfully translated.
In copy_from_iotlb()/copy_to_iotlb() loops by calling iotlb_translate()
several times until we complete the translation.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220624075656.13997-1-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vhost/vringh.c