aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorElena Afanasova <eafanasova@gmail.com>2020-10-19 13:20:13 -0700
committerStefan Hajnoczi <stefanha@redhat.com>2020-11-03 18:55:13 +0000
commite6ffd757829a0dcff649c99e6304a287cc6d0d27 (patch)
treedeec26fda8e992c40a71d76d1828fd297aeac374 /softmmu
parentf9b49088952ddb6de6e9c2e5822a5e15434abc3b (diff)
downloadqemu-e6ffd757829a0dcff649c99e6304a287cc6d0d27.zip
qemu-e6ffd757829a0dcff649c99e6304a287cc6d0d27.tar.gz
qemu-e6ffd757829a0dcff649c99e6304a287cc6d0d27.tar.bz2
softmmu/memory: fix memory_region_ioeventfd_equal()
Eventfd can be registered with a zero length when fast_mmio is true. Handle this case properly when dispatching through QEMU. Signed-off-by: Elena Afanasova <eafanasova@gmail.com> Message-id: cf71a62eb04e61932ff8ffdd02e0b2aab4f495a0.camel@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/memory.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 21d533d..8aba411 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -205,8 +205,15 @@ static bool memory_region_ioeventfd_before(MemoryRegionIoeventfd *a,
static bool memory_region_ioeventfd_equal(MemoryRegionIoeventfd *a,
MemoryRegionIoeventfd *b)
{
- return !memory_region_ioeventfd_before(a, b)
- && !memory_region_ioeventfd_before(b, a);
+ if (int128_eq(a->addr.start, b->addr.start) &&
+ (!int128_nz(a->addr.size) || !int128_nz(b->addr.size) ||
+ (int128_eq(a->addr.size, b->addr.size) &&
+ (a->match_data == b->match_data) &&
+ ((a->match_data && (a->data == b->data)) || !a->match_data) &&
+ (a->e == b->e))))
+ return true;
+
+ return false;
}
/* Range of memory in the global map. Addresses are absolute. */