Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156091
b: refs/heads/master
c: ff52c3f
h: refs/heads/master
i:
  156089: 6547cd0
  156087: 2e973d7
v: v3
  • Loading branch information
Michael S. Tsirkin authored and Rusty Russell committed Jul 30, 2009
1 parent 294da2b commit 611f87f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ef562d112c82ec539775698f8b63ac5ec1bd766
refs/heads/master: ff52c3fc7188855ede75d87b022271f0da309e5b
28 changes: 15 additions & 13 deletions trunk/drivers/virtio/virtio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ static void vp_free_vectors(struct virtio_device *vdev)

for (i = 0; i < vp_dev->msix_used_vectors; ++i)
free_irq(vp_dev->msix_entries[i].vector, vp_dev);
vp_dev->msix_used_vectors = 0;

if (vp_dev->msix_enabled) {
/* Disable the vector used for configuration */
Expand All @@ -267,9 +266,16 @@ static void vp_free_vectors(struct virtio_device *vdev)
/* Flush the write out to device */
ioread16(vp_dev->ioaddr + VIRTIO_MSI_CONFIG_VECTOR);

vp_dev->msix_enabled = 0;
pci_disable_msix(vp_dev->pci_dev);
vp_dev->msix_enabled = 0;
vp_dev->msix_vectors = 0;
}

vp_dev->msix_used_vectors = 0;
kfree(vp_dev->msix_names);
vp_dev->msix_names = NULL;
kfree(vp_dev->msix_entries);
vp_dev->msix_entries = NULL;
}

static int vp_enable_msix(struct pci_dev *dev, struct msix_entry *entries,
Expand Down Expand Up @@ -297,11 +303,11 @@ static int vp_request_vectors(struct virtio_device *vdev, unsigned max_vqs)
vp_dev->msix_entries = kmalloc(nvectors * sizeof *vp_dev->msix_entries,
GFP_KERNEL);
if (!vp_dev->msix_entries)
goto error_entries;
goto error;
vp_dev->msix_names = kmalloc(nvectors * sizeof *vp_dev->msix_names,
GFP_KERNEL);
if (!vp_dev->msix_names)
goto error_names;
goto error;

for (i = 0; i < nvectors; ++i)
vp_dev->msix_entries[i].entry = i;
Expand All @@ -314,7 +320,7 @@ static int vp_request_vectors(struct virtio_device *vdev, unsigned max_vqs)
err = request_irq(vp_dev->pci_dev->irq, vp_interrupt,
IRQF_SHARED, name, vp_dev);
if (err)
goto error_irq;
goto error;
vp_dev->intx_enabled = 1;
} else {
vp_dev->msix_vectors = err;
Expand All @@ -328,15 +334,15 @@ static int vp_request_vectors(struct virtio_device *vdev, unsigned max_vqs)
vp_config_changed, 0, vp_dev->msix_names[v],
vp_dev);
if (err)
goto error_irq;
goto error;
++vp_dev->msix_used_vectors;

iowrite16(v, vp_dev->ioaddr + VIRTIO_MSI_CONFIG_VECTOR);
/* Verify we had enough resources to assign the vector */
v = ioread16(vp_dev->ioaddr + VIRTIO_MSI_CONFIG_VECTOR);
if (v == VIRTIO_MSI_NO_VECTOR) {
err = -EBUSY;
goto error_irq;
goto error;
}
}

Expand All @@ -349,16 +355,12 @@ static int vp_request_vectors(struct virtio_device *vdev, unsigned max_vqs)
vp_vring_interrupt, 0, vp_dev->msix_names[v],
vp_dev);
if (err)
goto error_irq;
goto error;
++vp_dev->msix_used_vectors;
}
return 0;
error_irq:
error:
vp_free_vectors(vdev);
kfree(vp_dev->msix_names);
error_names:
kfree(vp_dev->msix_entries);
error_entries:
return err;
}

Expand Down

0 comments on commit 611f87f

Please sign in to comment.