[RFC 0/2] Identify aliased maps in vdpa SVQ iova_tree

2024-04-10 Thread Eugenio Pérez
. This has been tested only without overlapping maps. If it works with overlapping maps, it will be intergrated in the main series. Comments are welcome. Thanks! Eugenio Pérez (2): iova_tree: add an id member to DMAMap vdpa: identify aliased maps in iova_tree hw/virtio/vhost-vdpa.c | 2

[RFC 2/2] vdpa: identify aliased maps in iova_tree

2024-04-10 Thread Eugenio Pérez
as unique identifiers to the maps. When the map needs to be removed, iova tree is able to find the right one. Users that does not go to this extra layer of indirection can use the iova tree as usual, with id = 0. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 ++ 1 file changed, 2

[RFC 1/2] iova_tree: add an id member to DMAMap

2024-04-10 Thread Eugenio Pérez
lve this, create an id member so we can assign unique identifiers (GPA) to the maps. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 5 +++-- util/iova-tree.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tre

[PATCH 2/2] vdpa: trace skipped memory sections

2024-02-15 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez --- hw/virtio/trace-events | 1 + hw/virtio/vhost-vdpa.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994..fa2fb6b6d1 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -30,6 +30,7

[PATCH 0/2] Trace skipped memory sections at vdpa memory listener

2024-02-15 Thread Eugenio Pérez
Some memory regions are not being skipped in vhost_vdpa_listener_region_del, but they are skipped in vhost_vdpa_listener_region_add, or vice versa. The vhost-vdpa code expects all parts to maintain their properties, so we're adding a trace to help with debugging when any part is skipped. Eugenio

[PATCH 1/2] vdpa: stash memory region properties in vars

2024-02-15 Thread Eugenio Pérez
Next changes uses this variables, so avoid call repeatedly to memory region functions. No functional change intended. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio

[PATCH v2 6/7] vdpa: move iova_tree allocation to net_vhost_vdpa_init

2024-02-01 Thread Eugenio Pérez
the two creation points: the first data vq in case of SVQ active and CVQ start in case only CVQ uses it. Suggested-by: Si-Wei Liu Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 16 ++- net/vhost-vdpa.c | 36 +++--- 2 files

[PATCH v2 0/7] Move memory listener register to vhost_vdpa_init

2024-02-01 Thread Eugenio Pérez
/qemu-devel/2024-01/msg02136.html . [1] https://patchwork.kernel.org/project/qemu-devel/cover/20231215172830.2540987-1-epere...@redhat.com/ [2] https://lists.gnu.org/archive/html/qemu-devel/2024-01/msg05910.html Eugenio Pérez (7): vdpa: check for iova tree initialized at net_client_start vdpa

[PATCH v2 7/7] vdpa: move memory listener register to vhost_vdpa_init

2024-02-01 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez -- v2: Move the memory listener registration to vhost_vdpa_set_owner function. In case of hotplug the vdpa device, the memory is already set up, and leaving memory listener register call in the init function made maps occur before set owner call. To be 100% safe, let's put

[PATCH v2 5/7] vdpa: reorder listener assignment

2024-02-01 Thread Eugenio Pérez
nction. When the listener is registered it is added to an embedded linked list, so setting its members again will cause memory corruption to the linked list node. Do the right thing and only set it in the first vdpa device. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 fi

[PATCH v2 4/7] vdpa: add listener_registered

2024-02-01 Thread Eugenio Pérez
Check if the listener has been registered or not, so it needs to be registered again at start. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 7 ++- include/hw/virtio/vhost-vdpa.h | 6 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost

[PATCH v2 2/7] vdpa: reorder vhost_vdpa_set_backend_cap

2024-02-01 Thread Eugenio Pérez
It will be used directly by vhost_vdpa_init. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 60 +- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index ddae494ca8..33ae285f87

[PATCH v2 1/7] vdpa: check for iova tree initialized at net_client_start

2024-02-01 Thread Eugenio Pérez
by vhost_vdpa_net_data_start_first or vhost_vdpa_net_cvq_start if needed, so old behavior is kept. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 64825136a3..cc589dd148 100644 --- a/net

[PATCH v2 3/7] vdpa: set backend capabilities at vhost_vdpa_init

2024-02-01 Thread Eugenio Pérez
The backend does not reset them until the vdpa file descriptor is closed so there is no harm in doing it only once. This allows the destination of a live migration to premap memory in batches, using VHOST_BACKEND_F_IOTLB_BATCH. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 7

