aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-12-20 15:59:12 +0200
committerAvi Kivity <avi@redhat.com>2012-01-04 13:34:48 +0200
commitc5705a7728b4a6bc9e4f2d35911adbaf28042b25 (patch)
treee96a1e0c9fbd0fa3624b5454038659775c81fba2 /memory.c
parent8991c79b57b75fcdeb290df89b9b0adaccb0303c (diff)
vmstate, memory: decouple vmstate from memory API
Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/memory.c b/memory.c
index 93f9569c05..f7b3d50a1a 100644
--- a/memory.c
+++ b/memory.c
@@ -1033,7 +1033,6 @@ void memory_region_init_io(MemoryRegion *mr,
}
void memory_region_init_ram(MemoryRegion *mr,
- DeviceState *dev,
const char *name,
uint64_t size)
{
@@ -1041,12 +1040,11 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
- mr->ram_addr = qemu_ram_alloc(dev, name, size, mr);
+ mr->ram_addr = qemu_ram_alloc(size, mr);
mr->backend_registered = true;
}
void memory_region_init_ram_ptr(MemoryRegion *mr,
- DeviceState *dev,
const char *name,
uint64_t size,
void *ptr)
@@ -1055,7 +1053,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram_from_ptr;
- mr->ram_addr = qemu_ram_alloc_from_ptr(dev, name, size, ptr, mr);
+ mr->ram_addr = qemu_ram_alloc_from_ptr(size, ptr, mr);
mr->backend_registered = true;
}
@@ -1073,7 +1071,6 @@ void memory_region_init_alias(MemoryRegion *mr,
void memory_region_init_rom_device(MemoryRegion *mr,
const MemoryRegionOps *ops,
void *opaque,
- DeviceState *dev,
const char *name,
uint64_t size)
{
@@ -1082,7 +1079,7 @@ void memory_region_init_rom_device(MemoryRegion *mr,
mr->opaque = opaque;
mr->terminates = true;
mr->destructor = memory_region_destructor_rom_device;
- mr->ram_addr = qemu_ram_alloc(dev, name, size, mr);
+ mr->ram_addr = qemu_ram_alloc(size, mr);
mr->ram_addr |= cpu_register_io_memory(memory_region_read_thunk,
memory_region_write_thunk,
mr,