]> git.baikalelectronics.ru Git - kernel.git/commit
vdpa_sim: use iova module to allocate IOVA addresses
authorStefano Garzarella <sgarzare@redhat.com>
Mon, 15 Mar 2021 16:34:37 +0000 (17:34 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 3 May 2021 08:55:52 +0000 (04:55 -0400)
commit3ae549f6f48264b086ae72527155a87031809f43
treebb79c1d6c17f922138afb024b75c642cec336a0b
parentb60d913e4ac5d25d7190df3828bc561521ed5bd2
vdpa_sim: use iova module to allocate IOVA addresses

The identical mapping used until now created issues when mapping
different virtual pages with the same physical address.
To solve this issue, we can use the iova module, to handle the IOVA
allocation.
For simplicity we use an IOVA allocator with byte granularity.

We add two new functions, vdpasim_map_range() and vdpasim_unmap_range(),
to handle the IOVA allocation and the registration into the IOMMU/IOTLB.
These functions are used by dma_map_ops callbacks.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20210315163450.254396-2-sgarzare@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/Kconfig
drivers/vdpa/vdpa_sim/vdpa_sim.c
drivers/vdpa/vdpa_sim/vdpa_sim.h