mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
vhost: Add vhost_svq_valid_features to shadow vq
This allows SVQ to negotiate features with the guest and the device. For the device, SVQ is a driver. While this function bypasses all non-transport features, it needs to disable the features that SVQ does not support when forwarding buffers. This includes packed vq layout, indirect descriptors 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 <eperezma@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
a8ac88585d
commit
4725a4181b
3 changed files with 61 additions and 0 deletions
|
@ -348,11 +348,26 @@ static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v,
|
|||
Error **errp)
|
||||
{
|
||||
g_autoptr(GPtrArray) shadow_vqs = NULL;
|
||||
uint64_t dev_features, svq_features;
|
||||
int r;
|
||||
bool ok;
|
||||
|
||||
if (!v->shadow_vqs_enabled) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = hdev->vhost_ops->vhost_get_features(hdev, &dev_features);
|
||||
if (r != 0) {
|
||||
error_setg_errno(errp, -r, "Can't get vdpa device features");
|
||||
return r;
|
||||
}
|
||||
|
||||
svq_features = dev_features;
|
||||
ok = vhost_svq_valid_features(svq_features, errp);
|
||||
if (unlikely(!ok)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
shadow_vqs = g_ptr_array_new_full(hdev->nvqs, vhost_svq_free);
|
||||
for (unsigned n = 0; n < hdev->nvqs; ++n) {
|
||||
g_autoptr(VhostShadowVirtqueue) svq = vhost_svq_new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue