[PATCH v4 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-03-03 Thread Eugenio Pérez
allocated. Future changes might skip that, but this series is already long enough. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 39 ++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/include

[PATCH v4 09/14] vhost: Add VhostIOVATree

2022-03-03 Thread Eugenio Pérez
can search efficiently in both directions, and it will signal overlap if iova or the translated address is present in any tree. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 27 +++ hw/virtio/vhost-iova-tree.c | 155 hw/virtio/m

[PATCH v4 12/14] vdpa: Never set log_base addr if SVQ is enabled

2022-03-03 Thread Eugenio Pérez
Setting the log address would make the device start reporting invalid dirty memory because the SVQ vrings are located in qemu's memory. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[PATCH v4 14/14] vdpa: Add x-svq to NetdevVhostVDPAOptions

2022-03-03 Thread Eugenio Pérez
Finally offering the possibility to enable SVQ from the command line. Signed-off-by: Eugenio Pérez --- qapi/net.json| 8 +++- net/vhost-vdpa.c | 48 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/qapi/net.json b/qapi

[PATCH v4 08/14] util: Add iova_tree_alloc_map

2022-03-03 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez Reviewed-by: Peter Xu --- include/qemu/iova-tree.h | 18 ++ util/iova-tree.c | 135 +++ 2 files changed, 153 insertions(+) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 8249edd764..d066400f09

[PATCH v4 11/14] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-03-03 Thread Eugenio Pérez
have problems with these retransmissions. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 + 1 file changed, 17 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8630d624f6..69a4bfd0d4 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio

[PATCH v4 10/14] vdpa: Add custom IOTLB translations to SVQ

2022-03-03 Thread Eugenio Pérez
Use translations added in VhostIOVATree in SVQ. Only introduce usage here, not allocation and deallocation. As with previous patches, we use the dead code paths of shadow_vqs_enabled to avoid commiting too many changes at once. These are impossible to take at the moment. Signed-off-by: Eugenio

[PATCH v4 07/14] vhost: Shadow virtqueue buffers forwarding

2022-03-03 Thread Eugenio Pérez
devices, it may cause unexpected SVQ queue full. This patch also solves it by checking for this condition at both guest's kicks and device's calls. The code may be more elegant in the future if SVQ code runs in its own iocontext. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v4 06/14] vdpa: adapt vhost_ops callbacks to svq

2022-03-03 Thread Eugenio Pérez
First half of the buffers forwarding part, preparing vhost-vdpa callbacks to SVQ to offer it. QEMU cannot enable it at this moment, so this is effectively dead code at the moment, but it helps to reduce patch size. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 48

[PATCH v4 04/14] vhost: Add vhost_svq_valid_features to shadow vq

2022-03-03 Thread Eugenio Pérez
or event idx. Future changes can add support to offer more features to the guest, since the use of VirtQueue gives this for free. This is left out at the moment for simplicity. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 44

[PATCH v4 03/14] vhost: Add Shadow VirtQueue call forwarding capabilities

2022-03-03 Thread Eugenio Pérez
This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 hw/virtio/vhost-shadow-virtqueue.c | 38 ++ hw/virtio/vhost-vdpa.c

[PATCH v4 05/14] virtio: Add vhost_svq_get_vring_addr

2022-03-03 Thread Eugenio Pérez
gned-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 9 + hw/virtio/vhost-shadow-virtqueue.c | 29 + 2 files changed, 38 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index 9e12f77201..82cea1

[PATCH v4 01/14] vhost: Add VhostShadowVirtqueue

2022-03-03 Thread Eugenio Pérez
only exposes basic SVQ allocation and free. Next patches of the series add functionality like notifications and buffers forwarding. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 28 ++ hw/virtio/vhost-shadow-virtqueue.c | 62 ++ hw

[PATCH v4 02/14] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-03-03 Thread Eugenio Pérez
At this mode no buffer forwarding will be performed in SVQ mode: Qemu will just forward the guest's kicks to the device. Host memory notifiers regions are left out for simplicity, and they will not be addressed in this series. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v4 00/14] vDPA shadow virtqueue

