[RFC PATCH 17/18] vdpa: use shadow_data instead of first device v->shadow_vqs_enabled

Eugenio Pérez posted 18 patches 1 year, 1 month ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>
There is a newer version of this series
[RFC PATCH 17/18] vdpa: use shadow_data instead of first device v->shadow_vqs_enabled
Posted by Eugenio Pérez 1 year, 1 month ago
Previously we trusted vq_index == 0 will be started first. By the end of
this series this might not be true, so let's check proper shadow_data
for this.
---
 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 bfbe4673af..1f2ef953f6 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -802,7 +802,7 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
         return 0;
     }
 
-    if (v->shadow_vqs_enabled) {
+    if (v->shared->shadow_data) {
         if ((v->acked_features ^ features) == BIT_ULL(VHOST_F_LOG_ALL)) {
             /*
              * QEMU is just trying to enable or disable logging. SVQ handles
@@ -1353,7 +1353,7 @@ static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base,
                                      struct vhost_log *log)
 {
     struct vhost_vdpa *v = dev->opaque;
-    if (v->shadow_vqs_enabled || !vhost_vdpa_first_dev(dev)) {
+    if (v->shared->shadow_data || !vhost_vdpa_first_dev(dev)) {
         return 0;
     }
 
-- 
2.39.3