[PATCH 0/2] Move net backend cleanup to NIC cleanup

2024-01-29 Thread Eugenio Pérez
he cleanup from qemu_cleanup to the NIC deletion. Fixes: a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present") Acked-by: Jason Wang Reported-by: Lei Yang Signed-off-by: Eugenio Pérez Eugenio Pérez (2): net: parameterize the removing client from

[PATCH 2/2] net: move backend cleanup to NIC cleanup

2024-01-29 Thread Eugenio Pérez
eanup from qemu_cleanup to the NIC deletion. Fixes: a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present") Acked-by: Jason Wang Reported-by: Lei Yang Signed-off-by: Eugenio Pérez --- Carring the Acked-by Jason as it was given when I proposed this

[PATCH 1/2] net: parameterize the removing client from nc list

2024-01-29 Thread Eugenio Pérez
This change is used in later commits so we can avoid the removal of the netclient if it is delayed. No functional change intended. Signed-off-by: Eugenio Pérez --- net/net.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/net.c b/net/net.c index 0520bc1681

[PATCH 4/6] vdpa: add listener_registered

2024-01-11 Thread Eugenio Pérez
Check if the listener has been registered or not, so it needs to be registered again at start. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 6 ++ hw/virtio/vhost-vdpa.c | 7 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio

[PATCH 5/6] vdpa: reorder listener assignment

2024-01-11 Thread Eugenio Pérez
nction. When the listener is registered it is added to an embedded linked list, so setting its members again will cause memory corruption to the linked list node. Do the right thing and only set it in the first vdpa device. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 fi

[PATCH 6/6] vdpa: move memory listener register to vhost_vdpa_init

2024-01-11 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 521a889104..eae8b790dd 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -660,7 +660,13 @@ static int

[PATCH 3/6] vdpa: set backend capabilities at vhost_vdpa_init

2024-01-11 Thread Eugenio Pérez
The backend does not reset them until the vdpa file descriptor is closed so there is no harm in doing it only once. This allows the destination of a live migration to premap memory in batches, using VHOST_BACKEND_F_IOTLB_BATCH. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 7

[PATCH 1/6] vdpa: check for iova tree initialized at net_client_start

2024-01-11 Thread Eugenio Pérez
by vhost_vdpa_net_data_start_first or vhost_vdpa_net_cvq_start if needed, so old behavior is kept. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3726ee5d67..e11b390466 100644 --- a/net

[PATCH 2/6] vdpa: reorder vhost_vdpa_set_backend_cap

2024-01-11 Thread Eugenio Pérez
It will be used directly by vhost_vdpa_init. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 60 +- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index ddae494ca8..33ae285f87

[PATCH 0/6] Move memory listener register to vhost_vdpa_init

2024-01-11 Thread Eugenio Pérez
anymore, please refer to the previous one to know the series history. [1] https://patchwork.kernel.org/project/qemu-devel/cover/20231215172830.2540987-1-epere...@redhat.com/ Eugenio Pérez (6): vdpa: check for iova tree initialized at net_client_start vdpa: reorder vhost_vdpa_set_backend_cap vdpa

[PATCH v4 08/13] vdpa: move backend_cap to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the backend_cap member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v4 04/13] vdpa: move shadow_data to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the shadow_data member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v4 06/13] vdpa: move file descriptor to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the file descriptor to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v4 00/13] Consolidate common vdpa members in VhostVDPAShared

2023-12-21 Thread Eugenio Pérez
4-1-epere...@redhat.com/ [2] https://patchwork.kernel.org/project/qemu-devel/patch/1701970793-6865-10-git-send-email-si-wei@oracle.com/ Eugenio Pérez (13): vdpa: add VhostVDPAShared vdpa: move iova tree to the shared struct vdpa: move iova_range to vhost_vdpa_shared vdpa: move sh

[PATCH v4 11/13] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap

2023-12-21 Thread Eugenio Pérez
The callers only have the shared information by the end of this series. Start converting this functions. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 4 +-- hw/virtio/vhost-vdpa.c | 50 +- net/vhost-vdpa.c

[PATCH v4 05/13] vdpa: use vdpa shared for tracing

2023-12-21 Thread Eugenio Pérez
By the end of this series dma_map and dma_unmap functions don't have the vdpa device for tracing. Movinge trace function to shared member one. Print it also in the vdpa initialization so log reader can relate them. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- hw/virtio/vhost-vdpa.c

