virtio_vdpa: legacy features handling
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 27 Jul 2020 14:59:02 +0000 (10:59 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 5 Aug 2020 15:08:40 +0000 (11:08 -0400)
We normally expect vdpa to use the modern interface.
However for consistency, let's use same APIs as vhost
for legacy guests.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_vdpa.c

index c30eb55..4a9ddb4 100644 (file)
@@ -57,9 +57,8 @@ static void virtio_vdpa_get(struct virtio_device *vdev, unsigned offset,
                            void *buf, unsigned len)
 {
        struct vdpa_device *vdpa = vd_get_vdpa(vdev);
-       const struct vdpa_config_ops *ops = vdpa->config;
 
-       ops->get_config(vdpa, offset, buf, len);
+       vdpa_get_config(vdpa, offset, buf, len);
 }
 
 static void virtio_vdpa_set(struct virtio_device *vdev, unsigned offset,
@@ -101,9 +100,8 @@ static void virtio_vdpa_set_status(struct virtio_device *vdev, u8 status)
 static void virtio_vdpa_reset(struct virtio_device *vdev)
 {
        struct vdpa_device *vdpa = vd_get_vdpa(vdev);
-       const struct vdpa_config_ops *ops = vdpa->config;
 
-       return ops->set_status(vdpa, 0);
+       vdpa_reset(vdpa);
 }
 
 static bool virtio_vdpa_notify(struct virtqueue *vq)
@@ -294,12 +292,11 @@ static u64 virtio_vdpa_get_features(struct virtio_device *vdev)
 static int virtio_vdpa_finalize_features(struct virtio_device *vdev)
 {
        struct vdpa_device *vdpa = vd_get_vdpa(vdev);
-       const struct vdpa_config_ops *ops = vdpa->config;
 
        /* Give virtio_ring a chance to accept features. */
        vring_transport_features(vdev);
 
-       return ops->set_features(vdpa, vdev->features);
+       return vdpa_set_features(vdpa, vdev->features);
 }
 
 static const char *virtio_vdpa_bus_name(struct virtio_device *vdev)