diff options
author | Markus Armbruster <armbru@redhat.com> | 2016-03-15 19:34:36 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-03-21 21:29:01 +0100 |
commit | 3c27969b3e7397bb63f363fc8b8bc0e601542d76 (patch) | |
tree | af5af6db71cbb1d3a9f0db4ee15707ece05a0826 /hw | |
parent | 2d1d422d1145085fdde6a90d70cbbff7103d469b (diff) |
ivshmem: Assert interrupts are set up once
An interrupt is set up when the interrupt's file descriptor is
received. Each message applies to the next interrupt vector.
Therefore, each vector cannot be set up more than once.
ivshmem_add_kvm_msi_virq() half-heartedly tries not to rely on this by
doing nothing then, but that's not going to recover from this error
should it become possible in the future. watch_vector_notifier()
doesn't even try.
Simply assert what is the case, so we get alerted if we ever screw it
up.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <1458066895-20632-22-git-send-email-armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/misc/ivshmem.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 65e3a76870..61e21cd80c 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -349,7 +349,7 @@ static void watch_vector_notifier(IVShmemState *s, EventNotifier *n, { int eventfd = event_notifier_get_fd(n); - /* if MSI is supported we need multiple interrupts */ + assert(!s->msi_vectors[vector].pdev); s->msi_vectors[vector].pdev = PCI_DEVICE(s); qemu_set_fd_handler(eventfd, ivshmem_vector_notify, @@ -535,10 +535,7 @@ static int ivshmem_add_kvm_msi_virq(IVShmemState *s, int vector) int ret; IVSHMEM_DPRINTF("ivshmem_add_kvm_msi_virq vector:%d\n", vector); - - if (s->msi_vectors[vector].pdev != NULL) { - return 0; - } + assert(!s->msi_vectors[vector].pdev); ret = kvm_irqchip_add_msi_route(kvm_state, msg, pdev); if (ret < 0) { |