[PATCH v4 13/13] vdpa: move memory listener to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the memory listener to a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- v4: * Actually

[PATCH v4 12/13] vdpa: use dev_shared in vdpa_iommu

2023-12-21 Thread Eugenio Pérez
The memory listener functions can call these too. Make vdpa_iommu work with VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 2 +- hw/virtio/vhost-vdpa.c | 16 2 files changed, 9 insertions(+), 9 deletions

[PATCH v4 02/13] vdpa: move iova tree to the shared struct

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova tree to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason

[PATCH v4 10/13] vdpa: move iommu_list to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iommu_list member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v4 09/13] vdpa: remove msg type of vhost_vdpa

2023-12-21 Thread Eugenio Pérez
It is always VHOST_IOTLB_MSG_V2. We can always make it back per vhost_dev if needed. This change makes easier for vhost_vdpa_map and unmap not to depend on vhost_vdpa but only in VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 1 - hw

[PATCH v4 03/13] vdpa: move iova_range to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova range to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v4 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iotlb_batch_begin_sent member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio

[PATCH v4 01/13] vdpa: add VhostVDPAShared

2023-12-21 Thread Eugenio Pérez
. If the source guest has CVQ enabled, it will be the one associated with the CVQ. Otherwise, it will be the first one. Save the memory operations related members in a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio

[PATCH v3 10/14] vdpa: move iommu_list to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iommu_list member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v3 09/14] vdpa: remove msg type of vhost_vdpa

2023-12-21 Thread Eugenio Pérez
It is always VHOST_IOTLB_MSG_V2. We can always make it back per vhost_dev if needed. This change makes easier for vhost_vdpa_map and unmap not to depend on vhost_vdpa but only in VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 1 - hw

[PATCH v3 13/14] vdpa: factor out vhost_vdpa_last_dev

2023-12-21 Thread Eugenio Pérez
From: Si-Wei Liu Generalize duplicated condition check for the last vq of vdpa device to a common function. This is used in next patches. Signed-off-by: Si-Wei Liu Reviewed-by: Eugenio Pérez --- v3: Cherry-picked from Si-Wei's series --- hw/virtio/vhost-vdpa.c | 9 +++-- 1 file changed

[PATCH v3 08/14] vdpa: move backend_cap to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the backend_cap member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v3 14/14] vdpa: move memory listener to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the memory listener to a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- v3: * Only

[PATCH v3 02/14] vdpa: move iova tree to the shared struct

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova tree to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason

[PATCH v3 00/14] Consolidate common vdpa members in VhostVDPAShared

2023-12-21 Thread Eugenio Pérez
org/project/qemu-devel/cover/20231124171430.2964464-1-epere...@redhat.com/ [2] https://patchwork.kernel.org/project/qemu-devel/patch/1701970793-6865-10-git-send-email-si-wei@oracle.com/ Eugenio Pérez (13): vdpa: add VhostVDPAShared vdpa: move iova tree to the shared struct vdpa: m

[PATCH v3 06/14] vdpa: move file descriptor to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the file descriptor to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v3 04/14] vdpa: move shadow_data to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the shadow_data member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v3 11/14] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap

2023-12-21 Thread Eugenio Pérez
The callers only have the shared information by the end of this series. Start converting this functions. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 4 +-- hw/virtio/vhost-vdpa.c | 50 +- net/vhost-vdpa.c

[PATCH v3 12/14] vdpa: use dev_shared in vdpa_iommu

2023-12-21 Thread Eugenio Pérez
The memory listener functions can call these too. Make vdpa_iommu work with VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 2 +- hw/virtio/vhost-vdpa.c | 16 2 files changed, 9 insertions(+), 9 deletions

[PATCH v3 03/14] vdpa: move iova_range to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova range to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH v3 01/14] vdpa: add VhostVDPAShared

2023-12-21 Thread Eugenio Pérez
. If the source guest has CVQ enabled, it will be the one associated with the CVQ. Otherwise, it will be the first one. Save the memory operations related members in a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio

[PATCH v3 07/14] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared

2023-12-21 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iotlb_batch_begin_sent member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio

[PATCH v3 05/14] vdpa: use vdpa shared for tracing

2023-12-21 Thread Eugenio Pérez
By the end of this series dma_map and dma_unmap functions don't have the vdpa device for tracing. Movinge trace function to shared member one. Print it also in the vdpa initialization so log reader can relate them. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- hw/virtio/vhost-vdpa.c

