[RFC PATCH v5 02/23] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base

2022-04-08 Thread Eugenio Pérez
Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ") Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 9e5fe15d03..1f229ff4cb 100644 --- a

[RFC PATCH v5 07/23] vhost: move descriptor translation to vhost_svq_vring_write_descs

2022-04-08 Thread Eugenio Pérez
It's done for both in and out descriptors so it's better placed here. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vh

[RFC PATCH v5 03/23] util: Return void on iova_tree_remove

2022-04-08 Thread Eugenio Pérez
It always returns IOVA_OK so nobody uses it. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 4 +--- util/iova-tree.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index c938fb0793..16bbfdf5f8

[RFC PATCH v5 00/23] Net Control VQ support with asid in vDPA SVQ

2022-04-08 Thread Eugenio Pérez
model so (MAC) state can be migrated too. [1] https://lkml.kernel.org/kvm/20220224212314.1326-1-gda...@xilinx.com/ Eugenio Pérez (22): vdpa: Add missing tracing to batch mapping functions vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base util: Return void on iova_tree_remove vhost

[RFC PATCH v5 06/23] vdpa: Add x-svq to NetdevVhostVDPAOptions

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

[RFC PATCH v5 04/23] hw/virtio: Replace g_memdup() by g_memdup2()

2022-04-08 Thread Eugenio Pérez
From: Philippe Mathieu-Daudé Per https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538 The old API took the size of the memory to duplicate as a guint, whereas most memory functions take memory sizes as a gsize. This made it easy to accidentally pass a gsize t

[RFC PATCH v5 01/23] vdpa: Add missing tracing to batch mapping functions

2022-04-08 Thread Eugenio Pérez
These functions were not traced properly. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 ++ hw/virtio/trace-events | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8adf7c0b92..9e5fe15d03 100644 --- a/hw/virtio/vhost

[PATCH] vdpa: Add missing tracing to batch mapping functions

2022-04-04 Thread Eugenio Pérez
These functions were not traced properly. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 ++ hw/virtio/trace-events | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8adf7c0b92..9e5fe15d03 100644 --- a/hw/virtio/vhost

[PATCH] virtio-net: use g_memdup2() instead of unsafe g_memdup()

2022-03-31 Thread Eugenio Pérez
Fixing that literal checkpatch.pl because it will complain when we modify the file Signed-off-by: Eugenio Pérez --- hw/net/virtio-net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 1067e72b39..e4748a7e6c 100644 --- a/hw

[RFC PATCH v4 19/20] vdpa: Add asid attribute to vdpa device

2022-03-31 Thread Eugenio Pérez
We can configure ASID per group, but we still use asid 0 for every vdpa device. Multiple asid support for cvq will be introduced in next patches. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 3 +++ hw/virtio/vhost-vdpa.c | 47 -- net

[RFC PATCH v4 20/20] vdpa: Add x-cvq-svq

2022-03-31 Thread Eugenio Pérez
This isolates shadow cvq in its own group. Signed-off-by: Eugenio Pérez --- qapi/net.json| 8 ++- net/vhost-vdpa.c | 179 +++ 2 files changed, 171 insertions(+), 16 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 6a5460ce56

[RFC PATCH v4 18/20] vhost: Update kernel headers

2022-03-31 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- include/standard-headers/linux/vhost_types.h | 11 - linux-headers/linux/vhost.h | 25 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard

[RFC PATCH v4 16/20] vdpa: add NetClientState->start() callback

2022-03-31 Thread Eugenio Pérez
It allows to inject custom code on device success start, right before release lock. Signed-off-by: Eugenio Pérez --- include/net/net.h | 2 ++ hw/net/vhost_net.c | 4 2 files changed, 6 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 523136c7ac..2fc3002ab4 100644

[PATCH] util: Return void on iova_tree_remove

2022-03-31 Thread Eugenio Pérez
It always returns IOVA_OK so nobody uses it. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 4 +--- util/iova-tree.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index c938fb0793..16bbfdf5f8

[RFC PATCH v4 17/20] vdpa: Add vhost_vdpa_start_control_svq

2022-03-31 Thread Eugenio Pérez
This will send CVQ commands in the destination machine, seting up everything o there is no guest-visible change. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 63 1 file changed, 63 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost

