On 2021/1/19 下午1:07, Xie Yongji wrote:
This VDUSE driver enables implementing vDPA devices in userspace. Both control path and data path of vDPA devices will be able to be handled in userspace. In the control path, the VDUSE driver will make use of message mechnism to forward the config operation from vdpa bus driver to userspace. Userspace can use read()/write() to receive/reply those control messages. In the data path, VDUSE_IOTLB_GET_FD ioctl will be used to get the file descriptors referring to vDPA device's iova regions. Then userspace can use mmap() to access those iova regions. Besides, the eventfd mechanism is used to trigger interrupt callbacks and receive virtqueue kicks in userspace. Signed-off-by: Xie Yongji<xieyongji@xxxxxxxxxxxxx> --- Documentation/driver-api/vduse.rst | 85 ++ Documentation/userspace-api/ioctl/ioctl-number.rst | 1 + drivers/vdpa/Kconfig | 7 + drivers/vdpa/Makefile | 1 + drivers/vdpa/vdpa_user/Makefile | 5 + drivers/vdpa/vdpa_user/eventfd.c | 221 ++++ drivers/vdpa/vdpa_user/eventfd.h | 48 + drivers/vdpa/vdpa_user/iova_domain.c | 426 +++++++ drivers/vdpa/vdpa_user/iova_domain.h | 68 ++ drivers/vdpa/vdpa_user/vduse.h | 62 + drivers/vdpa/vdpa_user/vduse_dev.c | 1217 ++++++++++++++++++++ include/uapi/linux/vdpa.h | 1 + include/uapi/linux/vduse.h | 125 ++ 13 files changed, 2267 insertions(+) create mode 100644 Documentation/driver-api/vduse.rst create mode 100644 drivers/vdpa/vdpa_user/Makefile create mode 100644 drivers/vdpa/vdpa_user/eventfd.c create mode 100644 drivers/vdpa/vdpa_user/eventfd.h create mode 100644 drivers/vdpa/vdpa_user/iova_domain.c create mode 100644 drivers/vdpa/vdpa_user/iova_domain.h create mode 100644 drivers/vdpa/vdpa_user/vduse.h create mode 100644 drivers/vdpa/vdpa_user/vduse_dev.c create mode 100644 include/uapi/linux/vduse.h
Btw, if you could split this into three parts: 1) iova domain 2) vduse device 3) doc It would be more easier for the reviewers. Thanks