[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 16/47] ivshmem: remove max_peer field
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v4 16/47] ivshmem: remove max_peer field |
Date: |
Thu, 24 Sep 2015 13:37:18 +0200 |
From: Marc-André Lureau <address@hidden>
max_peer isn't really useful, it tracks the maximum received VM id, but
that quickly matches nb_peers, the size of the peers array. Since VM
come and go, there might be sparse peers so it doesn't help much in
general to have this value around.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/misc/ivshmem.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 0716deb..c4c130d 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -90,7 +90,6 @@ typedef struct IVShmemState {
Peer *peers;
int nb_peers; /* how many guests we have space for */
- int max_peer; /* maximum numbered peer */
int vm_id;
uint32_t vectors;
@@ -200,7 +199,7 @@ static void ivshmem_io_write(void *opaque, hwaddr addr,
case DOORBELL:
/* check that dest VM ID is reasonable */
- if (dest > s->max_peer) {
+ if (dest >= s->nb_peers) {
IVSHMEM_DPRINTF("Invalid destination VM ID (%d)\n", dest);
break;
}
@@ -574,11 +573,6 @@ static void ivshmem_read(void *opaque, const uint8_t *buf,
int size)
/* increment count for particular guest */
s->peers[incoming_posn].nb_eventfds++;
- /* keep track of the maximum VM ID */
- if (incoming_posn > s->max_peer) {
- s->max_peer = incoming_posn;
- }
-
if (incoming_posn == s->vm_id) {
s->eventfd_chr[guest_max_eventfd] = create_eventfd_chr_device(s,
&s->peers[s->vm_id].eventfds[guest_max_eventfd],
@@ -721,8 +715,6 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error
**errp)
PCI_BASE_ADDRESS_MEM_PREFETCH;
Error *local_err = NULL;
- s->max_peer = -1;
-
if (s->sizearg == NULL) {
s->ivshmem_size = 4 << 20; /* 4 MB default */
} else {
--
2.4.3
- [Qemu-devel] [PATCH v4 04/47] ivshmem: fix number of bytes to push to fifo, (continued)
- [Qemu-devel] [PATCH v4 04/47] ivshmem: fix number of bytes to push to fifo, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 06/47] ivshmem: remove unnecessary dup(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 07/47] ivshmem: remove superflous ivshmem_attr field, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 08/47] ivshmem: remove useless doorbell field, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 10/47] ivshmem: remove last exit(1), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 09/47] ivshmem: more qdev conversion, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 11/47] ivshmem: limit maximum number of peers to G_MAXUINT16, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 12/47] ivshmem: simplify around increase_dynamic_storage(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 14/47] ivshmem: remove useless ivshmem_update_irq() val argument, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 13/47] ivshmem: allocate eventfds in resize_peers(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 16/47] ivshmem: remove max_peer field,
marcandre . lureau <=
- [Qemu-devel] [PATCH v4 15/47] ivshmem: initialize max_peer to -1, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 17/47] ivshmem: improve debug messages, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 18/47] ivshmem: improve error handling, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 19/47] ivshmem: print error on invalid peer id, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 20/47] ivshmem: simplify a bit the code, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 21/47] ivshmem: use common return, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 22/47] ivshmem: use common is_power_of_2(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 23/47] ivshmem: migrate with VMStateDescription, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 25/47] ivshmem: check shm isn't already initialized, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 24/47] ivshmem: shmfd can be 0, marcandre . lureau, 2015/09/24