0a122b
From 370fe54037a8d715db78f35d1853dbecdbcef3a0 Mon Sep 17 00:00:00 2001
0a122b
From: Juan Quintela <quintela@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 15:07:21 +0100
0a122b
Subject: [PATCH 10/40] memory: set single dirty flags when possible
0a122b
0a122b
RH-Author: Juan Quintela <quintela@redhat.com>
0a122b
Message-id: <1389712071-23303-11-git-send-email-quintela@redhat.com>
0a122b
Patchwork-id: 56661
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 10/40] memory: set single dirty flags when possible
0a122b
Bugzilla: 997559
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
0a122b
0a122b
Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
0a122b
(cherry picked from commit 63995cebfaa283586682ea6236c9686b2a49ece7)
0a122b
Signed-off-by: Juan Quintela <quintela@trasno.org>
0a122b
---
0a122b
 exec.c                         | 7 ++++---
0a122b
 include/exec/memory-internal.h | 4 +++-
0a122b
 2 files changed, 7 insertions(+), 4 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 exec.c                         |    7 ++++---
0a122b
 include/exec/memory-internal.h |    4 +++-
0a122b
 2 files changed, 7 insertions(+), 4 deletions(-)
0a122b
0a122b
diff --git a/exec.c b/exec.c
0a122b
index ea81329..178ed4a 100644
0a122b
--- a/exec.c
0a122b
+++ b/exec.c
0a122b
@@ -1919,7 +1919,8 @@ static void invalidate_and_set_dirty(hwaddr addr,
0a122b
         /* invalidate code */
0a122b
         tb_invalidate_phys_page_range(addr, addr + length, 0);
0a122b
         /* set dirty bit */
0a122b
-        cpu_physical_memory_set_dirty_flags(addr, (0xff & ~CODE_DIRTY_FLAG));
0a122b
+        cpu_physical_memory_set_dirty_flag(addr, VGA_DIRTY_FLAG);
0a122b
+        cpu_physical_memory_set_dirty_flag(addr, MIGRATION_DIRTY_FLAG);
0a122b
     }
0a122b
     xen_modified_memory(addr, length);
0a122b
 }
0a122b
@@ -2434,8 +2435,8 @@ void stl_phys_notdirty(hwaddr addr, uint32_t val)
0a122b
                 /* invalidate code */
0a122b
                 tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);
0a122b
                 /* set dirty bit */
0a122b
-                cpu_physical_memory_set_dirty_flags(
0a122b
-                    addr1, (0xff & ~CODE_DIRTY_FLAG));
0a122b
+                cpu_physical_memory_set_dirty_flag(addr1, MIGRATION_DIRTY_FLAG);
0a122b
+                cpu_physical_memory_set_dirty_flag(addr1, VGA_DIRTY_FLAG);
0a122b
             }
0a122b
         }
0a122b
     }
0a122b
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
0a122b
index 571a5ef..55b4022 100644
0a122b
--- a/include/exec/memory-internal.h
0a122b
+++ b/include/exec/memory-internal.h
0a122b
@@ -98,7 +98,9 @@ static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
0a122b
 
0a122b
 static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
0a122b
 {
0a122b
-    cpu_physical_memory_set_dirty_flags(addr, 0xff);
0a122b
+    cpu_physical_memory_set_dirty_flag(addr, MIGRATION_DIRTY_FLAG);
0a122b
+    cpu_physical_memory_set_dirty_flag(addr, VGA_DIRTY_FLAG);
0a122b
+    cpu_physical_memory_set_dirty_flag(addr, CODE_DIRTY_FLAG);
0a122b
 }
0a122b
 
0a122b
 static inline int cpu_physical_memory_clear_dirty_flags(ram_addr_t addr,
0a122b
-- 
0a122b
1.7.1
0a122b