mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-30 21:42:06 -06:00
ivshmem: remove max_peer field
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 <marcandre.lureau@redhat.com> Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
This commit is contained in:
parent
95e7c8a0f6
commit
95c8425cc3
1 changed files with 1 additions and 9 deletions
|
@ -90,7 +90,6 @@ typedef struct IVShmemState {
|
||||||
|
|
||||||
Peer *peers;
|
Peer *peers;
|
||||||
int nb_peers; /* how many guests we have space for */
|
int nb_peers; /* how many guests we have space for */
|
||||||
int max_peer; /* maximum numbered peer */
|
|
||||||
|
|
||||||
int vm_id;
|
int vm_id;
|
||||||
uint32_t vectors;
|
uint32_t vectors;
|
||||||
|
@ -200,7 +199,7 @@ static void ivshmem_io_write(void *opaque, hwaddr addr,
|
||||||
|
|
||||||
case DOORBELL:
|
case DOORBELL:
|
||||||
/* check that dest VM ID is reasonable */
|
/* 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);
|
IVSHMEM_DPRINTF("Invalid destination VM ID (%d)\n", dest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -574,11 +573,6 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size)
|
||||||
/* increment count for particular guest */
|
/* increment count for particular guest */
|
||||||
s->peers[incoming_posn].nb_eventfds++;
|
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) {
|
if (incoming_posn == s->vm_id) {
|
||||||
s->eventfd_chr[guest_max_eventfd] = create_eventfd_chr_device(s,
|
s->eventfd_chr[guest_max_eventfd] = create_eventfd_chr_device(s,
|
||||||
&s->peers[s->vm_id].eventfds[guest_max_eventfd],
|
&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;
|
PCI_BASE_ADDRESS_MEM_PREFETCH;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
s->max_peer = -1;
|
|
||||||
|
|
||||||
if (s->sizearg == NULL) {
|
if (s->sizearg == NULL) {
|
||||||
s->ivshmem_size = 4 << 20; /* 4 MB default */
|
s->ivshmem_size = 4 << 20; /* 4 MB default */
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue