Skip to content

Commit

Permalink
vduse: Introduce VDUSE - vDPA Device in Userspace
Browse files Browse the repository at this point in the history
This VDUSE driver enables implementing software-emulated vDPA
devices in userspace. The vDPA device is created by
ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device
interface (/dev/vduse/$NAME) is exported to userspace for device
emulation.

In order to make the device emulation more secure, the device's
control path is handled in kernel. A message mechnism is introduced
to forward some dataplane related control messages to userspace.

And in the data path, the DMA buffer will be mapped into userspace
address space through different ways depending on the vDPA bus to
which the vDPA device is attached. In virtio-vdpa case, the MMU-based
software IOTLB is used to achieve that. And in vhost-vdpa case, the
DMA buffer is reside in a userspace memory region which can be shared
to the VDUSE userspace processs via transferring the shmfd.

For more details on VDUSE design and usage, please see the follow-on
Documentation commit.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
  • Loading branch information
YongjiXie authored and intel-lab-lkp committed Aug 18, 2021
1 parent 67c2c6a commit 0b6102b
Show file tree
Hide file tree
Showing 6 changed files with 1,932 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/userspace-api/ioctl/ioctl-number.rst
Expand Up @@ -300,6 +300,7 @@ Code Seq# Include File Comments
'z' 10-4F drivers/s390/crypto/zcrypt_api.h conflict!
'|' 00-7F linux/media.h
0x80 00-1F linux/fb.h
0x81 00-1F linux/vduse.h
0x89 00-06 arch/x86/include/asm/sockios.h
0x89 0B-DF linux/sockios.h
0x89 E0-EF linux/sockios.h SIOCPROTOPRIVATE range
Expand Down
10 changes: 10 additions & 0 deletions drivers/vdpa/Kconfig
Expand Up @@ -33,6 +33,16 @@ config VDPA_SIM_BLOCK
vDPA block device simulator which terminates IO request in a
memory buffer.

config VDPA_USER
tristate "VDUSE (vDPA Device in Userspace) support"
depends on EVENTFD && MMU && HAS_DMA
select DMA_OPS
select VHOST_IOTLB
select IOMMU_IOVA
help
With VDUSE it is possible to emulate a vDPA Device
in a userspace program.

config IFCVF
tristate "Intel IFC VF vDPA driver"
depends on PCI_MSI
Expand Down
1 change: 1 addition & 0 deletions drivers/vdpa/Makefile
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VDPA) += vdpa.o
obj-$(CONFIG_VDPA_SIM) += vdpa_sim/
obj-$(CONFIG_VDPA_USER) += vdpa_user/
obj-$(CONFIG_IFCVF) += ifcvf/
obj-$(CONFIG_MLX5_VDPA) += mlx5/
obj-$(CONFIG_VP_VDPA) += virtio_pci/
5 changes: 5 additions & 0 deletions drivers/vdpa/vdpa_user/Makefile
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0

vduse-y := vduse_dev.o iova_domain.o

obj-$(CONFIG_VDPA_USER) += vduse.o

0 comments on commit 0b6102b

Please sign in to comment.