[RFC PATCH v4 12/20] vdpa: control virtqueue support on shadow virtqueue

2022-03-31 Thread Eugenio Pérez
device model will be updated with the new one. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 70 +--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 290aa01e13..585d2f60f8 100644 --- a/net

[RFC PATCH v4 08/20] vdpa: Extract get geatures part from vhost_vdpa_get_max_queue_pairs

2022-03-31 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 change

[RFC PATCH v4 15/20] vhost: Add vhost_svq_inject

2022-03-31 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 | 5 + hw/virtio/vhost-shadow-virtqueue.c

[RFC PATCH v4 09/20] virtio: Make virtqueue_alloc_element non-static

2022-03-31 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 b31c4507f5..1e85833897 100644

[PATCH] vhost: Fix bad return of descriptors to SVQ

2022-03-31 Thread Eugenio Pérez
Only the first one of them were properly enqueued back. Fixes: 100890f7ca ("vhost: Shadow virtqueue buffers forwarding") Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/vi

[RFC PATCH v4 06/20] virtio-net: use g_memdup2() instead of unsafe g_memdup()

2022-03-31 Thread Eugenio Pérez
Fixing that literal checkpatch.pl because it will complain when we modify the file 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 1067e72b39..da05516a99 100644 --- a/hw/net

[RFC PATCH v4 14/20] vdpa: Add map/unmap operation callback to SVQ

2022-03-31 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 21 +++-- hw/virtio/vhost-shadow-virtqueue.c | 8 +++- hw/virtio/vhost-vdpa.c | 20 +++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-shadow

[RFC PATCH v4 13/20] vhost: Add vhost_iova_tree_find

2022-03-31 Thread Eugenio Pérez
Just a simple wrapper so we can find DMAMap entries based on iova Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 2 ++ hw/virtio/vhost-iova-tree.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h

[RFC PATCH v4 07/20] virtio-net: Expose ctrl virtqueue logic

2022-03-31 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| 82 -- 2

[RFC PATCH v4 02/20] util: Return void on iova_tree_remove

2022-03-31 Thread Eugenio Pérez
It always returns IOVA_OK so nobody uses it. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 4 +--- util/iova-tree.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index c938fb0793..16bbfdf5f8

[RFC PATCH v4 11/20] vhost: Add custom used buffer callback

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

[RFC PATCH v4 05/20] vdpa: Fix index calculus at vhost_vdpa_svqs_start

2022-03-31 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index c5ed7a3779..9eeac8fa8e 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1016,7 +1016,7 @@ static

[RFC PATCH v4 10/20] vhost: Add SVQElement

2022-03-31 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.h | 8 -- hw/virtio/vhost-shadow-virtqueue.c | 42 -- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/hw/virtio

[RFC PATCH v4 03/20] vdpa: Add x-svq to NetdevVhostVDPAOptions

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

[RFC PATCH v4 04/20] vhost: move descriptor translation to vhost_svq_vring_write_descs

2022-03-31 Thread Eugenio Pérez
It's done for both in and out descriptors so it's better placed here. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vh

[RFC PATCH v4 01/20] vhost: Fix bad return of descriptors

2022-03-31 Thread Eugenio Pérez
Only the first one of them were properly enqueued back. Fixes: 100890f7ca ("vhost: Shadow virtqueue buffers forwarding") Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/vi

[RFC PATCH v4 00/20] Net Control VQ support with asid in vDPA SVQ

2022-03-31 Thread Eugenio Pérez
g cvq asid != data vqs asid. * Update device model so (MAC) state can be migrated too. [1] https://lkml.kernel.org/kvm/20220224212314.1326-1-gda...@xilinx.com/ Eugenio Pérez (20): vhost: Fix bad return of descriptors util: Return void on iova_tree_remove vdpa: Add x-svq to NetdevVhostVDPAOp

[RFC PATCH v3 13/19] vdpa: Add map/unmap operation callback to SVQ

2022-03-30 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 21 +++-- hw/virtio/vhost-shadow-virtqueue.c | 8 +++- hw/virtio/vhost-vdpa.c | 20 +++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-shadow

[RFC PATCH v3 12/19] vhost: Add vhost_iova_tree_find

2022-03-30 Thread Eugenio Pérez
Just a simple wrapper so we can find DMAMap entries based on iova Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 2 ++ hw/virtio/vhost-iova-tree.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h

