From: Elena Afanasova <eafanasova@gmail.com>
To: qemu-devel@nongnu.org
Cc: Elena Afanasova <eafanasova@gmail.com>,
pbonzini@redhat.com, stefanha@redhat.com
Subject: [PATCH] softmmu/memory: fix memory_region_ioeventfd_equal()
Date: Sat, 17 Oct 2020 14:01:02 -0700 [thread overview]
Message-ID: <20201017210102.26036-2-eafanasova@gmail.com> (raw)
In-Reply-To: <20201017210102.26036-1-eafanasova@gmail.com>
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>
---
softmmu/memory.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 403ff3abc9..3ca2154a64 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -203,10 +203,17 @@ 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);
+ MemoryRegionIoeventfd *mrb)
+{
+ if (int128_eq(a->addr.start, mrb->addr.start) &&
+ (!int128_nz(mrb->addr.size) ||
+ int128_eq(a->addr.size, mrb->addr.size)) &&
+ (a->match_data == mrb->match_data) &&
+ ((mrb->match_data && (a->data == mrb->data)) || !mrb->match_data) &&
+ (a->e == mrb->e))
+ return true;
+
+ return false;
}
/* Range of memory in the global map. Addresses are absolute. */
--
2.25.1
next prev parent reply other threads:[~2020-10-17 21:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-17 21:01 [PATCH] accel/kvm: add PIO ioeventfds only in case kvm_eventfds_allowed is true Elena Afanasova
2020-10-17 21:01 ` Elena Afanasova [this message]
2020-10-19 10:25 ` [PATCH] softmmu/memory: fix memory_region_ioeventfd_equal() Stefan Hajnoczi
2020-10-19 10:05 ` [PATCH] accel/kvm: add PIO ioeventfds only in case kvm_eventfds_allowed is true Stefan Hajnoczi
2020-10-20 15:40 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201017210102.26036-2-eafanasova@gmail.com \
--to=eafanasova@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).