9ae3a8
From 0ef152ec4827c61924b0e05d32e4ba44a8aa996f Mon Sep 17 00:00:00 2001
9ae3a8
From: Juan Quintela <quintela@redhat.com>
9ae3a8
Date: Tue, 14 Jan 2014 15:07:22 +0100
9ae3a8
Subject: [PATCH 11/40] memory: cpu_physical_memory_set_dirty_range() always dirty all flags
9ae3a8
9ae3a8
RH-Author: Juan Quintela <quintela@redhat.com>
9ae3a8
Message-id: <1389712071-23303-12-git-send-email-quintela@redhat.com>
9ae3a8
Patchwork-id: 56666
9ae3a8
O-Subject: [RHEL7 qemu-kvm PATCH 11/40] memory: cpu_physical_memory_set_dirty_range() always dirty all flags
9ae3a8
Bugzilla: 997559
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
9ae3a8
So remove the flag argument and do it directly.  After this change,
9ae3a8
there is nothing else using cpu_physical_memory_set_dirty_flags() so
9ae3a8
remove it.
9ae3a8
9ae3a8
Signed-off-by: Juan Quintela <quintela@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
9ae3a8
(cherry picked from commit 75218e7f2b7f052c6f44489afaf45b3ea4369f45)
9ae3a8
Signed-off-by: Juan Quintela <quintela@trasno.org>
9ae3a8
---
9ae3a8
 exec.c                         |  2 +-
9ae3a8
 include/exec/memory-internal.h | 11 ++---------
9ae3a8
 memory.c                       |  2 +-
9ae3a8
 3 files changed, 4 insertions(+), 11 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 exec.c                         |    2 +-
9ae3a8
 include/exec/memory-internal.h |   11 ++---------
9ae3a8
 memory.c                       |    2 +-
9ae3a8
 3 files changed, 4 insertions(+), 11 deletions(-)
9ae3a8
9ae3a8
diff --git a/exec.c b/exec.c
9ae3a8
index 178ed4a..069e082 100644
9ae3a8
--- a/exec.c
9ae3a8
+++ b/exec.c
9ae3a8
@@ -1162,7 +1162,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
9ae3a8
                                        last_ram_offset() >> TARGET_PAGE_BITS);
9ae3a8
     memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),
9ae3a8
            0, size >> TARGET_PAGE_BITS);
9ae3a8
-    cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff);
9ae3a8
+    cpu_physical_memory_set_dirty_range(new_block->offset, size);
9ae3a8
 
9ae3a8
     qemu_ram_setup_dump(new_block->host, size);
9ae3a8
     qemu_madvise(new_block->host, size, QEMU_MADV_HUGEPAGE);
9ae3a8
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
9ae3a8
index 55b4022..794fabd 100644
9ae3a8
--- a/include/exec/memory-internal.h
9ae3a8
+++ b/include/exec/memory-internal.h
9ae3a8
@@ -84,12 +84,6 @@ static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
9ae3a8
     return ret;
9ae3a8
 }
9ae3a8
 
9ae3a8
-static inline void cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
9ae3a8
-                                                      int dirty_flags)
9ae3a8
-{
9ae3a8
-    ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
9ae3a8
-}
9ae3a8
-
9ae3a8
 static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
9ae3a8
                                                       int dirty_flag)
9ae3a8
 {
9ae3a8
@@ -112,15 +106,14 @@ static inline int cpu_physical_memory_clear_dirty_flags(ram_addr_t addr,
9ae3a8
 }
9ae3a8
 
9ae3a8
 static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
9ae3a8
-                                                       ram_addr_t length,
9ae3a8
-                                                       int dirty_flags)
9ae3a8
+                                                       ram_addr_t length)
9ae3a8
 {
9ae3a8
     ram_addr_t addr, end;
9ae3a8
 
9ae3a8
     end = TARGET_PAGE_ALIGN(start + length);
9ae3a8
     start &= TARGET_PAGE_MASK;
9ae3a8
     for (addr = start; addr < end; addr += TARGET_PAGE_SIZE) {
9ae3a8
-        cpu_physical_memory_set_dirty_flags(addr, dirty_flags);
9ae3a8
+        cpu_physical_memory_set_dirty(addr);
9ae3a8
     }
9ae3a8
     xen_modified_memory(addr, length);
9ae3a8
 }
9ae3a8
diff --git a/memory.c b/memory.c
9ae3a8
index fc11859..e7a454f 100644
9ae3a8
--- a/memory.c
9ae3a8
+++ b/memory.c
9ae3a8
@@ -1078,7 +1078,7 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
9ae3a8
                              hwaddr size)
9ae3a8
 {
9ae3a8
     assert(mr->terminates);
9ae3a8
-    cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
9ae3a8
+    cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size);
9ae3a8
 }
9ae3a8
 
9ae3a8
 bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8