[RFC PATCH v3 11/19] vdpa: control virtqueue support on shadow virtqueue

2022-03-30 Thread Eugenio Pérez
device model will be updated with the new one. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 70 +--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 290aa01e13..585d2f60f8 100644 --- a/net

[RFC PATCH v3 06/19] virtio-net: Expose ctrl virtqueue logic

2022-03-30 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| 82 -- 2

[RFC PATCH v3 03/19] vhost: move descriptor translation to vhost_svq_vring_write_descs

2022-03-30 Thread Eugenio Pérez
It's done for both in and out descriptors so it's better placed here. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vh

[RFC PATCH v3 19/19] vdpa: Add x-cvq-svq

2022-03-30 Thread Eugenio Pérez
This isolates shadow cvq in its own group. Signed-off-by: Eugenio Pérez --- qapi/net.json| 8 ++- net/vhost-vdpa.c | 179 +++ 2 files changed, 171 insertions(+), 16 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 6a5460ce56

[RFC PATCH v3 00/19] Net Control VQ support with asid in vDPA SVQ

2022-03-30 Thread Eugenio Pérez
an be migrated too. [1] https://lkml.kernel.org/kvm/20220224212314.1326-1-gda...@xilinx.com/ Eugenio Pérez (19): util: Return void on iova_tree_remove vdpa: Add x-svq to NetdevVhostVDPAOptions vhost: move descriptor translation to vhost_svq_vring_write_descs vdpa: Fix index calcul

[RFC PATCH v3 17/19] vhost: Update kernel headers

2022-03-30 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- include/standard-headers/linux/vhost_types.h | 11 - linux-headers/linux/vhost.h | 25 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard

[RFC PATCH v3 14/19] vhost: Add vhost_svq_inject

2022-03-30 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 | 5 + hw/virtio/vhost-shadow-virtqueue.c

[RFC PATCH v3 16/19] vdpa: Add vhost_vdpa_start_control_svq

2022-03-30 Thread Eugenio Pérez
This will send CVQ commands in the destination machine, seting up everything o there is no guest-visible change. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 63 1 file changed, 63 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost

[RFC PATCH v3 15/19] vdpa: add NetClientState->start() callback

2022-03-30 Thread Eugenio Pérez
It allows to inject custom code on device success start, right before release lock. Signed-off-by: Eugenio Pérez --- include/net/net.h | 2 ++ hw/net/vhost_net.c | 4 2 files changed, 6 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 523136c7ac..2fc3002ab4 100644

[RFC PATCH v3 10/19] vhost: Add custom used buffer callback

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

[RFC PATCH v3 09/19] vhost: Add SVQElement

2022-03-30 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.h | 8 -- hw/virtio/vhost-shadow-virtqueue.c | 42 -- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/hw/virtio

[RFC PATCH v3 08/19] virtio: Make virtqueue_alloc_element non-static

2022-03-30 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 b31c4507f5..1e85833897 100644

[RFC PATCH v3 05/19] virtio-net: use g_memdup2() instead of unsafe g_memdup()

2022-03-30 Thread Eugenio Pérez
Fixing that literal checkpatch.pl because it will complain when we modify the file 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 1067e72b39..da05516a99 100644 --- a/hw/net

[RFC PATCH v3 07/19] vdpa: Extract get geatures part from vhost_vdpa_get_max_queue_pairs

2022-03-30 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 change

[RFC PATCH v3 04/19] vdpa: Fix index calculus at vhost_vdpa_svqs_start

2022-03-30 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index c5ed7a3779..9eeac8fa8e 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1016,7 +1016,7 @@ static

[RFC PATCH v3 01/19] util: Return void on iova_tree_remove

2022-03-30 Thread Eugenio Pérez
It always returns IOVA_OK so nobody uses it. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 4 +--- util/iova-tree.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index c938fb0793..16bbfdf5f8

[RFC PATCH v3 18/19] vdpa: Add asid attribute to vdpa device

2022-03-30 Thread Eugenio Pérez
We can configure ASID per group, but we still use asid 0 for every vdpa device. Multiple asid support for cvq will be introduced in next patches. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 3 +++ hw/virtio/vhost-vdpa.c | 47 -- net

