]> git.baikalelectronics.ru Git - kernel.git/commit
vduse: Implement an MMU-based software IOTLB
authorXie Yongji <xieyongji@bytedance.com>
Tue, 31 Aug 2021 10:36:32 +0000 (18:36 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 6 Sep 2021 11:20:58 +0000 (07:20 -0400)
commit5d08386a2ab13e3f75cc9bb890c2322e31f5c439
tree8c1370c2588d26cba1d33f555d7a0b673dad665a
parentc49ed3bcc7d0be0a1cc8dbc307ad22f83215466a
vduse: Implement an MMU-based software IOTLB

This implements an MMU-based software IOTLB to support mapping
kernel dma buffer into userspace dynamically. The basic idea
behind it is treating MMU (VA->PA) as IOMMU (IOVA->PA). The
software IOTLB will set up MMU mapping instead of IOMMU mapping
for the DMA transfer so that the userspace process is able to
use its virtual address to access the dma buffer in kernel.

To avoid security issue, a bounce-buffering mechanism is
introduced to prevent userspace accessing the original buffer
directly which may contain other kernel data. During the mapping,
unmapping, the software IOTLB will copy the data from the original
buffer to the bounce buffer and back, depending on the direction
of the transfer. And the bounce-buffer addresses will be mapped
into the user address space instead of the original one.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20210831103634.33-12-xieyongji@bytedance.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/vdpa_user/iova_domain.c [new file with mode: 0644]
drivers/vdpa/vdpa_user/iova_domain.h [new file with mode: 0644]