2022-03-03 Thread Eugenio Pérez
, all of the changes are contained in vhost code. * Delete superfluous code. * An intermediate RFC was sent with only the notifications forwarding changes. It can be seen in https://patchew.org/QEMU/20210129205415.876290-1-epere...@redhat.com/ v1 link: https://lists.gnu.org/archive/html/qemu-d

[PATCH v3 14/14] vdpa: Add x-svq to NetdevVhostVDPAOptions

2022-03-02 Thread Eugenio Pérez
Finally offering the possibility to enable SVQ from the command line. Signed-off-by: Eugenio Pérez --- qapi/net.json| 5 - net/vhost-vdpa.c | 48 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/qapi/net.json b/qapi

[PATCH v3 12/14] vdpa: Never set log_base addr if SVQ is enabled

2022-03-02 Thread Eugenio Pérez
Setting the log address would make the device start reporting invalid dirty memory because the SVQ vrings are located in qemu's memory. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[PATCH v3 11/14] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-03-02 Thread Eugenio Pérez
have problems with these retransmissions. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 + 1 file changed, 17 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index a386a83eb1..151622fb34 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio

[PATCH v3 10/14] vdpa: Add custom IOTLB translations to SVQ

2022-03-02 Thread Eugenio Pérez
Use translations added in VhostIOVATree in SVQ. Only introduce usage here, not allocation and deallocation. As with previous patches, we use the dead code paths of shadow_vqs_enabled to avoid commiting too many changes at once. These are impossible to take at the moment. Signed-off-by: Eugenio

[PATCH v3 07/14] vhost: Shadow virtqueue buffers forwarding

2022-03-02 Thread Eugenio Pérez
devices, it may cause unexpected SVQ queue full. This patch also solves it by checking for this condition at both guest's kicks and device's calls. The code may be more elegant in the future if SVQ code runs in its own iocontext. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v3 06/14] vdpa: adapt vhost_ops callbacks to svq

2022-03-02 Thread Eugenio Pérez
First half of the buffers forwarding part, preparing vhost-vdpa callbacks to SVQ to offer it. QEMU cannot enable it at this moment, so this is effectively dead code at the moment, but it helps to reduce patch size. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 48

[PATCH v3 09/14] vhost: Add VhostIOVATree

2022-03-02 Thread Eugenio Pérez
can search efficiently in both directions, and it will signal overlap if iova or the translated address is present in any tree. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 27 +++ hw/virtio/vhost-iova-tree.c | 155 hw/virtio/m

[PATCH v3 05/14] virtio: Add vhost_svq_get_vring_addr

2022-03-02 Thread Eugenio Pérez
gned-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 9 + hw/virtio/vhost-shadow-virtqueue.c | 29 + 2 files changed, 38 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index 9e12f77201..82cea1

[PATCH v3 08/14] util: Add iova_tree_alloc_map

2022-03-02 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez Reviewed-by: Peter Xu --- include/qemu/iova-tree.h | 18 ++ util/iova-tree.c | 135 +++ 2 files changed, 153 insertions(+) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 8249edd764..d066400f09

