This patch set adds dma-buf importer role to the RDMA driver and thus provides a non-proprietary approach for supporting RDMA to/from buffers allocated from device local memory (e.g. GPU VRAM). Dma-buf is a standard mechanism in Linux kernel for sharing buffers among different device drivers. It is supported by mainstream GPU drivers. By using ioctl calls over the devices under /dev/dri/, user space applications can allocate and export GPU buffers as dma-buf objetcs with associated file descriptors. In order to use the exported GPU buffer for RDMA operations, the RDMA driver needs to be able to import dma-buf objects. This happens at the time of memory registration. A GPU buffer is registered as a special type of user space memory region with the dma-buf file descriptor as an extra parameter. The uverbs API needs to be extended to allow the extra parameter be passed from user space to kernel. Vendor RDMA drivers need to be modified in order to take advantage of the new feature. A patch for the mlx5 driver is provided as an example. Related user space RDMA library changes will be provided as a separate patch set. Jianxin Xiong (3): RDMA/umem: Support importing dma-buf as user memory region RDMA/uverbs: Add uverbs commands for fd-based MR registration RDMA/mlx5: Support new uverbs commands for registering fd-based MR drivers/infiniband/Kconfig | 10 ++ drivers/infiniband/core/Makefile | 1 + drivers/infiniband/core/device.c | 2 + drivers/infiniband/core/umem.c | 3 + drivers/infiniband/core/umem_dmabuf.c | 100 +++++++++++++++++++ drivers/infiniband/core/uverbs_cmd.c | 179 +++++++++++++++++++++++++++++++++- drivers/infiniband/hw/mlx5/main.c | 6 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 7 ++ drivers/infiniband/hw/mlx5/mr.c | 85 ++++++++++++++-- include/rdma/ib_umem.h | 5 + include/rdma/ib_umem_dmabuf.h | 50 ++++++++++ include/rdma/ib_verbs.h | 8 ++ include/uapi/rdma/ib_user_verbs.h | 28 ++++++ 13 files changed, 472 insertions(+), 12 deletions(-) create mode 100644 drivers/infiniband/core/umem_dmabuf.c create mode 100644 include/rdma/ib_umem_dmabuf.h -- 1.8.3.1