[PATCH v13 13/13] Documentation: Add documentation for VDUSE

2021-08-31 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/index.rst | 1 + Documentation

[PATCH v13 12/13] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-31 Thread Xie Yongji
n and usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers

[PATCH v13 11/13] vduse: Implement an MMU-based software IOTLB

2021-08-31 Thread Xie Yongji
l copy the data from the original buffer to the bounce buffer and back, depending on the direction of the transfer. And the bounce-buffer addresses will be mapped into the user address space instead of the original one. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdp

[PATCH v13 10/13] vdpa: Support transferring virtual addressing during DMA mapping

2021-08-31 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v13 09/13] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-08-31 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v13 08/13] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-08-31 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v13 07/13] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-08-31 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v13 06/13] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-31 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost

[PATCH v13 05/13] vdpa: Add reset callback in vdpa_config_ops

2021-08-31 Thread Xie Yongji
This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting. Signed-off-by: Xie Yongji --- drivers/vdpa/ifcvf/ifcvf_main.c | 35 +++--- drivers/vdpa/mlx5/net

[PATCH v13 04/13] vdpa: Fix some coding style issues

2021-08-31 Thread Xie Yongji
Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: Xie Yongji Acked-by: Jas

[PATCH v13 01/13] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-31 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji Acked-by: Jason Wang Acked-by: Will Deacon --- drivers/iommu/iova.c | 2 ++ 1

[PATCH v13 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-31 Thread Xie Yongji
Export eventfd_wake_count so that some modules can use the eventfd_signal_count() to check whether the eventfd_signal() call should be deferred to a safe context. Signed-off-by: Xie Yongji --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index

[PATCH v13 03/13] file: Export receive_fd() to modules

2021-08-31 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions

[PATCH v13 00/13] Introduce VDUSE - vDPA Device in Userspace

2021-08-31 Thread Xie Yongji
vhost-vdpa - Remove the patches on bounce pages reclaim V1 to V2: - Add vhost-vdpa support - Add some documents - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_map Xie Yongji (13): iova: Export alloc_iova_fa

[PATCH v12 13/13] Documentation: Add documentation for VDUSE

2021-08-30 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/index.rst | 1 + Documentation

[PATCH v12 12/13] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-30 Thread Xie Yongji
n and usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers

[PATCH v12 11/13] vduse: Implement an MMU-based software IOTLB

2021-08-30 Thread Xie Yongji
l copy the data from the original buffer to the bounce buffer and back, depending on the direction of the transfer. And the bounce-buffer addresses will be mapped into the user address space instead of the original one. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdp

[PATCH v12 10/13] vdpa: Support transferring virtual addressing during DMA mapping

2021-08-30 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v12 09/13] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-08-30 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v12 08/13] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-08-30 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v12 07/13] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-08-30 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v12 06/13] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-30 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost

[PATCH v12 05/13] vdpa: Add reset callback in vdpa_config_ops

2021-08-30 Thread Xie Yongji
This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting. Signed-off-by: Xie Yongji --- drivers/vdpa/ifcvf/ifcvf_main.c | 35 +++--- drivers/vdpa/mlx5/net

[PATCH v12 04/13] vdpa: Fix some coding style issues

2021-08-30 Thread Xie Yongji
Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: Xie Yongji Acked-by: Jas

[PATCH v12 03/13] file: Export receive_fd() to modules

2021-08-30 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions

[PATCH v12 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-30 Thread Xie Yongji
Export eventfd_wake_count so that some modules can use the eventfd_signal_count() to check whether the eventfd_signal() call should be deferred to a safe context. Signed-off-by: Xie Yongji --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index

[PATCH v12 01/13] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-30 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji Acked-by: Jason Wang Acked-by: Will Deacon --- drivers/iommu/iova.c | 2 ++ 1

[PATCH v12 00/13] Introduce VDUSE - vDPA Device in Userspace

2021-08-30 Thread Xie Yongji
ounce pages reclaim V1 to V2: - Add vhost-vdpa support - Add some documents - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_map Xie Yongji (13): iova: Export alloc_iova_fast() and free_iova_fast() eventfd: Ex

[PATCH v11 12/12] Documentation: Add documentation for VDUSE

2021-08-18 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api

[PATCH v11 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-18 Thread Xie Yongji
n and usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers/vdpa/vdpa_user/Mak

[PATCH v11 09/12] vdpa: Support transferring virtual addressing during DMA mapping

2021-08-18 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v11 10/12] vduse: Implement an MMU-based software IOTLB

2021-08-18 Thread Xie Yongji
l copy the data from the original buffer to the bounce buffer and back, depending on the direction of the transfer. And the bounce-buffer addresses will be mapped into the user address space instead of the original one. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdp

[PATCH v11 08/12] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-08-18 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v11 07/12] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-08-18 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v11 05/12] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-18 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index b1c91b4db0ba

