[RFC PATCH V2 0/2] basic device IOTLB support

From: Jason Wang
Date: Thu Mar 24 2016 - 22:34:48 EST

This patch tries to implement an device IOTLB for vhost. This could be
used with for co-operation with userspace(qemu) implementation of
iommu for a secure DMA environment (DMAR) in guest.

The idea is simple. When vhost meets an IOTLB miss, it will request
the assistance of userspace to do the translation, this is done

- Fill the translation request in a preset userspace address (This
address is set through ioctl VHOST_SET_IOTLB_REQUEST_ENTRY).
- Notify userspace through eventfd (This eventfd was set through ioctl

When userspace finishes the translation, it will update the vhost
IOTLB through VHOST_UPDATE_IOTLB ioctl. Userspace is also in charge of
snooping the IOTLB invalidation of IOMMU IOTLB and use
VHOST_UPDATE_IOTLB to invalidate the possible entry in vhost.

The codes were designed to be architecture independent. It should be
easily ported to any architecture.

Changes from V1:
- support any size/range of updating and invalidation through
introducing the interval tree.
- convert from per device iotlb request to per virtqueue iotlb
request, this solves the possible deadlock in V1.
- read/write permission check support.

Please review.


Jason Wang (2):
vhost: convert pre sorted vhost memory array to interval tree
vhost: device IOTLB API

drivers/vhost/net.c | 14 +-
drivers/vhost/vhost.c | 427 +++++++++++++++++++++++++++++++++++----------
drivers/vhost/vhost.h | 42 ++++-
fs/eventfd.c | 3 +-
include/uapi/linux/vhost.h | 35 ++++
5 files changed, 419 insertions(+), 102 deletions(-)