[PATCH for 9.0 02/12] vdpa: make batch_begin_once early return

2023-12-15 Thread Eugenio Pérez
Prefer early return so it is easier to merge vhost_vdpa_listener_begin_batch here and make iotlb baches begin and end symmetrical. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[PATCH for 9.0 10/12] vdpa: add vhost_vdpa_net_load_setup NetClient callback

2023-12-15 Thread Eugenio Pérez
So the vDPA backend knows when a migration incoming starts. NicState argument is needed so we can get the dma address space. Signed-off-by: Eugenio Pérez --- RFC v2: * Solve git conflict with .set_steering_ebpf * Fix x-svq=on use case which did not allocated iova_tree. --- include/net/net.h

[PATCH for 9.0 00/12] Map memory at destination .load_setup in vDPA-net migration

2023-12-15 Thread Eugenio Pérez
from this series too. [1] https://lists.nongnu.org/archive/html/qemu-devel/2023-12/msg01986.html [2] https://lists.nongnu.org/archive/html/qemu-devel/2023-12/msg00909.html [3] https://lore.kernel.org/qemu-devel/6c8ebb97-d546-3f1c-4cdd-54e23a566...@nvidia.com/T/ Eugenio Pérez (12): vdpa: do

[PATCH for 9.0 03/12] vdpa: merge _begin_batch into _batch_begin_once

2023-12-15 Thread Eugenio Pérez
There was only one call. This way we can make the begin and end of the batch symmetrical. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index

[PATCH for 9.0 08/12] vdpa: add vhost_vdpa_load_setup

2023-12-15 Thread Eugenio Pérez
be mapped. This can be fixed when we migrate the device state iteratively, and we know for sure if the device is started or not. At this moment we don't have such information so there is no better alternative. Signed-off-by: Eugenio Pérez --- v1: * Moved all the map thread members to another

[PATCH for 9.0 12/12] virtio_net: register incremental migration handlers

2023-12-15 Thread Eugenio Pérez
This way VirtIONet can detect when the incoming migration starts. While registering in the backend (nc->peer) seems more logical, we need nic dma address space, and we cannot get it from the backend. Signed-off-by: Eugenio Pérez --- This could be done in vhost_vdpa or VirtIODevice str

[PATCH for 9.0 07/12] vdpa: set backend capabilities at vhost_vdpa_init

2023-12-15 Thread Eugenio Pérez
The backend does not reset them until the vdpa file descriptor is closed so there is no harm in doing it only once. This allows the destination of a live migration to premap memory in batches, using VHOST_BACKEND_F_IOTLB_BATCH. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 50

[PATCH for 9.0 11/12] vdpa: add vhost_vdpa_net_switchover_ack_needed

2023-12-15 Thread Eugenio Pérez
Use migration switchover ack capability to make sure QEMU has mapped all the guest memory to the device before the source stops the VM and attempts to complete the migration. All net vdpa devices support this early map of guest memory, so return always true. Signed-off-by: Eugenio Pérez

[PATCH for 9.0 06/12] vdpa: check for iova tree initialized at net_client_start

2023-12-15 Thread Eugenio Pérez
by vhost_vdpa_net_data_start_first or vhost_vdpa_net_cvq_start if needed, so old behavior is kept. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3726ee5d67..e11b390466 100644 --- a/net

[PATCH for 9.0 05/12] vdpa: factor out stop path of vhost_vdpa_dev_start

2023-12-15 Thread Eugenio Pérez
This makes easier to build an error path in next patches. No functional change. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 57a8043cd4..449c3794b2

[PATCH for 9.0 01/12] vdpa: do not set virtio status bits if unneeded

2023-12-15 Thread Eugenio Pérez
Next commits will set DRIVER and ACKNOWLEDGE flags repeatedly in the case of a migration destination. Let's save ioctls with this. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c

[PATCH for 9.0 04/12] vdpa: extract out _dma_end_batch from _listener_commit

2023-12-15 Thread Eugenio Pérez
So we can call out vhost_vdpa_dma_end_batch out of the listener callbacks. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index a533fc5bc7..57a8043cd4 100644

[PATCH for 9.0 09/12] vdpa: approve switchover after memory map in the migration destination

2023-12-15 Thread Eugenio Pérez
-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 4 hw/virtio/vhost-vdpa.c | 18 ++ 2 files changed, 22 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index b49286b327..1c7e3fbd24 100644 --- a/include/hw/virtio

