[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/11] exec: introduce qemu_ram_unset_idstr() to unse
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 02/11] exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr |
Date: |
Wed, 18 Jun 2014 15:41:59 +0200 |
From: Hu Tao <address@hidden>
Signed-off-by: Hu Tao <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 26 +++++++++++++++++++++-----
include/exec/cpu-common.h | 1 +
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/exec.c b/exec.c
index 4e179a6..6ce989a 100644
--- a/exec.c
+++ b/exec.c
@@ -1201,17 +1201,24 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t
size)
}
}
-void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
+static RAMBlock *find_ram_block(ram_addr_t addr)
{
- RAMBlock *new_block, *block;
+ RAMBlock *block;
- new_block = NULL;
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset == addr) {
- new_block = block;
- break;
+ return block;
}
}
+
+ return NULL;
+}
+
+void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
+{
+ RAMBlock *new_block = find_ram_block(addr);
+ RAMBlock *block;
+
assert(new_block);
assert(!new_block->idstr[0]);
@@ -1236,6 +1243,15 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char
*name, DeviceState *dev)
qemu_mutex_unlock_ramlist();
}
+void qemu_ram_unset_idstr(ram_addr_t addr)
+{
+ RAMBlock *block = find_ram_block(addr);
+
+ if (block) {
+ memset(block->idstr, 0, sizeof(block->idstr));
+ }
+}
+
static int memory_try_enable_merging(void *addr, size_t len)
{
if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) {
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index a21b65a..89ec640 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -54,6 +54,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length);
/* This should not be used by devices. */
MemoryRegion *qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev);
+void qemu_ram_unset_idstr(ram_addr_t addr);
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
int len, int is_write);
--
1.8.3.1
- [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 01/11] MAINTAINERS: Add myself as Memory API maintainer, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 02/11] exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr,
Paolo Bonzini <=
- [Qemu-devel] [PULL 05/11] memory: Simplify mr_add_subregion() if-else, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 06/11] exec: dummy_section: Pass address space through., Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 09/11] memory: MemoryRegion: factor out memory region re-adder, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 08/11] memory: MemoryRegion: factor out subregion add functionality, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 07/11] qtest: fix qtest_clock_warp() for no deadline case, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 10/11] memory: MemoryRegion: rename parent to container, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 11/11] memory: Don't call memory_region_update_coalesced_range if nothing changed, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 03/11] unset RAMBlock idstr when unregister MemoryRegion, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 04/11] memory: Don't update all memory region when ioeventfd changed, Paolo Bonzini, 2014/06/18
- Re: [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Peter Maydell, 2014/06/18