From c5705a7728b4a6bc9e4f2d35911adbaf28042b25 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 20 Dec 2011 15:59:12 +0200 Subject: 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 --- memory.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'memory.c') diff --git a/memory.c b/memory.c index 93f9569..f7b3d50 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, -- cgit v1.1