[PATCH vhost 15/16] vdpa/mlx5: Make iotlb helper functions more generic

2023-09-28 Thread Dragos Tatulea via Virtualization
They will be used in a followup patch. Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mr.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c index 3dee6d9bed6b..a4135c16b5bf 100644 ---

[PATCH vhost 16/16] vdpa/mlx5: Update cvq iotlb mapping on ASID change

2023-09-28 Thread Dragos Tatulea via Virtualization
For the following sequence: - cvq group is in ASID 0 - .set_map(1, cvq_iotlb) - .set_group_asid(cvq_group, 1) ... the cvq mapping from ASID 0 will be used. This is not always correct behaviour. This patch adds support for the above mentioned flow by saving the iotlb on each .set_map and updating

[PATCH vhost 14/16] vdpa/mlx5: Enable hw support for vq descriptor mapping

2023-09-28 Thread Dragos Tatulea via Virtualization
Vq descriptor mappings are supported in hardware by filling in an additional mkey which contains the descriptor mappings to the hw vq. A previous patch in this series added support for hw mkey (mr) creation for ASID 1. This patch fills in both the vq data and vq descriptor mkeys based on group

[PATCH vhost 13/16] vdpa/mlx5: Introduce mr for vq descriptor

2023-09-28 Thread Dragos Tatulea via Virtualization
Introduce the vq descriptor group and ASID 1. Until now .set_map on ASID 1 was only updating the cvq iotlb. From now on it also creates a mkey for it. The current patch doesn't use it but follow-up patches will add hardware support for mapping the vq descriptors. Signed-off-by: Dragos Tatulea

[PATCH vhost 11/16] vdpa/mlx5: Move mr mutex out of mr struct

2023-09-28 Thread Dragos Tatulea via Virtualization
The mutex is named like it is supposed to protect only the mkey but in reality it is a global lock for all mr resources. Shift the mutex to it's rightful location (struct mlx5_vdpa_dev) and give it a more appropriate name. Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mlx5_vdpa.h |

[PATCH vhost 08/16] vdpa/mlx5: Collapse "dvq" mr add/delete functions

2023-09-28 Thread Dragos Tatulea via Virtualization
Now that the cvq code is out of mlx5_vdpa_create/destroy_mr, the "dvq" functions can be folded into their callers. Having "dvq" in the naming will no longer be accurate in the downstream patches. Acked-by: Jason Wang Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mr.c | 16

[PATCH vhost 12/16] vdpa/mlx5: Improve mr update flow

2023-09-28 Thread Dragos Tatulea via Virtualization
The current flow for updating an mr works directly on mvdev->mr which makes it cumbersome to handle multiple new mr structs. This patch makes the flow more straightforward by having mlx5_vdpa_create_mr return a new mr which will update the old mr (if any). The old mr will be deleted and unlinked

[PATCH vhost 07/16] vdpa/mlx5: Take cvq iotlb lock during refresh

2023-09-28 Thread Dragos Tatulea via Virtualization
The reslock is taken while refresh is called but iommu_lock is more specific to this resource. So take the iommu_lock during cvq iotlb refresh. Based on Eugenio's patch [0]. [0] https://lore.kernel.org/lkml/20230112142218.725622-4-epere...@redhat.com/ Acked-by: Jason Wang Suggested-by: Eugenio

[PATCH vhost 10/16] vdpa/mlx5: Allow creation/deletion of any given mr struct

2023-09-28 Thread Dragos Tatulea via Virtualization
This patch adapts the mr creation/deletion code to be able to work with any given mr struct pointer. All the APIs are adapted to take an extra parameter for the mr. mlx5_vdpa_create/delete_mr doesn't need a ASID parameter anymore. The check is done in the caller instead (mlx5_set_map). This

[PATCH vhost 09/16] vdpa/mlx5: Rename mr destroy functions

2023-09-28 Thread Dragos Tatulea via Virtualization
Make mlx5_destroy_mr symmetric to mlx5_create_mr. Acked-by: Jason Wang Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 4 ++-- drivers/vdpa/mlx5/core/mr.c| 6 +++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++-- 3 files changed, 11 insertions(+), 11

[PATCH vhost 06/16] vdpa/mlx5: Decouple cvq iotlb handling from hw mapping code

2023-09-28 Thread Dragos Tatulea via Virtualization
The handling of the cvq iotlb is currently coupled with the creation and destruction of the hardware mkeys (mr). This patch moves cvq iotlb handling into its own function and shifts it to a scope that is not related to mr handling. As cvq handling is just a prune_iotlb + dup_iotlb cycle, put it

[PATCH vhost 04/16] vhost-vdpa: uAPI to get dedicated descriptor group id

2023-09-28 Thread Dragos Tatulea via Virtualization
From: Si-Wei Liu With _F_DESC_ASID backend feature, the device can now support the VHOST_VDPA_GET_VRING_DESC_GROUP ioctl, and it may expose the descriptor table (including avail and used ring) in a different group than the buffers it contains. This new uAPI will fetch the group ID of the

[PATCH vhost 05/16] vdpa/mlx5: Create helper function for dma mappings

2023-09-28 Thread Dragos Tatulea via Virtualization
Necessary for upcoming cvq separation from mr allocation. Acked-by: Jason Wang Signed-off-by: Dragos Tatulea --- drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + drivers/vdpa/mlx5/core/mr.c| 5 + drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-)

[PATCH vhost 03/16] vhost-vdpa: introduce descriptor group backend feature

2023-09-28 Thread Dragos Tatulea via Virtualization
From: Si-Wei Liu Userspace knows if the device has dedicated descriptor group or not by checking this feature bit. It's only exposed if the vdpa driver backend implements the .get_vq_desc_group() operation callback. Userspace trying to negotiate this feature when it or the dependent

[PATCH vhost 02/16] vdpa: introduce dedicated descriptor group for virtqueue

2023-09-28 Thread Dragos Tatulea via Virtualization
From: Si-Wei Liu In some cases, the access to the virtqueue's descriptor area, device and driver areas (precluding indirect descriptor table in guest memory) may have to be confined to a different address space than where its buffers reside. Without loss of simplicity and generality with already

[PATCH mlx5-next 01/16] vdpa/mlx5: Expose descriptor group mkey hw capability

2023-09-28 Thread Dragos Tatulea via Virtualization
Necessary for improved live migration flow. Actual support will be added in a downstream patch. Reviewed-by: Gal Pressman Signed-off-by: Dragos Tatulea --- include/linux/mlx5/mlx5_ifc.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h

[PATCH vhost v2 00/16] vdpa: Add support for vq descriptor mappings

2023-09-28 Thread Dragos Tatulea via Virtualization
This patch series adds support for vq descriptor table mappings which are used to improve vdpa live migration downtime. The improvement comes from using smaller mappings which take less time to create and destroy in hw. The first part adds the vdpa core changes from Si-Wei [0]. The second part

[PATCH vhost v2 00/16] vdpa: Add support for vq descriptor mappings

2023-09-28 Thread Dragos Tatulea via Virtualization
This patch series adds support for vq descriptor table mappings which are used to improve vdpa live migration downtime. The improvement comes from using smaller mappings which take less time to create and destroy in hw. The first part adds the vdpa core changes from Si-Wei [0]. The second part

[PATCH] vhost-scsi: Spelling s/preceeding/preceding/g

2023-09-28 Thread Geert Uytterhoeven
Fix a misspelling of "preceding". Signed-off-by: Geert Uytterhoeven --- drivers/vhost/scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index abef0619c7901af0..2d689181bafef241 100644 --- a/drivers/vhost/scsi.c +++