aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-04-22 07:34:25 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2008-04-22 07:34:25 -0400
commitf838bad1b3be8ca0c785ee0e0c570dfda74cf377 (patch)
tree5a842a8056a708cfad55a20fa8ab733dd94b0903 /drivers/virtio
parentdd919660aacdf4adfcd279556aa03e595f7f0fc2 (diff)
parent807501475fce0ebe68baedf87f202c3e4ee0d12c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_balloon.c4
-rw-r--r--drivers/virtio/virtio_pci.c22
-rw-r--r--drivers/virtio/virtio_ring.c4
3 files changed, 15 insertions, 15 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index c8a4332d1132..0b3efc31ee6d 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev)
152 wake_up(&vb->config_change); 152 wake_up(&vb->config_change);
153} 153}
154 154
155static inline int towards_target(struct virtio_balloon *vb) 155static inline s64 towards_target(struct virtio_balloon *vb)
156{ 156{
157 u32 v; 157 u32 v;
158 __virtio_config_val(vb->vdev, 158 __virtio_config_val(vb->vdev,
@@ -176,7 +176,7 @@ static int balloon(void *_vballoon)
176 176
177 set_freezable(); 177 set_freezable();
178 while (!kthread_should_stop()) { 178 while (!kthread_should_stop()) {
179 int diff; 179 s64 diff;
180 180
181 try_to_freeze(); 181 try_to_freeze();
182 wait_event_interruptible(vb->config_change, 182 wait_event_interruptible(vb->config_change,
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 26f787ddd5ff..c0df924766a7 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -37,7 +37,7 @@ struct virtio_pci_device
37 struct pci_dev *pci_dev; 37 struct pci_dev *pci_dev;
38 38
39 /* the IO mapping for the PCI config space */ 39 /* the IO mapping for the PCI config space */
40 void *ioaddr; 40 void __iomem *ioaddr;
41 41
42 /* a list of queues so we can dispatch IRQs */ 42 /* a list of queues so we can dispatch IRQs */
43 spinlock_t lock; 43 spinlock_t lock;
@@ -111,7 +111,7 @@ static void vp_get(struct virtio_device *vdev, unsigned offset,
111 void *buf, unsigned len) 111 void *buf, unsigned len)
112{ 112{
113 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 113 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
114 void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; 114 void __iomem *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset;
115 u8 *ptr = buf; 115 u8 *ptr = buf;
116 int i; 116 int i;
117 117
@@ -125,7 +125,7 @@ static void vp_set(struct virtio_device *vdev, unsigned offset,
125 const void *buf, unsigned len) 125 const void *buf, unsigned len)
126{ 126{
127 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 127 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
128 void *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset; 128 void __iomem *ioaddr = vp_dev->ioaddr + VIRTIO_PCI_CONFIG + offset;
129 const u8 *ptr = buf; 129 const u8 *ptr = buf;
130 int i; 130 int i;
131 131
@@ -177,6 +177,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
177 struct virtio_pci_device *vp_dev = opaque; 177 struct virtio_pci_device *vp_dev = opaque;
178 struct virtio_pci_vq_info *info; 178 struct virtio_pci_vq_info *info;
179 irqreturn_t ret = IRQ_NONE; 179 irqreturn_t ret = IRQ_NONE;
180 unsigned long flags;
180 u8 isr; 181 u8 isr;
181 182
182 /* reading the ISR has the effect of also clearing it so it's very 183 /* reading the ISR has the effect of also clearing it so it's very
@@ -197,12 +198,12 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
197 drv->config_changed(&vp_dev->vdev); 198 drv->config_changed(&vp_dev->vdev);
198 } 199 }
199 200
200 spin_lock(&vp_dev->lock); 201 spin_lock_irqsave(&vp_dev->lock, flags);
201 list_for_each_entry(info, &vp_dev->virtqueues, node) { 202 list_for_each_entry(info, &vp_dev->virtqueues, node) {
202 if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) 203 if (vring_interrupt(irq, info->vq) == IRQ_HANDLED)
203 ret = IRQ_HANDLED; 204 ret = IRQ_HANDLED;
204 } 205 }
205 spin_unlock(&vp_dev->lock); 206 spin_unlock_irqrestore(&vp_dev->lock, flags);
206 207
207 return ret; 208 return ret;
208} 209}
@@ -214,6 +215,7 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
214 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 215 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
215 struct virtio_pci_vq_info *info; 216 struct virtio_pci_vq_info *info;
216 struct virtqueue *vq; 217 struct virtqueue *vq;
218 unsigned long flags;
217 u16 num; 219 u16 num;
218 int err; 220 int err;
219 221
@@ -255,9 +257,9 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
255 vq->priv = info; 257 vq->priv = info;
256 info->vq = vq; 258 info->vq = vq;
257 259
258 spin_lock(&vp_dev->lock); 260 spin_lock_irqsave(&vp_dev->lock, flags);
259 list_add(&info->node, &vp_dev->virtqueues); 261 list_add(&info->node, &vp_dev->virtqueues);
260 spin_unlock(&vp_dev->lock); 262 spin_unlock_irqrestore(&vp_dev->lock, flags);
261 263
262 return vq; 264 return vq;
263 265
@@ -274,10 +276,11 @@ static void vp_del_vq(struct virtqueue *vq)
274{ 276{
275 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); 277 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
276 struct virtio_pci_vq_info *info = vq->priv; 278 struct virtio_pci_vq_info *info = vq->priv;
279 unsigned long flags;
277 280
278 spin_lock(&vp_dev->lock); 281 spin_lock_irqsave(&vp_dev->lock, flags);
279 list_del(&info->node); 282 list_del(&info->node);
280 spin_unlock(&vp_dev->lock); 283 spin_unlock_irqrestore(&vp_dev->lock, flags);
281 284
282 vring_del_virtqueue(vq); 285 vring_del_virtqueue(vq);
283 286
@@ -385,6 +388,7 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev)
385{ 388{
386 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); 389 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
387 390
391 unregister_virtio_device(&vp_dev->vdev);
388 free_irq(pci_dev->irq, vp_dev); 392 free_irq(pci_dev->irq, vp_dev);
389 pci_set_drvdata(pci_dev, NULL); 393 pci_set_drvdata(pci_dev, NULL);
390 pci_iounmap(pci_dev, vp_dev->ioaddr); 394 pci_iounmap(pci_dev, vp_dev->ioaddr);
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 3a28c1382131..c2fa5c630813 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -214,10 +214,7 @@ static void vring_disable_cb(struct virtqueue *_vq)
214{ 214{
215 struct vring_virtqueue *vq = to_vvq(_vq); 215 struct vring_virtqueue *vq = to_vvq(_vq);
216 216
217 START_USE(vq);
218 BUG_ON(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
219 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; 217 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
220 END_USE(vq);
221} 218}
222 219
223static bool vring_enable_cb(struct virtqueue *_vq) 220static bool vring_enable_cb(struct virtqueue *_vq)
@@ -232,7 +229,6 @@ static bool vring_enable_cb(struct virtqueue *_vq)
232 vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; 229 vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
233 mb(); 230 mb();
234 if (unlikely(more_used(vq))) { 231 if (unlikely(more_used(vq))) {
235 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
236 END_USE(vq); 232 END_USE(vq);
237 return false; 233 return false;
238 } 234 }