[RFC PATCH v3 02/19] vdpa: Add x-svq to NetdevVhostVDPAOptions

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

[RFC PATCH v2 18/18] vdpa: Add x-cvq-svq

2022-03-17 Thread Eugenio Pérez
This isolates shadow cvq in its own group. Signed-off-by: Eugenio Pérez --- qapi/net.json| 8 ++- net/vhost-vdpa.c | 179 +++ 2 files changed, 171 insertions(+), 16 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 6a5460ce56

[RFC PATCH v2 17/18] vdpa: Add asid attribute to vdpa device

2022-03-17 Thread Eugenio Pérez
We can configure ASID per group, but we still use asid 0 for every vdpa device. Multiple asid support for cvq will be introduced in next patches. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 3 +++ hw/virtio/vhost-vdpa.c | 47 -- net

[RFC PATCH v2 11/18] vhost: Add vhost_iova_tree_find

2022-03-17 Thread Eugenio Pérez
Just a simple wrapper so we can find DMAMap entries based on iova Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 2 ++ hw/virtio/vhost-iova-tree.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h

[RFC PATCH v2 16/18] vhost: Update kernel headers

2022-03-17 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- include/standard-headers/linux/vhost_types.h | 11 - linux-headers/linux/vhost.h | 25 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard

[RFC PATCH v2 14/18] vdpa: add NetClientState->start() callback

2022-03-17 Thread Eugenio Pérez
It allows to inject custom code on device success start, right before release lock. Signed-off-by: Eugenio Pérez --- include/net/net.h | 2 ++ hw/net/vhost_net.c | 4 2 files changed, 6 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 523136c7ac..2fc3002ab4 100644

[RFC PATCH v2 09/18] vhost: Add custom used buffer callback

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

[RFC PATCH v2 07/18] virtio: Make virtqueue_alloc_element non-static

2022-03-17 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 v2 13/18] vhost: Add vhost_svq_inject

2022-03-17 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 | 5 + hw/virtio/vhost-shadow-virtqueue.c

[RFC PATCH v2 06/18] vdpa: Extract get geatures part from vhost_vdpa_get_max_queue_pairs

2022-03-17 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 change

[RFC PATCH v2 15/18] vdpa: Add vhost_vdpa_start_control_svq

2022-03-17 Thread Eugenio Pérez
This will send CVQ commands in the destination machine, seting up everything o there is no guest-visible change. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 63 1 file changed, 63 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost

[RFC PATCH v2 08/18] vhost: Add SVQElement

2022-03-17 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.h | 8 -- hw/virtio/vhost-shadow-virtqueue.c | 42 -- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/hw/virtio

[RFC PATCH v2 10/18] vdpa: control virtqueue support on shadow virtqueue

2022-03-17 Thread Eugenio Pérez
device model will be updated with the new one. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 70 +--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 290aa01e13..585d2f60f8 100644 --- a/net

[RFC PATCH v2 03/18] vdpa: Fix index calculus at vhost_vdpa_svqs_start

2022-03-17 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index c5ed7a3779..9eeac8fa8e 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1016,7 +1016,7 @@ static

[RFC PATCH v2 05/18] virtio-net: Expose ctrl virtqueue logic

2022-03-17 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| 82 -- 2

[RFC PATCH v2 12/18] vdpa: Add map/unmap operation callback to SVQ

2022-03-17 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 21 +++-- hw/virtio/vhost-shadow-virtqueue.c | 8 +++- hw/virtio/vhost-vdpa.c | 20 +++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-shadow

[RFC PATCH v2 00/18] Net Control VQ support with asid in vDPA SVQ

2022-03-17 Thread Eugenio Pérez
ments are welcomed on every aspect of the patch. Changes from rfc v1: * Rebase to latest master * Configure ASID instead of assuming cvq asid != data vqs asid * Update device model so (MAC) state can be migrated too. [1] https://lkml.kernel.org/kvm/20220224212314.1326-1-gda...@xilinx.com/ Eu

[RFC PATCH v2 04/18] virtio-net: use g_memdup2() instead of unsafe g_memdup()

2022-03-17 Thread Eugenio Pérez
Fixing that literal checkpatch.pl because it will complain when we modify the file 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 2087516253..cb505939b2 100644 --- a/hw/net