[PATCH v3 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-03-02 Thread Eugenio Pérez
allocated. Future changes might skip that, but this series is already long enough. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 39 ++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/include

[PATCH v3 00/14] vDPA shadow virtqueue

2022-03-02 Thread Eugenio Pérez
nt with only the notifications forwarding changes. It can be seen in https://patchew.org/QEMU/20210129205415.876290-1-epere...@redhat.com/ v1 link: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg05372.html Eugenio Pérez (14): vhost: Add VhostShadowVirtqueue vhost: Add Shadow

[PATCH v3 04/14] vhost: Add vhost_svq_valid_features to shadow vq

2022-03-02 Thread Eugenio Pérez
or event idx. Future changes can add support to offer more features to the guest, since the use of VirtQueue gives this for free. This is left out at the moment for simplicity. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 44

[PATCH v3 03/14] vhost: Add Shadow VirtQueue call forwarding capabilities

2022-03-02 Thread Eugenio Pérez
This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 hw/virtio/vhost-shadow-virtqueue.c | 38 ++ hw/virtio/vhost-vdpa.c

[PATCH v3 02/14] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-03-02 Thread Eugenio Pérez
At this mode no buffer forwarding will be performed in SVQ mode: Qemu will just forward the guest's kicks to the device. Host memory notifiers regions are left out for simplicity, and they will not be addressed in this series. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v3 01/14] vhost: Add VhostShadowVirtqueue

2022-03-02 Thread Eugenio Pérez
only exposes basic SVQ allocation and free. Next patches of the series add functionality like notifications and buffers forwarding. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 28 ++ hw/virtio/vhost-shadow-virtqueue.c | 62 ++ hw

[PATCH v2 13/14] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-02-27 Thread Eugenio Pérez
allocated. Future changes might skip that, but this series is already long enough. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 16 2 files changed, 17 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include

[PATCH v2 12/14] vdpa: Never set log_base addr if SVQ is enabled

2022-02-27 Thread Eugenio Pérez
Setting the log address would make the device start reporting invalid dirty memory because the SVQ vrings are located in qemu's memory. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[PATCH v2 09/14] vhost: Add VhostIOVATree

2022-02-27 Thread Eugenio Pérez
can search efficiently in both directions, and it will signal overlap if iova or the translated address is present in any tree. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 27 +++ hw/virtio/vhost-iova-tree.c | 155 hw/virtio/m

[PATCH v2 14/14] vdpa: Add x-svq to NetdevVhostVDPAOptions

2022-02-27 Thread Eugenio Pérez
Finally offering the possibility to enable SVQ from the command line. Signed-off-by: Eugenio Pérez --- qapi/net.json| 5 - net/vhost-vdpa.c | 48 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/qapi/net.json b/qapi

[PATCH v2 08/14] util: Add iova_tree_alloc

2022-02-27 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez Reviewed-by: Peter Xu --- include/qemu/iova-tree.h | 18 ++ util/iova-tree.c | 133 +++ 2 files changed, 151 insertions(+) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 8249edd764..a623136cd8

[PATCH v2 11/14] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-02-27 Thread Eugenio Pérez
This is needed to achieve migration, so the destination can restore its index. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 17 + 1 file changed, 17 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 56f9f125cd..accc4024c2 100644

[PATCH v2 07/14] vhost: Shadow virtqueue buffers forwarding

2022-02-27 Thread Eugenio Pérez
devices, it may cause unexpected SVQ queue full. This patch also solves it by checking for this condition at both guest's kicks and device's calls. The code may be more elegant in the future if SVQ code runs in its own iocontext. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v2 10/14] vdpa: Add custom IOTLB translations to SVQ

2022-02-27 Thread Eugenio Pérez
Use translations added in VhostIOVATree in SVQ. Only introduce usage here, not allocation and deallocation. As with previous patches, we use the dead code paths of shadow_vqs_enabled to avoid commiting too many changes at once. These are impossible to take at the moment. Signed-off-by: Eugenio

[PATCH v2 06/14] vdpa: adapt vhost_ops callbacks to svq

2022-02-27 Thread Eugenio Pérez
First half of the buffers forwarding part, preparing vhost-vdpa callbacks to SVQ to offer it. QEMU cannot enable it at this moment, so this is effectively dead code at the moment, but it helps to reduce patch size. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 84

[PATCH v2 05/14] virtio: Add vhost_shadow_vq_get_vring_addr

2022-02-27 Thread Eugenio Pérez
gned-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 9 + hw/virtio/vhost-shadow-virtqueue.c | 29 + 2 files changed, 38 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index 84747655ad..3bbea7

[PATCH v2 04/14] vhost: Add vhost_svq_valid_features to shadow vq

2022-02-27 Thread Eugenio Pérez
or event idx. Future changes can add support to offer more features to the guest, since the use of VirtQueue gives this for free. This is left out at the moment for simplicity. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 39

[PATCH v2 03/14] vhost: Add Shadow VirtQueue call forwarding capabilities

2022-02-27 Thread Eugenio Pérez
This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 hw/virtio/vhost-shadow-virtqueue.c | 34 ++ hw/virtio/vhost-vdpa.c

[PATCH v2 02/14] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-02-27 Thread Eugenio Pérez
At this mode no buffer forwarding will be performed in SVQ mode: Qemu will just forward the guest's kicks to the device. Host memory notifiers regions are left out for simplicity, and they will not be addressed in this series. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH v2 01/14] vhost: Add VhostShadowVirtqueue

