Blame SOURCES/kvm-exec-create-function-to-get-a-single-dirty-bit.patch

0a122b
From c3347218d224591fe59debbf2006811b418f9070 Mon Sep 17 00:00:00 2001
0a122b
From: Juan Quintela <quintela@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 15:07:18 +0100
0a122b
Subject: [PATCH 07/40] exec: create function to get a single dirty bit
0a122b
0a122b
RH-Author: Juan Quintela <quintela@redhat.com>
0a122b
Message-id: <1389712071-23303-8-git-send-email-quintela@redhat.com>
0a122b
Patchwork-id: 56663
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 07/40] exec: create function to get a single dirty bit
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 7e5609a85e3f35965af5e4c7b1480254642cf2dd)
0a122b
Signed-off-by: Juan Quintela <quintela@trasno.org>
0a122b
---
0a122b
 exec.c                         | 2 +-
0a122b
 include/exec/memory-internal.h | 6 ++++++
0a122b
 2 files changed, 7 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 exec.c                         |    2 +-
0a122b
 include/exec/memory-internal.h |    6 ++++++
0a122b
 2 files changed, 7 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/exec.c b/exec.c
0a122b
index 436dbe9..e993049 100644
0a122b
--- a/exec.c
0a122b
+++ b/exec.c
0a122b
@@ -1482,7 +1482,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
0a122b
 {
0a122b
     int dirty_flags;
0a122b
     dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
0a122b
-    if (!(dirty_flags & CODE_DIRTY_FLAG)) {
0a122b
+    if (!cpu_physical_memory_get_dirty_flag(ram_addr, CODE_DIRTY_FLAG)) {
0a122b
         tb_invalidate_phys_page_fast(ram_addr, size);
0a122b
         dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
0a122b
     }
0a122b
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
0a122b
index 4f476d2..8872e36 100644
0a122b
--- a/include/exec/memory-internal.h
0a122b
+++ b/include/exec/memory-internal.h
0a122b
@@ -58,6 +58,12 @@ static inline int cpu_physical_memory_get_dirty_flags(ram_addr_t addr)
0a122b
     return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS];
0a122b
 }
0a122b
 
0a122b
+static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr,
0a122b
+                                                      int dirty_flag)
0a122b
+{
0a122b
+    return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] & dirty_flag;
0a122b
+}
0a122b
+
0a122b
 /* read dirty bit (return 0 or 1) */
0a122b
 static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
0a122b
 {
0a122b
-- 
0a122b
1.7.1
0a122b