Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[linux-2.6-microblaze.git] / drivers / vdpa / virtio_pci / vp_vdpa.c
index fe05273..5bcd002 100644 (file)
@@ -189,10 +189,20 @@ static void vp_vdpa_set_status(struct vdpa_device *vdpa, u8 status)
        }
 
        vp_modern_set_status(mdev, status);
+}
 
-       if (!(status & VIRTIO_CONFIG_S_DRIVER_OK) &&
-           (s & VIRTIO_CONFIG_S_DRIVER_OK))
+static int vp_vdpa_reset(struct vdpa_device *vdpa)
+{
+       struct vp_vdpa *vp_vdpa = vdpa_to_vp(vdpa);
+       struct virtio_pci_modern_device *mdev = &vp_vdpa->mdev;
+       u8 s = vp_vdpa_get_status(vdpa);
+
+       vp_modern_set_status(mdev, 0);
+
+       if (s & VIRTIO_CONFIG_S_DRIVER_OK)
                vp_vdpa_free_irq(vp_vdpa);
+
+       return 0;
 }
 
 static u16 vp_vdpa_get_vq_num_max(struct vdpa_device *vdpa)
@@ -398,6 +408,7 @@ static const struct vdpa_config_ops vp_vdpa_ops = {
        .set_features   = vp_vdpa_set_features,
        .get_status     = vp_vdpa_get_status,
        .set_status     = vp_vdpa_set_status,
+       .reset          = vp_vdpa_reset,
        .get_vq_num_max = vp_vdpa_get_vq_num_max,
        .get_vq_state   = vp_vdpa_get_vq_state,
        .get_vq_notification = vp_vdpa_get_vq_notification,
@@ -435,7 +446,7 @@ static int vp_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                return ret;
 
        vp_vdpa = vdpa_alloc_device(struct vp_vdpa, vdpa,
-                                   dev, &vp_vdpa_ops, NULL);
+                                   dev, &vp_vdpa_ops, NULL, false);
        if (IS_ERR(vp_vdpa)) {
                dev_err(dev, "vp_vdpa: Failed to allocate vDPA structure\n");
                return PTR_ERR(vp_vdpa);