2022-02-27 Thread Eugenio Pérez
only exposes basic SVQ allocation and free. Next patches of the series add functionality like notifications and buffers forwarding. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 28 ++ hw/virtio/vhost-shadow-virtqueue.c | 62 ++ hw

[PATCH v2 00/14] vDPA shadow virtqueue

2022-02-27 Thread Eugenio Pérez
was sent with only the notifications forwarding changes. It can be seen in https://patchew.org/QEMU/20210129205415.876290-1-epere...@redhat.com/ v1 link: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg05372.html Eugenio Pérez (20): virtio: Add VIRTIO_F_QUEUE_STATE

[RFC PATCH] virtio-net: Unlimit tx queue size if peer is vdpa

2022-02-17 Thread Eugenio Pérez
lready, so let's use the full tx size. Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 49cd13314a..b1769bfee0 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/vi

[PATCH] util: Add iova_tree_alloc

2022-02-15 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 17 + util/iova-tree.c | 132 +++ 2 files changed, 149 insertions(+) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 8249edd764..eb6b6175a3 100644 --- a/include/qemu

[no subject]

2022-02-15 Thread Eugenio Pérez
Please review this new minimal version. It is way shorter, but this comes with a cost: * Iteration does not stop at the end of range (but an out of range allocation never happens) * Iteration must start from iova == 0 instead of first valid entry in the hole. These should not be a big deal

[RFC PATCH 9/9] vdpa: control virtqueue support on shadow virtqueue

2022-02-14 Thread Eugenio Pérez
, it will be transfered with the rest of properties in the emulated virtio-net device model. A new CVQ command will be reproduced at destination so that NIC is aware of the changed MAC. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 110 ++- 1 file changed

[RFC PATCH 8/9] vhost: Add vhost_svq_start_op

2022-02-14 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 +++- hw/virtio/vhost-shadow-virtqueue.c | 4 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index 767b0a82ba..8f2377bbc4 100644

[RFC PATCH 6/9] vdpa: Add map/unmap operation callback to SVQ

2022-02-14 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 13 - hw/virtio/vhost-shadow-virtqueue.c | 12 +++- hw/virtio/vhost-vdpa.c | 20 +++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-shadow

[RFC PATCH 3/9] virtio: Make virtqueue_alloc_element non-static

2022-02-14 Thread Eugenio Pérez
So SVQ can allocate elements using it Signed-off-by: Eugenio Pérez --- include/hw/virtio/virtio.h | 1 + hw/virtio/virtio.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index f095637058..6f4cccfd42 100644

[RFC PATCH 1/9] virtio-net: Expose ctrl virtqueue logic

2022-02-14 Thread Eugenio Pérez
This allows external vhost-net devices to modify the state of the VirtIO device model once vhost-vdpa device has acknowledge the control commands. Signed-off-by: Eugenio Pérez --- include/hw/virtio/virtio-net.h | 3 ++ hw/net/virtio-net.c| 83 -- 2

[PATCH 0/1] vdpa: Make ncs autofree

2022-02-14 Thread Eugenio Pérez
Trivial patch extracted from [1] series. It helps to simplify the memory management of the function when adding exit paths following the qemu guidelines. Thanks! [1] https://patchwork.kernel.org/project/qemu-devel/patch/20220121202733.404989-30-epere...@redhat.com/ Eugenio Pérez (1): vdpa

[RFC PATCH 0/9] Net Control VQ support in vDPA SVQ

2022-02-14 Thread Eugenio Pérez
some details like error control is still not 100% tested. Comments are welcomed on every aspect of the patch. [1] https://lore.kernel.org/qemu-devel/20220121202733.404989-1-epere...@redhat.com/ [2] https://lkml.org/lkml/2020/9/23/1243 Eugenio Pérez (9): virtio-net: Expose ctrl virtqueue logic

[PATCH 1/1] vdpa: Make ncs autofree

2022-02-14 Thread Eugenio Pérez
Simplifying memory management. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 4125d13118..4befba5cc7 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -264,7 +264,8 @@ int

[RFC PATCH 5/9] vhost: Add custom used buffer callback

