diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:24:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-16 05:24:17 -0400 |
commit | 9583f3d9c00974911daf227cbaa12d6c1caaabad (patch) | |
tree | f37466204ecbfea37c7d567fd06c9bece0cc663d /drivers/virtio | |
parent | 962cf36c5bf6d2840b8d66ee9a606fae2f540bbd (diff) | |
parent | 066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff) |
Merge branch 'linus' into core/softirq
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio.c | 10 | ||||
-rw-r--r-- | drivers/virtio/virtio_pci.c | 7 | ||||
-rw-r--r-- | drivers/virtio/virtio_ring.c | 8 |
3 files changed, 8 insertions, 17 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 13866789b356..7084e7e146c0 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 | { |
@@ -121,9 +124,9 @@ static int virtio_dev_probe(struct device *_d) | |||
121 | if (err) | 124 | if (err) |
122 | add_status(dev, VIRTIO_CONFIG_S_FAILED); | 125 | add_status(dev, VIRTIO_CONFIG_S_FAILED); |
123 | else { | 126 | else { |
124 | add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); | ||
125 | /* They should never have set feature bits beyond 32 */ | 127 | /* They should never have set feature bits beyond 32 */ |
126 | dev->config->set_features(dev, dev->features[0]); | 128 | dev->config->set_features(dev, dev->features[0]); |
129 | add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); | ||
127 | } | 130 | } |
128 | return err; | 131 | return err; |
129 | } | 132 | } |
@@ -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); |