aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorHeinz Graalfs <graalfs@linux.vnet.ibm.com>2013-10-28 19:08:50 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-10-28 20:58:11 -0400
commit46f9c2b925ac12e5ad8b8b7c90c71dacc9d5db37 (patch)
tree39b9bd752cb3cb43a5e11d4f0fc35f425f1d02e2 /drivers/virtio
parent630b54d33493d1f67e79b148b5e361c5bbd3f29d (diff)
virtio_ring: change host notification API
Currently a host kick error is silently ignored and not reflected in the virtqueue of a particular virtio device. Changing the notify API for guest->host notification seems to be one prerequisite in order to be able to handle such errors in the context where the kick is triggered. This patch changes the notify API. The notify function must return a bool return value. It returns false if the host notification failed. Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio_mmio.c3
-rw-r--r--drivers/virtio/virtio_pci.c3
-rw-r--r--drivers/virtio/virtio_ring.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 1ba0d6831015..e9fdeb861992 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -219,13 +219,14 @@ static void vm_reset(struct virtio_device *vdev)
219/* Transport interface */ 219/* Transport interface */
220 220
221/* the notify function used when creating a virt queue */ 221/* the notify function used when creating a virt queue */
222static void vm_notify(struct virtqueue *vq) 222static bool vm_notify(struct virtqueue *vq)
223{ 223{
224 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); 224 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev);
225 225
226 /* We write the queue's selector into the notification register to 226 /* We write the queue's selector into the notification register to
227 * signal the other end */ 227 * signal the other end */
228 writel(vq->index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); 228 writel(vq->index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY);
229 return true;
229} 230}
230 231
231/* Notify all virtqueues on an interrupt. */ 232/* Notify all virtqueues on an interrupt. */
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 98917fc872a4..a37c69941d30 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -197,13 +197,14 @@ static void vp_reset(struct virtio_device *vdev)
197} 197}
198 198
199/* the notify function used when creating a virt queue */ 199/* the notify function used when creating a virt queue */
200static void vp_notify(struct virtqueue *vq) 200static bool vp_notify(struct virtqueue *vq)
201{ 201{
202 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); 202 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
203 203
204 /* we write the queue's selector into the notification register to 204 /* we write the queue's selector into the notification register to
205 * signal the other end */ 205 * signal the other end */
206 iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); 206 iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY);
207 return true;
207} 208}
208 209
209/* Handle a configuration change: Tell driver if it wants to know. */ 210/* Handle a configuration change: Tell driver if it wants to know. */
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 6547d46171b3..97dd51619b55 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -81,7 +81,7 @@ struct vring_virtqueue
81 u16 last_used_idx; 81 u16 last_used_idx;
82 82
83 /* How to notify other side. FIXME: commonalize hcalls! */ 83 /* How to notify other side. FIXME: commonalize hcalls! */
84 void (*notify)(struct virtqueue *vq); 84 bool (*notify)(struct virtqueue *vq);
85 85
86#ifdef DEBUG 86#ifdef DEBUG
87 /* They're supposed to lock for us. */ 87 /* They're supposed to lock for us. */
@@ -744,7 +744,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int index,
744 struct virtio_device *vdev, 744 struct virtio_device *vdev,
745 bool weak_barriers, 745 bool weak_barriers,
746 void *pages, 746 void *pages,
747 void (*notify)(struct virtqueue *), 747 bool (*notify)(struct virtqueue *),
748 void (*callback)(struct virtqueue *), 748 void (*callback)(struct virtqueue *),
749 const char *name) 749 const char *name)
750{ 750{