2022-02-14 Thread Eugenio Pérez
-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 10 +- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 15 ++- hw/virtio/vhost-vdpa.c | 4 ++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/hw/virtio

[RFC PATCH 4/9] vhost: Add SVQElement

2022-02-14 Thread Eugenio Pérez
This allows SVQ to add metadata to the different queue elements Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 52 ++ 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow

[RFC PATCH 7/9] vhost: Add vhost_svq_inject

2022-02-14 Thread Eugenio Pérez
This allows qemu to inject packets to the device without guest's notice. This will be use to inject net CVQ messages to restore status in the destination Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 + hw/virtio/vhost-shadow-virtqueue.c | 142

[RFC PATCH 2/9] vdpa: Extract get geatures part from vhost_vdpa_get_max_queue_pairs

2022-02-14 Thread Eugenio Pérez
To know the device features is also needed for CVQ SVQ. Extract from vhost_vdpa_get_max_queue_pairs so we can reuse it. Report errno in case of failure getting them while we're at it. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 30 -- 1 file changed, 20

[PATCH 29/31] vdpa: Make ncs autofree

2022-01-21 Thread Eugenio Pérez
Simplifying memory management. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 4125d13118..4befba5cc7 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -264,7 +264,8 @@ int

[PATCH 25/31] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-01-21 Thread Eugenio Pérez
This is needed to achieve migration, so destination can restore its index. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 276a559649..887857c177 100644 --- a/hw/virtio

[PATCH 21/31] util: Add iova_tree_alloc

2022-01-21 Thread Eugenio Pérez
. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 17 util/iova-tree.c | 86 +++- 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index 8249edd764..33f9b2e13f 100644

[PATCH 28/31] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-01-21 Thread Eugenio Pérez
allocated. Future changes might skip that, but this series is already long enough. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 20 1 file changed, 20 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index fb0a338baa..75090d65e8 100644

[PATCH 24/31] vhost: Add vhost_svq_get_last_used_idx

2022-01-21 Thread Eugenio Pérez
This way SVQ queues can be migrated. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 8 2 files changed, 9 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index

[PATCH 15/31] vdpa: Add vhost_svq_get_num

2022-01-21 Thread Eugenio Pérez
This reports the guest's visible SVQ effective length, not the device's one. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 5 + 2 files changed, 6 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio

[PATCH 31/31] vdpa: Add x-svq to NetdevVhostVDPAOptions

2022-01-21 Thread Eugenio Pérez
Finally offering the possibility to enable SVQ from the command line. Signed-off-by: Eugenio Pérez --- qapi/net.json| 5 - net/vhost-vdpa.c | 27 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 7fab2e7cd8

[PATCH 13/31] vhost: Add vhost_svq_ack_guest_features to shadow vq

2022-01-21 Thread Eugenio Pérez
This combines the previous two feature functions, forwarding the guest ones to the device and setting the transport ones that the SVQ supports with the device. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 3 +++ hw/virtio/vhost-shadow-virtqueue.c | 31

[PATCH 20/31] util: Store DMA entries in a list

2022-01-21 Thread Eugenio Pérez
SVQ need to allocate iova entries, traversing the list looking for holes. GLib offers methods to both transverse the list and look for entries upper than a key since version 2.68. However qemu may need to compile with earlier versions, so we replicate both methods here. Signed-off-by: Eugenio

[PATCH 30/31] vdpa: Move vhost_vdpa_get_iova_range to net/vhost-vdpa.c

2022-01-21 Thread Eugenio Pérez
Since it's a device property, it can be done in net/. This helps SVQ to allocate the rings in vdpa device initialization, rather than delay that. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 15 --- net/vhost-vdpa.c | 32 2 files

[PATCH 12/31] vhost: Add vhost_svq_valid_guest_features to shadow vq

2022-01-21 Thread Eugenio Pérez
to acknowledge them is fatal for SVQ. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 24 2 files changed, 25 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow

[PATCH 18/31] vhost: Shadow virtqueue buffers forwarding

2022-01-21 Thread Eugenio Pérez
devices, it may cause unexpected SVQ queue full. This patch also solves it by checking for this condition at both guest's kicks and device's calls. The code may be more elegant in the future if SVQ code runs in its own iocontext. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h

