Let's make sure to not merge when different memory regions are involved.
Unlikely, but theoretically possible.

Cc: Marc-AndrĂ© Lureau <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: Claudio Fontana <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: "Alex BennĂ©e" <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: Stefan Berger <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
---
 softmmu/memory_mapping.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c
index 2677392de7..ad4911427a 100644
--- a/softmmu/memory_mapping.c
+++ b/softmmu/memory_mapping.c
@@ -230,7 +230,8 @@ static void guest_phys_blocks_region_add(MemoryListener 
*listener,
 
         /* we want continuity in both guest-physical and host-virtual memory */
         if (predecessor->target_end < target_start ||
-            predecessor->host_addr + predecessor_size != host_addr) {
+            predecessor->host_addr + predecessor_size != host_addr ||
+            predecessor->mr != section->mr) {
             predecessor = NULL;
         }
     }
-- 
2.29.2


Reply via email to