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 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,
userspace can use ioctl() to inject interrupt and use the eventfd
mechanism to receive virtqueue kicks.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
  • Loading branch information
YongjiXie authored and intel-lab-lkp committed Feb 23, 2021
1 parent 97cdf3b commit 5d6a89b
Show file tree
Hide file tree
Showing 6 changed files with 1,501 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 @@ -25,6 +25,16 @@ config VDPA_SIM_NET
help
vDPA networking device simulator which loops TX traffic back to RX.

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,5 +1,6 @@
# 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/
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 5d6a89b

Please sign in to comment.