Blame SOURCES/kvm-memory-s-dirty-clean-in-cpu_physical_memory_is_dirty.patch

0a122b
From 8683104151659e4d210bdeb2eaf9da667b005fd2 Mon Sep 17 00:00:00 2001
0a122b
From: Juan Quintela <quintela@redhat.com>
0a122b
Date: Tue, 14 Jan 2014 15:07:39 +0100
0a122b
Subject: [PATCH 28/40] memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
0a122b
0a122b
RH-Author: Juan Quintela <quintela@redhat.com>
0a122b
Message-id: <1389712071-23303-29-git-send-email-quintela@redhat.com>
0a122b
Patchwork-id: 56682
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 28/40] memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
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
All uses except one really want the other meaning.
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 a2cd8c852d2d8c2a084b68b2470f214d6726f6d2)
0a122b
0a122b
Conflicts:
0a122b
	cputlb.c
0a122b
	exec.c
0a122b
0a122b
Missing upstream commit:
0a122b
0a122b
commit 149f54b53b7666a3facd45e86eece60ce7d3b114
0a122b
Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Date:   Fri May 24 12:59:37 2013 +0200
0a122b
0a122b
    memory: add address_space_translate
0a122b
0a122b
and
0a122b
0a122b
commit 0cac1b66c88c4cd3ec1d358091486787837215a3
0a122b
Author: Blue Swirl <blauwirbel@gmail.com>
0a122b
Date:   Mon Apr 9 16:50:52 2012 +0000
0a122b
0a122b
    cputlb: move TLB handling to a separate file
0a122b
0a122b
is what remove tlb_udate_dirty() that we have to change
0a122b
0a122b
Signed-off-by: Juan Quintela <quintela@trasno.org>
0a122b
---
0a122b
 cputlb.c                       | 4 ++--
0a122b
 exec.c                         | 6 +++---
0a122b
 include/exec/memory-internal.h | 5 ++---
0a122b
 3 files changed, 7 insertions(+), 8 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 cputlb.c                       |    4 ++--
0a122b
 exec.c                         |    6 +++---
0a122b
 include/exec/memory-internal.h |    5 ++---
0a122b
 3 files changed, 7 insertions(+), 8 deletions(-)
0a122b
0a122b
diff --git a/cputlb.c b/cputlb.c
0a122b
index 9c89c01..04d7f14 100644
0a122b
--- a/cputlb.c
0a122b
+++ b/cputlb.c
0a122b
@@ -167,7 +167,7 @@ static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
0a122b
         p = (void *)(uintptr_t)((tlb_entry->addr_write & TARGET_PAGE_MASK)
0a122b
             + tlb_entry->addend);
0a122b
         ram_addr = qemu_ram_addr_from_host_nofail(p);
0a122b
-        if (!cpu_physical_memory_is_dirty(ram_addr)) {
0a122b
+        if (cpu_physical_memory_is_clean(ram_addr)) {
0a122b
             tlb_entry->addr_write |= TLB_NOTDIRTY;
0a122b
         }
0a122b
     }
0a122b
@@ -300,7 +300,7 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
0a122b
             /* Write access calls the I/O callback.  */
0a122b
             te->addr_write = address | TLB_MMIO;
0a122b
         } else if (memory_region_is_ram(section->mr)
0a122b
-                   && !cpu_physical_memory_is_dirty(
0a122b
+                   && cpu_physical_memory_is_clean(
0a122b
                            section->mr->ram_addr
0a122b
                            + memory_region_section_addr(section, paddr))) {
0a122b
             te->addr_write = address | TLB_NOTDIRTY;
0a122b
diff --git a/exec.c b/exec.c
0a122b
index 77c2a0a..ec01b0f 100644
0a122b
--- a/exec.c
0a122b
+++ b/exec.c
0a122b
@@ -1509,7 +1509,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
0a122b
     cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_VGA);
0a122b
     /* we remove the notdirty callback only if the code has been
0a122b
        flushed */
0a122b
-    if (cpu_physical_memory_is_dirty(ram_addr))
0a122b
+    if (!cpu_physical_memory_is_clean(ram_addr))
0a122b
         tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);
0a122b
 }
0a122b
 
0a122b
@@ -1924,7 +1924,7 @@ int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr,
0a122b
 static void invalidate_and_set_dirty(hwaddr addr,
0a122b
                                      hwaddr length)
0a122b
 {
0a122b
-    if (!cpu_physical_memory_is_dirty(addr)) {
0a122b
+    if (cpu_physical_memory_is_clean(addr)) {
0a122b
         /* invalidate code */
0a122b
         tb_invalidate_phys_page_range(addr, addr + length, 0);
0a122b
         /* set dirty bit */
0a122b
@@ -2440,7 +2440,7 @@ void stl_phys_notdirty(hwaddr addr, uint32_t val)
0a122b
         stl_p(ptr, val);
0a122b
 
0a122b
         if (unlikely(in_migration)) {
0a122b
-            if (!cpu_physical_memory_is_dirty(addr1)) {
0a122b
+            if (cpu_physical_memory_is_clean(addr1)) {
0a122b
                 /* invalidate code */
0a122b
                 tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);
0a122b
                 /* set dirty bit */
0a122b
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
0a122b
index 94bd6af..416ce86 100644
0a122b
--- a/include/exec/memory-internal.h
0a122b
+++ b/include/exec/memory-internal.h
0a122b
@@ -70,14 +70,13 @@ static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr,
0a122b
     return cpu_physical_memory_get_dirty(addr, 1, client);
0a122b
 }
0a122b
 
0a122b
-/* read dirty bit (return 0 or 1) */
0a122b
-static inline bool cpu_physical_memory_is_dirty(ram_addr_t addr)
0a122b
+static inline bool cpu_physical_memory_is_clean(ram_addr_t addr)
0a122b
 {
0a122b
     bool vga = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_VGA);
0a122b
     bool code = cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_CODE);
0a122b
     bool migration =
0a122b
         cpu_physical_memory_get_dirty_flag(addr, DIRTY_MEMORY_MIGRATION);
0a122b
-    return vga && code && migration;
0a122b
+    return !(vga && code && migration);
0a122b
 }
0a122b
 
0a122b
 static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
0a122b
-- 
0a122b
1.7.1
0a122b