[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] dataplane/virtio-scsi: new API to enable ho
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] dataplane/virtio-scsi: new API to enable host notifiers |
Date: |
Tue, 7 Apr 2015 13:41:51 +0200 |
On Tue, 7 Apr 2015 12:46:01 +0200
"Michael S. Tsirkin" <address@hidden> wrote:
> Switch to new API.
>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> include/hw/virtio/virtio.h | 1 -
> hw/scsi/virtio-scsi-dataplane.c | 14 ++++----------
> hw/virtio/virtio.c | 8 +++++++-
> 3 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index e1cff22..7e70193 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -217,7 +217,6 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue
> *vq);
> void virtio_queue_set_host_notifier_fd_handler(VirtQueue *vq, bool assign,
> bool set_handler);
> void virtio_queue_notify_vq(VirtQueue *vq);
> -void virtio_irq(VirtQueue *vq);
Unrelated cleanup?
>
> int virtio_enable_host_notifiers(VirtIODevice *vdev, int startvq, int nvqs);
> void virtio_disable_host_notifiers(VirtIODevice *vdev, int startvq, int
> nvqs);
(...)
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index e7ee069..60d10cd 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -84,6 +84,9 @@ struct VirtQueue
>
> int inuse;
>
> + /* Host notifier enabled? */
> + bool host_notifier_enabled;
This looks to be write-only. Have you maybe mixed in some unrelated
changes?
> +
> uint16_t vector;
> void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq);
> VirtIODevice *vdev;
> @@ -813,7 +816,7 @@ void virtio_del_queue(VirtIODevice *vdev, int n)
> vdev->vq[n].vring.num = 0;
> }
>
> -void virtio_irq(VirtQueue *vq)
> +static void virtio_irq(VirtQueue *vq)
> {
> trace_virtio_irq(vq);
> vq->vdev->isr |= 0x01;
> @@ -1301,11 +1304,13 @@ int virtio_enable_host_notifiers(VirtIODevice *vdev,
> int startvq, int nvqs)
> fprintf(stderr, "vhost VQ %d notifier binding failed: %d\n", i,
> -r);
> goto fail_vq;
> }
> + vdev->vq[startvq + i].host_notifier_enabled = true;
> }
>
> return 0;
> fail_vq:
> while (--i >= 0) {
> + vdev->vq[startvq + i].host_notifier_enabled = false;
> r = k->set_host_notifier(qbus->parent, startvq + i, false);
> if (r < 0) {
> fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i,
> -r);
> @@ -1325,6 +1330,7 @@ void virtio_disable_host_notifiers(VirtIODevice *vdev,
> int startvq, int nvqs)
> int i, r;
>
> for (i = 0; i < nvqs; ++i) {
> + vdev->vq[startvq + i].host_notifier_enabled = false;
> r = k->set_host_notifier(qbus->parent, startvq + i, false);
> if (r < 0) {
> fprintf(stderr, "vhost VQ %d notifier cleanup failed: %d\n", i,
> -r);