yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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