[PATCH 9.0 v2 06/13] vdpa: move file descriptor to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the file descriptor to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH 9.0 v2 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iotlb_batch_begin_sent member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio

[PATCH 9.0 v2 12/13] vdpa: use dev_shared in vdpa_iommu

2023-12-15 Thread Eugenio Pérez
The memory listener functions can call these too. Make vdpa_iommu work with VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 2 +- hw/virtio/vhost-vdpa.c | 16 2 files changed, 9 insertions(+), 9 deletions

[PATCH 9.0 v2 02/13] vdpa: move iova tree to the shared struct

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova tree to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason

[PATCH 9.0 v2 03/13] vdpa: move iova_range to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova range to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH 9.0 v2 05/13] vdpa: use vdpa shared for tracing

2023-12-15 Thread Eugenio Pérez
By the end of this series dma_map and dma_unmap functions don't have the vdpa device for tracing. Movinge trace function to shared member one. Print it also in the vdpa initialization so log reader can relate them. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- hw/virtio/vhost-vdpa.c

[PATCH 9.0 v2 11/13] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap

2023-12-15 Thread Eugenio Pérez
The callers only have the shared information by the end of this series. Start converting this functions. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 4 +-- hw/virtio/vhost-vdpa.c | 50 +- net/vhost-vdpa.c

[PATCH 9.0 v2 09/13] vdpa: remove msg type of vhost_vdpa

2023-12-15 Thread Eugenio Pérez
It is always VHOST_IOTLB_MSG_V2. We can always make it back per vhost_dev if needed. This change makes easier for vhost_vdpa_map and unmap not to depend on vhost_vdpa but only in VhostVDPAShared. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio/vhost-vdpa.h | 1 - hw

[PATCH 9.0 v2 10/13] vdpa: move iommu_list to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iommu_list member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH 9.0 v2 13/13] vdpa: move memory listener to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the memory listener to a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw

[PATCH 9.0 v2 08/13] vdpa: move backend_cap to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the backend_cap member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH 9.0 v2 04/13] vdpa: move shadow_data to vhost_vdpa_shared

2023-12-15 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the shadow_data member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked

[PATCH 9.0 v2 00/13] Consolidate common vdpa members in VhostVDPAShared

2023-12-15 Thread Eugenio Pérez
ata. This could cause CVQ not being shadowed if vhost_vdpa_net_cvq_start was called in the middle of a migration. [1] https://patchwork.kernel.org/project/qemu-devel/patch/1701970793-6865-10-git-send-email-si-wei@oracle.com/ Eugenio Pérez (13): vdpa: add VhostVDPAShared vdpa: move iova t

[PATCH 9.0 v2 01/13] vdpa: add VhostVDPAShared

2023-12-15 Thread Eugenio Pérez
. If the source guest has CVQ enabled, it will be the one associated with the CVQ. Otherwise, it will be the first one. Save the memory operations related members in a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang --- include/hw/virtio

[RFC PATCH v2 10/10] virtio_net: register incremental migration handlers

2023-11-28 Thread Eugenio Pérez
This way VirtIONet can detect when the incoming migration starts. While registering in the backend (nc->peer) seems more logical, we need nic dma address space, and we cannot get it from the backend. Signed-off-by: Eugenio Pérez --- This could be done in vhost_vdpa or VirtIODevice str

[RFC PATCH v2 01/10] vdpa: do not set virtio status bits if unneeded

2023-11-28 Thread Eugenio Pérez
Next commits will set DRIVER and ACKNOWLEDGE flags repeatedly in the case of a migration destination. Let's save ioctls with this. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c

[RFC PATCH v2 04/10] vdpa: extract out _dma_end_batch from _listener_commit

2023-11-28 Thread Eugenio Pérez
So we can call out vhost_vdpa_dma_end_batch out of the listener callbacks. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index a533fc5bc7..57a8043cd4 100644

[RFC PATCH v2 08/10] vdpa: add vhost_vdpa_load_setup

2023-11-28 Thread Eugenio Pérez
iothread for the moment? * QemuEvent or Mutex + Cond: Need to synchronize list access then, complicating the synchronization. As maps ops are heavier enough, it is not worth. Signed-off-by: Eugenio Pérez --- RFC v2: * Use a dedicated thread for map instead of doing all in .load_setup

[RFC PATCH v2 02/10] vdpa: make batch_begin_once early return

2023-11-28 Thread Eugenio Pérez
Prefer early return so it is easier to merge vhost_vdpa_listener_begin_batch here and make iotlb baches begin and end symmetrical. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[RFC PATCH v2 00/10] Map memory at destination .load_setup in vDPA-net migration