[PATCH v11 06/12] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-08-18 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v11 04/12] vdpa: Add reset callback in vdpa_config_ops

2021-08-18 Thread Xie Yongji
This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting if device driver supports the new callback. Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 9 +++-- include/linux

[PATCH v11 03/12] vdpa: Fix some coding style issues

2021-08-18 Thread Xie Yongji
Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: Xie Yongji --- inclu

[PATCH v11 02/12] file: Export receive_fd() to modules

2021-08-18 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions

[PATCH v11 01/12] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-18 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a

[PATCH v11 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-08-18 Thread Xie Yongji
V1 to V2: - Add vhost-vdpa support - Add some documents - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_map Xie Yongji (12): iova: Export alloc_iova_fast() and free_iova_fast() file: Export receive_fd() to m

[PATCH v10 17/17] Documentation: Add documentation for VDUSE

2021-07-29 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api

[PATCH v10 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-29 Thread Xie Yongji
n and usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers/vdpa/vdpa_user/Mak

[PATCH v10 15/17] vduse: Implement an MMU-based software IOTLB

2021-07-29 Thread Xie Yongji
l copy the data from the original buffer to the bounce buffer and back, depending on the direction of the transfer. And the bounce-buffer addresses will be mapped into the user address space instead of the original one. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdp

[PATCH v10 14/17] vdpa: Support transferring virtual addressing during DMA mapping

2021-07-29 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v10 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-29 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v10 12/17] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-07-29 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v10 11/17] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-07-29 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-07-29 Thread Xie Yongji
The device reset may fail in virtio-vdpa case now, so add checks to its return value and fail the register_virtio_device(). Signed-off-by: Xie Yongji --- drivers/virtio/virtio.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio.c b

[PATCH v10 09/17] virtio-vdpa: Handle the failure of vdpa_reset()

2021-07-29 Thread Xie Yongji
The vpda_reset() may fail now. This adds check to its return value and fail the virtio_vdpa_reset(). Signed-off-by: Xie Yongji --- drivers/virtio/virtio_vdpa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c

[PATCH v10 08/17] virtio_config: Add a return value to reset function

2021-07-29 Thread Xie Yongji
This adds a return value to reset function so that we can handle the reset failure later. No functional changes. Signed-off-by: Xie Yongji --- arch/um/drivers/virtio_uml.c | 4 +++- drivers/platform/mellanox/mlxbf-tmfifo.c | 4 +++- drivers/remoteproc/remoteproc_virtio.c | 4

[PATCH v10 07/17] virtio: Don't set FAILED status bit on device index allocation failure

2021-07-29 Thread Xie Yongji
We don't need to set FAILED status bit on device index allocation failure since the device initialization hasn't been started yet. This doesn't affect runtime, found in code review. Signed-off-by: Xie Yongji --- drivers/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH v10 06/17] vhost-vdpa: Handle the failure of vdpa_reset()

2021-07-29 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index dd05c1e1133c

[PATCH v10 05/17] vhost-vdpa: Fail the vhost_vdpa_set_status() on reset failure

2021-07-29 Thread Xie Yongji
Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vhost_vdpa_set_status() after timeout. Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/dr

[PATCH v10 04/17] vdpa: Fail the vdpa_reset() if fail to set device status to zero

2021-07-29 Thread Xie Yongji
Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vdpa_reset() after timeout. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/vdpa.h b/include/

[PATCH v10 03/17] vdpa: Fix code indentation

2021-07-29 Thread Xie Yongji
Use tabs to indent the code instead of spaces. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 7c49bc5a2b71..406d53a606ac 100644 --- a/include

[PATCH v10 02/17] file: Export receive_fd() to modules

2021-07-29 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs

