diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 |
| commit | ab8cd81830fef799177740d5ab709c0341e9ba5c (patch) | |
| tree | 40c27d1cd27a436ec195174a105fa27c223ed6dd /drivers/virtio | |
| parent | f8356ed00ebcdc2f209504c02b4ab8ba9a8a7ebe (diff) | |
| parent | 20887611523e749d99cc7d64ff6c97d27529fbae (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:
lguest: notify on empty
virtio: force callback on empty.
virtio_blk: fix endianess annotations
virtio_config: fix len calculation of config elements
virtio_net: another race with virtio_net and enable_cb
virtio: An entropy device, as suggested by hpa.
virtio_blk: allow read-only disks
lguest: fix ugly <NULL> in /proc/interrupts
virtio: set device index in common code.
virtio: virtio_pci should not set bus_id.
virtio: bus_id for devices should contain 'virtio'
Fix crash in virtio_blk during modprobe ; rmmod ; modprobe
lguest: use ioremap_cache, not ioremap
Diffstat (limited to 'drivers/virtio')
| -rw-r--r-- | drivers/virtio/virtio.c | 8 | ||||
| -rw-r--r-- | drivers/virtio/virtio_pci.c | 7 | ||||
| -rw-r--r-- | drivers/virtio/virtio_ring.c | 8 |
3 files changed, 7 insertions, 16 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 13866789b356..0f3c2bb7bf35 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
| 3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
| 4 | 4 | ||
| 5 | /* Unique numbering for virtio devices. */ | ||
| 6 | static unsigned int dev_index; | ||
| 7 | |||
| 5 | static ssize_t device_show(struct device *_d, | 8 | static ssize_t device_show(struct device *_d, |
| 6 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
| 7 | { | 10 | { |
| @@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev) | |||
| 166 | int err; | 169 | int err; |
| 167 | 170 | ||
| 168 | dev->dev.bus = &virtio_bus; | 171 | dev->dev.bus = &virtio_bus; |
| 169 | sprintf(dev->dev.bus_id, "%u", dev->index); | 172 | |
| 173 | /* Assign a unique device index and hence name. */ | ||
| 174 | dev->index = dev_index++; | ||
| 175 | sprintf(dev->dev.bus_id, "virtio%u", dev->index); | ||
| 170 | 176 | ||
| 171 | /* We always start by resetting the device, in case a previous | 177 | /* We always start by resetting the device, in case a previous |
| 172 | * driver messed it up. This also tests that code path a little. */ | 178 | * driver messed it up. This also tests that code path a little. */ |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 27e9fc9117cd..eae7236310e4 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -78,9 +78,6 @@ static struct device virtio_pci_root = { | |||
| 78 | .bus_id = "virtio-pci", | 78 | .bus_id = "virtio-pci", |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | /* Unique numbering for devices under the kvm root */ | ||
| 82 | static unsigned int dev_index; | ||
| 83 | |||
| 84 | /* Convert a generic virtio device to our structure */ | 81 | /* Convert a generic virtio device to our structure */ |
| 85 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) | 82 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) |
| 86 | { | 83 | { |
| @@ -325,10 +322,6 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
| 325 | if (vp_dev == NULL) | 322 | if (vp_dev == NULL) |
| 326 | return -ENOMEM; | 323 | return -ENOMEM; |
| 327 | 324 | ||
| 328 | snprintf(vp_dev->vdev.dev.bus_id, BUS_ID_SIZE, "virtio%d", dev_index); | ||
| 329 | vp_dev->vdev.index = dev_index; | ||
| 330 | dev_index++; | ||
| 331 | |||
| 332 | vp_dev->vdev.dev.parent = &virtio_pci_root; | 325 | vp_dev->vdev.dev.parent = &virtio_pci_root; |
| 333 | vp_dev->vdev.config = &virtio_pci_config_ops; | 326 | vp_dev->vdev.config = &virtio_pci_config_ops; |
| 334 | vp_dev->pci_dev = pci_dev; | 327 | vp_dev->pci_dev = pci_dev; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 937a49d6772c..72bf8bc09014 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -227,7 +227,6 @@ static bool vring_enable_cb(struct virtqueue *_vq) | |||
| 227 | struct vring_virtqueue *vq = to_vvq(_vq); | 227 | struct vring_virtqueue *vq = to_vvq(_vq); |
| 228 | 228 | ||
| 229 | START_USE(vq); | 229 | START_USE(vq); |
| 230 | BUG_ON(!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)); | ||
| 231 | 230 | ||
| 232 | /* We optimistically turn back on interrupts, then check if there was | 231 | /* We optimistically turn back on interrupts, then check if there was |
| 233 | * more to do. */ | 232 | * more to do. */ |
| @@ -254,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq) | |||
| 254 | if (unlikely(vq->broken)) | 253 | if (unlikely(vq->broken)) |
| 255 | return IRQ_HANDLED; | 254 | return IRQ_HANDLED; |
| 256 | 255 | ||
| 257 | /* Other side may have missed us turning off the interrupt, | ||
| 258 | * but we should preserve disable semantic for virtio users. */ | ||
| 259 | if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { | ||
| 260 | pr_debug("virtqueue interrupt after disable for %p\n", vq); | ||
| 261 | return IRQ_HANDLED; | ||
| 262 | } | ||
| 263 | |||
| 264 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); | 256 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); |
| 265 | if (vq->vq.callback) | 257 | if (vq->vq.callback) |
| 266 | vq->vq.callback(&vq->vq); | 258 | vq->vq.callback(&vq->vq); |
