在 2021/10/1 下午3:06, Eugenio Pérez 写道:
Use translations added in VhostIOVATree in SVQ.
Now every element needs to store the previous address also, so VirtQueue
can consume the elements properly. This adds a little overhead per VQ
element, having to allocate more memory to stash them. As a possible
optimization, this allocation could be avoided if the descriptor is not
a chain but a single one, but this is left undone.
TODO: iova range should be queried before, and add logic to fail when
GPA is outside of its range and memory listener or svq add it.
Signed-off-by: Eugenio Pérez<epere...@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.h | 4 +-
hw/virtio/vhost-shadow-virtqueue.c | 130 ++++++++++++++++++++++++-----
hw/virtio/vhost-vdpa.c | 40 ++++++++-
hw/virtio/trace-events | 1 +
4 files changed, 152 insertions(+), 23 deletions(-)
Think hard about the whole logic. This is safe since qemu memory map
will fail if guest submits a invalidate IOVA.
Then I wonder if we do something much more simpler:
1) Using qemu VA as IOVA but only maps the VA that belongs to guest
2) Then we don't need any IOVA tree here, what we need is to just map
vring and use qemu VA without any translation
Thanks