2023-11-28 Thread Eugenio Pérez
Eugenio Pérez (10): vdpa: do not set virtio status bits if unneeded vdpa: make batch_begin_once early return vdpa: merge _begin_batch into _batch_begin_once vdpa: extract out _dma_end_batch from _listener_commit vdpa: factor out stop path of vhost_vdpa_dev_start vdpa: check for iova tree

[RFC PATCH v2 06/10] vdpa: check for iova tree initialized at net_client_start

2023-11-28 Thread Eugenio Pérez
by vhost_vdpa_net_data_start_first or vhost_vdpa_net_cvq_start if needed, so old behavior is kept. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3fb209cd35..a37de7860e 100644 --- a/net

[RFC PATCH v2 07/10] vdpa: set backend capabilities at vhost_vdpa_init

2023-11-28 Thread Eugenio Pérez
The backend does not reset them until the vdpa file descriptor is closed so there is no harm in doing it only once. This allows the destination of a live migration to premap memory in batches, using VHOST_BACKEND_F_IOTLB_BATCH. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 50

[RFC PATCH v2 09/10] vdpa: add vhost_vdpa_net_load_setup NetClient callback

2023-11-28 Thread Eugenio Pérez
So the vDPA backend knows when a migration incoming starts. NicState argument is needed so we can get the dma address space. Signed-off-by: Eugenio Pérez --- RFC v2: * Solve git conflict with .set_steering_ebpf * Fix x-svq=on use case which did not allocated iova_tree. --- include/net/net.h

[RFC PATCH v2 05/10] vdpa: factor out stop path of vhost_vdpa_dev_start

2023-11-28 Thread Eugenio Pérez
This makes easier to build an error path in next patches. No functional change. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 57a8043cd4..449c3794b2

[RFC PATCH v2 03/10] vdpa: merge _begin_batch into _batch_begin_once

2023-11-28 Thread Eugenio Pérez
There was only one call. This way we can make the begin and end of the batch symmetrical. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index

[PATCH 9.0 07/13] vdpa: move iotlb_batch_begin_sent to vhost_vdpa_shared

2023-11-24 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iotlb_batch_begin_sent member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio

[PATCH 9.0 08/13] vdpa: move backend_cap to vhost_vdpa_shared

2023-11-24 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the backend_cap member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez

[PATCH 9.0 10/13] vdpa: move iommu_list to vhost_vdpa_shared

2023-11-24 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iommu_list member to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez

[PATCH 9.0 06/13] vdpa: move file descriptor to vhost_vdpa_shared

2023-11-24 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the file descriptor to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez

[PATCH 9.0 05/13] vdpa: use vdpa shared for tracing

2023-11-24 Thread Eugenio Pérez
By the end of this series dma_map and dma_unmap functions don't have the vdpa device for tracing. Movinge trace function to shared member one. Print it also in the vdpa initialization so log reader can relate them. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 26

[PATCH 9.0 02/13] vdpa: move iova tree to the shared struct

2023-11-24 Thread Eugenio Pérez
will register its memory_listener. If the source guest has CVQ enabled, it will be the CVQ device. Otherwise, it will be the first one. Move the iova tree to VhostVDPAShared so all vhost_vdpa can use it, rather than always in the first or last vhost_vdpa. Signed-off-by: Eugenio Pérez --- include/hw

[PATCH 9.0 01/13] vdpa: add VhostVDPAShared

2023-11-24 Thread Eugenio Pérez
. If the source guest has CVQ enabled, it will be the one associated with the CVQ. Otherwise, it will be the first one. Save the memory operations related members in a common place rather than always in the first / last vhost_vdpa. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 5

[PATCH 9.0 12/13] vdpa: use dev_shared in vdpa_iommu

2023-11-24 Thread Eugenio Pérez
The memory listener functions can call these too. Make vdpa_iommu work with VhostVDPAShared. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 2 +- hw/virtio/vhost-vdpa.c | 16 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/hw

[PATCH 9.0 11/13] vdpa: use VhostVDPAShared in vdpa_dma_map and unmap

2023-11-24 Thread Eugenio Pérez
The callers only have the shared information by the end of this series. Start converting this functions. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 4 +-- hw/virtio/vhost-vdpa.c | 50 +- net/vhost-vdpa.c | 5 ++-- 3

  1   2   3   4   5   6   7   8   9   10   >