|
|
9ae3a8 |
From 60aa55e63ee56107ed2fd639b08ee166ca0b6264 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 14 Jan 2014 15:07:40 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 29/40] memory: make cpu_physical_memory_reset_dirty() take a length parameter
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Juan Quintela <quintela@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1389712071-23303-30-git-send-email-quintela@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56683
|
|
|
9ae3a8 |
O-Subject: [RHEL7 qemu-kvm PATCH 29/40] memory: make cpu_physical_memory_reset_dirty() take a length parameter
|
|
|
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 |
We have an end parameter in all the callers, and this make it coherent
|
|
|
9ae3a8 |
with the rest of cpu_physical_memory_* functions, that also take a
|
|
|
9ae3a8 |
length parameter.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Once here, move the start/end calculation to
|
|
|
9ae3a8 |
tlb_reset_dirty_range_all() as we don't need it here anymore.
|
|
|
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 a2f4d5bef2cfde557d76fc45a40d2c89b6bed4e4)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
exec.c
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Missing upstream commit:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
commit 041603fe5d4537cd165941f96bd76a31f7f662fd
|
|
|
9ae3a8 |
Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Date: Mon Sep 9 17:49:45 2013 +0200
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
exec: remove qemu_safe_ram_ptr
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Juan Quintela <quintela@trasno.org>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
cputlb.c | 3 +--
|
|
|
9ae3a8 |
exec.c | 19 ++++++++-----------
|
|
|
9ae3a8 |
include/exec/memory-internal.h | 2 +-
|
|
|
9ae3a8 |
memory.c | 8 ++------
|
|
|
9ae3a8 |
4 files changed, 12 insertions(+), 20 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
cputlb.c | 3 +--
|
|
|
9ae3a8 |
exec.c | 19 ++++++++-----------
|
|
|
9ae3a8 |
include/exec/memory-internal.h | 2 +-
|
|
|
9ae3a8 |
memory.c | 8 ++------
|
|
|
9ae3a8 |
4 files changed, 12 insertions(+), 20 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/cputlb.c b/cputlb.c
|
|
|
9ae3a8 |
index 04d7f14..44ec9bc 100644
|
|
|
9ae3a8 |
--- a/cputlb.c
|
|
|
9ae3a8 |
+++ b/cputlb.c
|
|
|
9ae3a8 |
@@ -127,8 +127,7 @@ void tlb_flush_page(CPUArchState *env, target_ulong addr)
|
|
|
9ae3a8 |
can be detected */
|
|
|
9ae3a8 |
void tlb_protect_code(ram_addr_t ram_addr)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- cpu_physical_memory_reset_dirty(ram_addr,
|
|
|
9ae3a8 |
- ram_addr + TARGET_PAGE_SIZE,
|
|
|
9ae3a8 |
+ cpu_physical_memory_reset_dirty(ram_addr, TARGET_PAGE_SIZE,
|
|
|
9ae3a8 |
DIRTY_MEMORY_CODE);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/exec.c b/exec.c
|
|
|
9ae3a8 |
index ec01b0f..79ea3b2 100644
|
|
|
9ae3a8 |
--- a/exec.c
|
|
|
9ae3a8 |
+++ b/exec.c
|
|
|
9ae3a8 |
@@ -576,10 +576,13 @@ CPUArchState *cpu_copy(CPUArchState *env)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#if !defined(CONFIG_USER_ONLY)
|
|
|
9ae3a8 |
-static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t end,
|
|
|
9ae3a8 |
- uintptr_t length)
|
|
|
9ae3a8 |
+static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- uintptr_t start1;
|
|
|
9ae3a8 |
+ ram_addr_t start1;
|
|
|
9ae3a8 |
+ ram_addr_t end;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ end = TARGET_PAGE_ALIGN(start + length);
|
|
|
9ae3a8 |
+ start &= TARGET_PAGE_MASK;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* we modify the TLB cache so that the dirty bit will be set again
|
|
|
9ae3a8 |
when accessing the range */
|
|
|
9ae3a8 |
@@ -595,21 +598,15 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t end,
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Note: start and end must be within the same ram block. */
|
|
|
9ae3a8 |
-void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
|
|
|
9ae3a8 |
+void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t length,
|
|
|
9ae3a8 |
unsigned client)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- uintptr_t length;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- start &= TARGET_PAGE_MASK;
|
|
|
9ae3a8 |
- end = TARGET_PAGE_ALIGN(end);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- length = end - start;
|
|
|
9ae3a8 |
if (length == 0)
|
|
|
9ae3a8 |
return;
|
|
|
9ae3a8 |
cpu_physical_memory_clear_dirty_range(start, length, client);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (tcg_enabled()) {
|
|
|
9ae3a8 |
- tlb_reset_dirty_range_all(start, end, length);
|
|
|
9ae3a8 |
+ tlb_reset_dirty_range_all(start, length);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
|
|
|
9ae3a8 |
index 416ce86..d2b85de 100644
|
|
|
9ae3a8 |
--- a/include/exec/memory-internal.h
|
|
|
9ae3a8 |
+++ b/include/exec/memory-internal.h
|
|
|
9ae3a8 |
@@ -111,7 +111,7 @@ static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start,
|
|
|
9ae3a8 |
bitmap_clear(ram_list.dirty_memory[client], page, end - page);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end,
|
|
|
9ae3a8 |
+void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t length,
|
|
|
9ae3a8 |
unsigned client);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
extern const IORangeOps memory_region_iorange_ops;
|
|
|
9ae3a8 |
diff --git a/memory.c b/memory.c
|
|
|
9ae3a8 |
index 2883da5..b49642b 100644
|
|
|
9ae3a8 |
--- a/memory.c
|
|
|
9ae3a8 |
+++ b/memory.c
|
|
|
9ae3a8 |
@@ -1087,9 +1087,7 @@ bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
|
|
|
9ae3a8 |
assert(mr->terminates);
|
|
|
9ae3a8 |
ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size, client);
|
|
|
9ae3a8 |
if (ret) {
|
|
|
9ae3a8 |
- cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
|
|
|
9ae3a8 |
- mr->ram_addr + addr + size,
|
|
|
9ae3a8 |
- client);
|
|
|
9ae3a8 |
+ cpu_physical_memory_reset_dirty(mr->ram_addr + addr, size, client);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -1133,9 +1131,7 @@ void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,
|
|
|
9ae3a8 |
hwaddr size, unsigned client)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
assert(mr->terminates);
|
|
|
9ae3a8 |
- cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
|
|
|
9ae3a8 |
- mr->ram_addr + addr + size,
|
|
|
9ae3a8 |
- client);
|
|
|
9ae3a8 |
+ cpu_physical_memory_reset_dirty(mr->ram_addr + addr, size, client);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void *memory_region_get_ram_ptr(MemoryRegion *mr)
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|