diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-29 12:17:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-29 12:17:59 -0400 |
commit | add810a1c58ba9edb6076ababe5861f36c049217 (patch) | |
tree | ae877d82a37708bda16c1ead5751e692162b2ea9 | |
parent | 68e71d1902a820c9bc7a5a6c23260841caafff33 (diff) | |
parent | 2d61ba95034f1abbdec7729d52c740870a5eddb6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
virtio: order used ring after used index read
virtio-pci: fix per-vq MSI-X request logic
-rw-r--r-- | drivers/virtio/virtio_pci.c | 27 | ||||
-rw-r--r-- | drivers/virtio/virtio_ring.c | 3 |
2 files changed, 18 insertions, 12 deletions
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4a1f1ebff7bf..28d9cf7cf72f 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -530,19 +530,22 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, | |||
530 | err = PTR_ERR(vqs[i]); | 530 | err = PTR_ERR(vqs[i]); |
531 | goto error_find; | 531 | goto error_find; |
532 | } | 532 | } |
533 | |||
534 | if (!vp_dev->per_vq_vectors || msix_vec == VIRTIO_MSI_NO_VECTOR) | ||
535 | continue; | ||
536 | |||
533 | /* allocate per-vq irq if available and necessary */ | 537 | /* allocate per-vq irq if available and necessary */ |
534 | if (vp_dev->per_vq_vectors) { | 538 | snprintf(vp_dev->msix_names[msix_vec], |
535 | snprintf(vp_dev->msix_names[msix_vec], | 539 | sizeof *vp_dev->msix_names, |
536 | sizeof *vp_dev->msix_names, | 540 | "%s-%s", |
537 | "%s-%s", | 541 | dev_name(&vp_dev->vdev.dev), names[i]); |
538 | dev_name(&vp_dev->vdev.dev), names[i]); | 542 | err = request_irq(vp_dev->msix_entries[msix_vec].vector, |
539 | err = request_irq(msix_vec, vring_interrupt, 0, | 543 | vring_interrupt, 0, |
540 | vp_dev->msix_names[msix_vec], | 544 | vp_dev->msix_names[msix_vec], |
541 | vqs[i]); | 545 | vqs[i]); |
542 | if (err) { | 546 | if (err) { |
543 | vp_del_vq(vqs[i]); | 547 | vp_del_vq(vqs[i]); |
544 | goto error_find; | 548 | goto error_find; |
545 | } | ||
546 | } | 549 | } |
547 | } | 550 | } |
548 | return 0; | 551 | return 0; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index f53600580726..fbd2ecde93e4 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -285,6 +285,9 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len) | |||
285 | return NULL; | 285 | return NULL; |
286 | } | 286 | } |
287 | 287 | ||
288 | /* Only get used array entries after they have been exposed by host. */ | ||
289 | rmb(); | ||
290 | |||
288 | i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id; | 291 | i = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].id; |
289 | *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len; | 292 | *len = vq->vring.used->ring[vq->last_used_idx%vq->vring.num].len; |
290 | 293 | ||