summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2015-07-24 18:52:19 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2015-10-26 10:19:53 +0100
commitd160f3f7911bb1f99235ae211269c8f4422f2079 (patch)
treee89a9501b69e47d6aa1b83d73b2deadad4511178
parentd9453c93fea0c9c67f9c63bfa79a87631317d746 (diff)
downloadqemu-d160f3f7911bb1f99235ae211269c8f4422f2079.tar.gz
qemu-d160f3f7911bb1f99235ae211269c8f4422f2079.tar.bz2
qemu-d160f3f7911bb1f99235ae211269c8f4422f2079.zip
ivshmem: remove EventfdEntry.vector
No need to store an extra int for the vector number when it can be computed easily by looking at the position in the array. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
-rw-r--r--hw/misc/ivshmem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 6aa095ae47..4fa2ad4a0a 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -68,7 +68,6 @@ typedef struct Peer {
typedef struct EventfdEntry {
PCIDevice *pdev;
- int vector;
} EventfdEntry;
typedef struct IVShmemState {
@@ -287,9 +286,11 @@ static void fake_irqfd(void *opaque, const uint8_t *buf, int size) {
EventfdEntry *entry = opaque;
PCIDevice *pdev = entry->pdev;
+ IVShmemState *s = IVSHMEM(pdev);
+ int vector = entry - s->eventfd_table;
- IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, entry->vector);
- msix_notify(pdev, entry->vector);
+ IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, vector);
+ msix_notify(pdev, vector);
}
static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *n,
@@ -311,7 +312,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *
/* if MSI is supported we need multiple interrupts */
if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
s->eventfd_table[vector].pdev = PCI_DEVICE(s);
- s->eventfd_table[vector].vector = vector;
qemu_chr_add_handlers(chr, ivshmem_can_receive, fake_irqfd,
ivshmem_event, &s->eventfd_table[vector]);