[PATCH v10 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-07-29 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can use it to improve iova allocation efficiency. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index b6cf5f16123b

[PATCH v10 00/17] Introduce VDUSE - vDPA Device in Userspace

2021-07-29 Thread Xie Yongji
vdpa support - Add some documents - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_map Xie Yongji (17): iova: Export alloc_iova_fast() and free_iova_fast() file: Export receive_fd() to modules vdpa: Fix code i

[PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Xie Yongji
usage, please see the follow-on Documentation commit. Signed-off-by: Xie Yongji --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers/vdpa/vdpa_user/Mak

[PATCH v9 17/17] Documentation: Add documentation for VDUSE

2021-07-13 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api

[PATCH v9 15/17] vduse: Implement an MMU-based IOMMU driver

2021-07-13 Thread Xie Yongji
se its virtual address to access the dma buffer in kernel. And to avoid security issue, a bounce-buffering mechanism is introduced to prevent userspace accessing the original buffer directly. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_user/iova_domain.c

[PATCH v9 14/17] vdpa: Support transferring virtual addressing during DMA mapping

2021-07-13 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-13 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v9 12/17] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-07-13 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v9 09/17] virtio-vdpa: Handle the failure of vdpa_reset()

2021-07-13 Thread Xie Yongji
The vpda_reset() may fail now. This adds check to its return value and fail the virtio_vdpa_reset(). Signed-off-by: Xie Yongji --- drivers/virtio/virtio_vdpa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c

[PATCH v9 11/17] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-07-13 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v9 10/17] virtio: Handle device reset failure in register_virtio_device()

2021-07-13 Thread Xie Yongji
The device reset may fail in virtio-vdpa case now, so add checks to its return value and fail the register_virtio_device(). Signed-off-by: Xie Yongji --- drivers/virtio/virtio.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio.c b

[PATCH v9 08/17] virtio_config: Add a return value to reset function

2021-07-13 Thread Xie Yongji
This adds a return value to reset function so that we can handle the reset failure later. No functional changes. Signed-off-by: Xie Yongji --- arch/um/drivers/virtio_uml.c | 4 +++- drivers/platform/mellanox/mlxbf-tmfifo.c | 4 +++- drivers/remoteproc/remoteproc_virtio.c | 4

[PATCH v9 06/17] vhost-vdpa: Handle the failure of vdpa_reset()

2021-07-13 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 62b6d911c57d

[PATCH v9 07/17] virtio: Don't set FAILED status bit on device index allocation failure

2021-07-13 Thread Xie Yongji
We don't need to set FAILED status bit on device index allocation failure since the device initialization hasn't been started yet. Signed-off-by: Xie Yongji --- drivers/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio.c b/driv

[PATCH v9 05/17] vhost-vdpa: Fail the vhost_vdpa_set_status() on reset failure

2021-07-13 Thread Xie Yongji
Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vhost_vdpa_set_status() after timeout. Signed-off-by: Xie Yongji --- drivers/vhost/vdpa.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vdpa.c b/dr

[PATCH v9 04/17] vdpa: Fail the vdpa_reset() if fail to set device status to zero

2021-07-13 Thread Xie Yongji
Re-read the device status to ensure it's set to zero during resetting. Otherwise, fail the vdpa_reset() after timeout. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/linux/vdpa.h b/include/

[PATCH v9 03/17] vdpa: Fix code indentation

2021-07-13 Thread Xie Yongji
Use tabs to indent the code instead of spaces. Signed-off-by: Xie Yongji --- include/linux/vdpa.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 7c49bc5a2b71..f822490db584 100644 --- a/include/linux/vdpa.h +++ b

[PATCH v9 02/17] file: Export receive_fd() to modules

2021-07-13 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs

[PATCH v9 01/17] iova: Export alloc_iova_fast() and free_iova_fast()

2021-07-13 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can use it to improve iova allocation efficiency. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index b6cf5f16123b

[PATCH v9 00/17] Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Xie Yongji
ocuments - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_mapu Xie Yongji (17): iova: Export alloc_iova_fast() and free_iova_fast() file: Export receive_fd() to modules vdpa: Fix code indentation vdpa: F

[PATCH v8 10/10] Documentation: Add documentation for VDUSE

2021-06-15 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api

[PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-06-15 Thread Xie Yongji
update the configuration space and inject a config interrupt. Signed-off-by: Xie Yongji --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers/vdpa/vdpa_use

[PATCH v8 08/10] vduse: Implement an MMU-based IOMMU driver

2021-06-15 Thread Xie Yongji
se its virtual address to access the dma buffer in kernel. And to avoid security issue, a bounce-buffering mechanism is introduced to prevent userspace accessing the original buffer directly. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_user/iova_domain.c

[PATCH v8 07/10] vdpa: Support transferring virtual addressing during DMA mapping

2021-06-15 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v8 06/10] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-06-15 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v8 05/10] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-06-15 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v8 04/10] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-06-15 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v8 03/10] eventfd: Increase the recursion depth of eventfd_signal()

2021-06-15 Thread Xie Yongji
signal [eventfd] --> vhost_poll_wakeup [vhost] --> vduse_vdpa_kick_vq [vduse] --> eventfd_signal[eventfd] Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/eventfd.c| 2 +- include/linu

[PATCH v8 02/10] file: Export receive_fd() to modules

2021-06-15 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs

[PATCH v8 01/10] iova: Export alloc_iova_fast() and free_iova_fast();

2021-06-15 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can use it to improve iova allocation efficiency. Signed-off-by: Xie Yongji --- drivers/iommu/iova.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index b7ecd5b08039

[PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace

2021-06-15 Thread Xie Yongji
tree with array map to store the iova_map Xie Yongji (10): iova: Export alloc_iova_fast() and free_iova_fast(); file: Export receive_fd() to modules eventfd: Increase the recursion depth of eventfd_signal() vhost-iotlb: Add an opaque pointer for vhost IOTLB vdpa: Add an opaque pointer for

[PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-17 Thread Xie Yongji
() to inject interrupt and use the eventfd mechanism to receive virtqueue kicks. Signed-off-by: Xie Yongji --- Documentation/userspace-api/ioctl/ioctl-number.rst |1 + drivers/vdpa/Kconfig | 10 + drivers/vdpa/Makefile |1 + drivers

[PATCH v7 09/12] vdpa: Support transferring virtual addressing during DMA mapping

2021-05-17 Thread Xie Yongji
and offset will be also passed as an opaque pointer. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- drivers/vdpa/vdpa.c | 9 +++- drivers/vdpa/vdpa_sim/vdpa_sim.c |

[PATCH v7 10/12] vduse: Implement an MMU-based IOMMU driver

2021-05-17 Thread Xie Yongji
se its virtual address to access the dma buffer in kernel. And to avoid security issue, a bounce-buffering mechanism is introduced to prevent userspace accessing the original buffer directly. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_user/iova_domain.c

[PATCH v7 12/12] Documentation: Add documentation for VDUSE

2021-05-17 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji --- Documentation/userspace-api/index.rst | 1 + Documentation/userspace-api

[PATCH v7 08/12] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-05-17 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c

[PATCH v7 06/12] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-05-17 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v7 07/12] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-05-17 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions

[PATCH v7 03/12] eventfd: Increase the recursion depth of eventfd_signal()

2021-05-17 Thread Xie Yongji
signal [eventfd] --> vhost_poll_wakeup [vhost] --> vduse_vdpa_kick_vq [vduse] --> eventfd_signal[eventfd] Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/eventfd.c| 2 +- include/linu

[PATCH v7 04/12] virtio-blk: Add validation for block size in config space

2021-05-17 Thread Xie Yongji
This ensures that we will not use an invalid block size in config space (might come from an untrusted device). Signed-off-by: Xie Yongji --- drivers/block/virtio_blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c

[PATCH v7 05/12] virtio_scsi: Add validation for residual bytes from response

2021-05-17 Thread Xie Yongji
This ensures that the residual bytes in response (might come from an untrusted device) will not exceed the data buffer length. Signed-off-by: Xie Yongji --- drivers/scsi/virtio_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi

[PATCH v7 02/12] file: Export receive_fd() to modules

2021-05-17 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fs

[PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-17 Thread Xie Yongji
VA support in vhost-vdpa - Remove the patches on bounce pages reclaim V1 to V2: - Add vhost-vdpa support - Add some documents - Based on the vdpa management tool - Introduce a workqueue for irq injection - Replace interval tree with array map to store the iova_map Xie Yongji (12): iova: Export

  1   2   >