[PATCH 22/31] vhost: Add VhostIOVATree

2022-01-21 Thread Eugenio Pérez
can search efficiently both directions, and it will signal overlap if iova or the translated address is present in any tree. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 27 +++ hw/virtio/vhost-iova-tree.c | 157 hw/virtio/meson.build

[PATCH 16/31] vhost: pass queue index to vhost_vq_get_addr

2022-01-21 Thread Eugenio Pérez
Doing that way allows vhost backend to know what address to return. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7b03efccec..64b955ba0c 100644 --- a/hw/virtio/vhost.c

[PATCH 08/31] vhost: Add vhost_svq_set_guest_call_notifier

2022-01-21 Thread Eugenio Pérez
This allows the vhost-vdpa device to set SVQ -> guest notifier to SVQ. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 16 2 files changed, 17 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b

[PATCH 19/31] utils: Add internal DMAMap to iova-tree

2022-01-21 Thread Eugenio Pérez
So we can store private data not accessible from outside. In this case, we will add intrusive linked list members so we can transverse it for allocation. Signed-off-by: Eugenio Pérez --- util/iova-tree.c | 37 ++--- 1 file changed, 26 insertions(+), 11 deletions

[PATCH 14/31] virtio: Add vhost_shadow_vq_get_vring_addr

2022-01-21 Thread Eugenio Pérez
gned-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 hw/virtio/vhost-shadow-virtqueue.c | 33 ++ 2 files changed, 37 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index af8f8264c0..3521e8

[PATCH 27/31] vdpa: Never set log_base addr if SVQ is enabled

2022-01-21 Thread Eugenio Pérez
Setting the log address would make the device start reporting invalid dirty memory because the SVQ vrings are located in qemu's memory. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw

[PATCH 06/31] vhost: Route guest->host notification through shadow virtqueue

2022-01-21 Thread Eugenio Pérez
At this moment no buffer forwarding will be performed in SVQ mode: Qemu just forward the guest's kicks to the device. This commit also set up SVQs in the vhost device. Host memory notifiers regions are left out for simplicity, and they will not be addressed in this series. Signed-off-by: Eugenio

[PATCH 26/31] vdpa: Clear VHOST_VRING_F_LOG at vhost_vdpa_set_vring_addr in SVQ

2022-01-21 Thread Eugenio Pérez
Doing so would cause the device to export writes to SVQ addresses, which are not part of the guest's IOVA. Like the previous patch, this is currently not possible since SVQ does not run if the device exports VHOST_VRING_F_LOG. But it's needed to enable migration with SVQ. Signed-off-by: Eugenio

[PATCH 04/31] vdpa: Add vhost_svq_set_svq_kick_fd

2022-01-21 Thread Eugenio Pérez
This function allows the vhost-vdpa backend to override kick_fd. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 1 + hw/virtio/vhost-shadow-virtqueue.c | 45 ++ 2 files changed, 46 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h

[PATCH 11/31] vhost: Add vhost_svq_valid_device_features to shadow vq

2022-01-21 Thread Eugenio Pérez
idx. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 44 ++ hw/virtio/vhost-vdpa.c | 21 ++ 3 files changed, 67 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b

[PATCH 07/31] vhost: dd vhost_svq_get_svq_call_notifier

