qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] softmmu/memory: fix memory_region_ioeventfd_equal()
@ 2020-10-19 20:20 Elena Afanasova
  2020-10-20 15:40 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Elena Afanasova @ 2020-10-19 20:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, stefanha

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 | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/softmmu/memory.c b/softmmu/memory.c
index 403ff3abc9..4b5775ae5b 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. */
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] softmmu/memory: fix memory_region_ioeventfd_equal()
  2020-10-19 20:20 [PATCH v2] softmmu/memory: fix memory_region_ioeventfd_equal() Elena Afanasova
@ 2020-10-20 15:40 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2020-10-20 15:40 UTC (permalink / raw)
  To: Elena Afanasova; +Cc: pbonzini, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

On Mon, Oct 19, 2020 at 01:20:13PM -0700, Elena Afanasova wrote:
> 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 | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-20 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 20:20 [PATCH v2] softmmu/memory: fix memory_region_ioeventfd_equal() Elena Afanasova
2020-10-20 15:40 ` Stefan Hajnoczi

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).