[RFC PATCH v2 02/18] vhost: move descriptor translation to vhost_svq_vring_write_descs

2022-03-17 Thread Eugenio Pérez
It's done for both in and out descriptors so it's better placed here. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vh

[RFC PATCH v2 01/18] vdpa: Add x-svq to NetdevVhostVDPAOptions

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

[PATCH v6 08/15] util: Add iova_tree_alloc_map

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

[PATCH v6 07/15] vhost: Shadow virtqueue buffers forwarding

2022-03-14 Thread Eugenio Pérez
27;s emulated virtio 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/v

[PATCH v6 14/15] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-03-14 Thread Eugenio Pérez
still 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/in

[PATCH v6 09/15] util: add iova_tree_find_iova

2022-03-14 Thread Eugenio Pérez
This function does the reverse operation of iova_tree_find: To look for a mapping that match a translated address so we can do the reverse. This have linear complexity instead of logarithmic, but it supports overlapping HVA. Future developments could reduce it. Signed-off-by: Eugenio Pérez

[PATCH v6 04/15] vhost: Add vhost_svq_valid_features to shadow vq

2022-03-14 Thread Eugenio Pérez
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 v6 13/15] vdpa: Never set log_base addr if SVQ is enabled

2022-03-14 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

[PATCH v6 10/15] vhost: Add VhostIOVATree

2022-03-14 Thread Eugenio Pérez
ree so it 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 | 110 h

[PATCH v6 12/15] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-03-14 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 ec38189492..93dbe1043c 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio

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

2022-03-14 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 v6 11/15] vdpa: Add custom IOTLB translations to SVQ

2022-03-14 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 v6 06/15] vdpa: adapt vhost_ops callbacks to svq

2022-03-14 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 v6 02/15] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-03-14 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-virtqu

[PATCH v6 03/15] vhost: Add Shadow VirtQueue call forwarding capabilities

2022-03-14 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 v6 05/15] virtio: Add vhost_svq_get_vring_addr

2022-03-14 Thread Eugenio Pérez
. Signed-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..8

[PATCH v6 01/15] vhost: Add VhostShadowVirtqueue

2022-03-14 Thread Eugenio Pérez
his commit 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

[PATCH v6 00/15] vDPA shadow virtqueue

2022-03-14 Thread Eugenio Pérez
e 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 VIRTIO_F_

[PATCH v5 09/15] util: add iova_tree_find_iova

2022-03-07 Thread Eugenio Pérez
This function does the reverse operation of iova_tree_find: To look for a mapping that match a translated address so we can do the reverse. This have linear complexity instead of logarithmic, but it supports overlapping HVA. Future developments could reduce it. Signed-off-by: Eugenio Pérez

[PATCH v5 11/15] vdpa: Add custom IOTLB translations to SVQ

2022-03-07 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 v5 14/15] vdpa: Expose VHOST_F_LOG_ALL on SVQ

2022-03-07 Thread Eugenio Pérez
still 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/in

[PATCH v5 08/15] util: Add iova_tree_alloc_map

2022-03-07 Thread Eugenio Pérez
addresses. 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..

[PATCH v5 10/15] vhost: Add VhostIOVATree

2022-03-07 Thread Eugenio Pérez
ree so it 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 | 110 h

[PATCH v5 13/15] vdpa: Never set log_base addr if SVQ is enabled

2022-03-07 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

[PATCH v5 07/15] vhost: Shadow virtqueue buffers forwarding

2022-03-07 Thread Eugenio Pérez
27;s emulated virtio 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/v

[PATCH v5 05/15] virtio: Add vhost_svq_get_vring_addr

2022-03-07 Thread Eugenio Pérez
. Signed-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..8

[PATCH v5 12/15] vdpa: Adapt vhost_vdpa_get_vring_base to SVQ

2022-03-07 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 v5 02/15] vhost: Add Shadow VirtQueue kick forwarding capabilities

2022-03-07 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-virtqu

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

2022-03-07 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 v5 06/15] vdpa: adapt vhost_ops callbacks to svq

2022-03-07 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 v5 01/15] vhost: Add VhostShadowVirtqueue

2022-03-07 Thread Eugenio Pérez
his commit 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

<    5   6   7   8   9   10   11   12   >