2022-01-21 Thread Eugenio Pérez
This allows vhost-vdpa device to retrieve device -> svq call eventfd. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 12 2 files changed, 14 insertions(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b

[PATCH 10/31] vhost: Route host->guest notification through shadow virtqueue

2022-01-21 Thread Eugenio Pérez
This will make qemu aware of the device used buffers, allowing it to write the guest memory with its contents if needed. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 15 +++ hw/virtio/vhost-vdpa.c | 11 +++ 2 files changed, 26 insertions

[PATCH 23/31] vdpa: Add custom IOTLB translations to SVQ

2022-01-21 Thread Eugenio Pérez
Use translations added in VhostIOVATree in SVQ. Only introduce usage here, not allocation and deallocation. As with previous patches, we use the dead code paths of shadow_vqs_enabled to avoid commiting too many changes at once. These are impossible to take at the moment. Signed-off-by: Eugenio

[PATCH 01/31] vdpa: Reorder virtio/vhost-vdpa.c functions

2022-01-21 Thread Eugenio Pérez
change intended. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 164 - 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 04ea43704f..6c10a7f05f 100644 --- a/hw/virtio/vhost-vdpa.c

[PATCH 09/31] vhost-vdpa: Take into account SVQ in vhost_vdpa_set_vring_call

2022-01-21 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 18de14f0fb..029f98feee 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c

[PATCH 17/31] vdpa: adapt vhost_ops callbacks to svq

2022-01-21 Thread Eugenio Pérez
First half of the buffers forwarding part, preparing vhost-vdpa callbacks to SVQ to offer it. QEMU cannot enable it at this moment, so this is effectively dead code at the moment, but it helps to reduce patch size. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw

[PATCH 00/31] vDPA shadow virtqueue

2022-01-21 Thread Eugenio Pérez
. * An intermediate RFC was sent with only the notifications forwarding changes. It can be seen in https://patchew.org/QEMU/20210129205415.876290-1-epere...@redhat.com/ v1 link: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg05372.html Eugenio Pérez (20): virtio: Add

[PATCH 03/31] vdpa: Add vhost_svq_get_dev_kick_notifier

2022-01-21 Thread Eugenio Pérez
Is needed so vhost-vdpa knows the device's kick event fd. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 4 hw/virtio/vhost-shadow-virtqueue.c | 10 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw

[PATCH 05/31] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-01-21 Thread Eugenio Pérez
-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 2 ++ hw/virtio/vhost-shadow-virtqueue.c | 27 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h index a56ecfc09d

[PATCH 02/31] vhost: Add VhostShadowVirtqueue

2022-01-21 Thread Eugenio Pérez
only exposes basic SVQ allocation and free. Next patches of the series add functionality like notifications and buffers forwarding. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 21 ++ hw/virtio/vhost-shadow-virtqueue.c | 64 ++ hw/virtio

[PATCH v2 1/2] vdpa: Add dummy receive callback

2021-11-25 Thread Eugenio Pérez
vhost-vdpa: introduce vhost-vdpa net client") Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 8 1 file changed, 8 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 2e3c22a8c7..25dd6dd975 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -170,9 +170,17

[PATCH v2 2/2] virtio-net: Fix log message

2021-11-25 Thread Eugenio Pérez
The message has never been true in the case of non tap networking, so only tell that userland networking will be used if possible. Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net

[PATCH v2 0/2] vdpa: Fix SIGSEGV on failed vdpa devices

2021-11-25 Thread Eugenio Pérez
version of vp_vdpa to fail negotiation. v2: * Replace dummy receive_{iov,raw} with receive callback. * Delete fix indentation commit, we don't touch that code anymore. Eugenio Pérez (2): vdpa: Add dummy receive callback virtio-net: Fix log message hw/net/virtio-net.c | 11 ++- net

[PATCH 1/3] virtio-net: Fix indentation

2021-11-19 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f2014d5ea0..004acf858f 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3501,7 +3501,7 @@ static void

[PATCH 2/3] vdpa: Add dummy receive callbacks

2021-11-19 Thread Eugenio Pérez
vhost-vdpa: introduce vhost-vdpa net client") Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 16 1 file changed, 16 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 2e3c22a8c7..4c75b78304 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -170

[PATCH 3/3] virtio-net: Fix log message

2021-11-19 Thread Eugenio Pérez
The message has never been true in the case of non tap networking, so only tell that userland networking will be used if possible. Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net

[PATCH 0/3] vdpa: Fix SIGSEGV on failed vdpa devices

2021-11-19 Thread Eugenio Pérez
version of vp_vdpa to fail negotiation. This is another bersion of the patch proposed in [1], but the subject didn't match the patch anymore. [1] https://lists.nongnu.org/archive/html/qemu-devel/2021-11/msg03719.html Eugenio Pérez (3): virtio-net: Fix indentation vdpa: Add dummy receive

[PATCH 1/3] virtio-net: Fix indentation

2021-11-17 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f2014d5ea0..004acf858f 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3501,7 +3501,7 @@ static void

<    6   7   8   9   10   11   12   13   14   >