|
|
0a122b |
From 478863d3d5428211d0d64a9928484e0b1f5be8a4 Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
Date: Tue, 14 Jan 2014 15:07:19 +0100
|
|
|
0a122b |
Subject: [PATCH 08/40] memory: make cpu_physical_memory_is_dirty return bool
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
Message-id: <1389712071-23303-9-git-send-email-quintela@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56664
|
|
|
0a122b |
O-Subject: [RHEL7 qemu-kvm PATCH 08/40] memory: make cpu_physical_memory_is_dirty return bool
|
|
|
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 4f08cabe9e6efe8a50abc30cfa59e8470ad434d7)
|
|
|
0a122b |
Signed-off-by: Juan Quintela <quintela@trasno.org>
|
|
|
0a122b |
---
|
|
|
0a122b |
exec.c | 7 ++-----
|
|
|
0a122b |
include/exec/memory-internal.h | 8 ++++++--
|
|
|
0a122b |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
exec.c | 7 ++-----
|
|
|
0a122b |
include/exec/memory-internal.h | 8 ++++++--
|
|
|
0a122b |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/exec.c b/exec.c
|
|
|
0a122b |
index e993049..ea81329 100644
|
|
|
0a122b |
--- a/exec.c
|
|
|
0a122b |
+++ b/exec.c
|
|
|
0a122b |
@@ -1480,11 +1480,8 @@ static const MemoryRegionOps rom_mem_ops = {
|
|
|
0a122b |
static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
|
|
|
0a122b |
uint64_t val, unsigned size)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int dirty_flags;
|
|
|
0a122b |
- dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);
|
|
|
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 |
switch (size) {
|
|
|
0a122b |
case 1:
|
|
|
0a122b |
@@ -1499,8 +1496,8 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
|
|
|
0a122b |
default:
|
|
|
0a122b |
abort();
|
|
|
0a122b |
}
|
|
|
0a122b |
- dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);
|
|
|
0a122b |
- cpu_physical_memory_set_dirty_flags(ram_addr, dirty_flags);
|
|
|
0a122b |
+ cpu_physical_memory_set_dirty_flag(ram_addr, MIGRATION_DIRTY_FLAG);
|
|
|
0a122b |
+ cpu_physical_memory_set_dirty_flag(ram_addr, VGA_DIRTY_FLAG);
|
|
|
0a122b |
/* we remove the notdirty callback only if the code has been
|
|
|
0a122b |
flushed */
|
|
|
0a122b |
if (cpu_physical_memory_is_dirty(ram_addr))
|
|
|
0a122b |
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
|
|
|
0a122b |
index 8872e36..dfc03e1 100644
|
|
|
0a122b |
--- a/include/exec/memory-internal.h
|
|
|
0a122b |
+++ b/include/exec/memory-internal.h
|
|
|
0a122b |
@@ -65,9 +65,13 @@ static inline bool cpu_physical_memory_get_dirty_flag(ram_addr_t addr,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
/* read dirty bit (return 0 or 1) */
|
|
|
0a122b |
-static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)
|
|
|
0a122b |
+static inline bool cpu_physical_memory_is_dirty(ram_addr_t addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
- return cpu_physical_memory_get_dirty_flags(addr) == 0xff;
|
|
|
0a122b |
+ bool vga = cpu_physical_memory_get_dirty_flag(addr, VGA_DIRTY_FLAG);
|
|
|
0a122b |
+ bool code = cpu_physical_memory_get_dirty_flag(addr, CODE_DIRTY_FLAG);
|
|
|
0a122b |
+ bool migration =
|
|
|
0a122b |
+ cpu_physical_memory_get_dirty_flag(addr, MIGRATION_DIRTY_FLAG);
|
|
|
0a122b |
+ return vga && code && migration;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|