diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2014-05-14 17:43:19 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 18:44:19 +0300 |
commit | 0b183fc871e61f4a586fdef2c0f880b6a856e444 (patch) | |
tree | 225cde4ec5cb55663ed75c408f222b367f14057d /memory.c | |
parent | 7febe36f9adbb34756a6a6765a36ea49b6e502ac (diff) |
memory: move mem_path handling to memory_region_allocate_system_memory
Like the previous patch did in exec.c, split memory_region_init_ram and
memory_region_init_ram_from_file, and push mem_path one step further up.
Other RAM regions than system memory will now be backed by regular RAM.
Also, boards that do not use memory_region_allocate_system_memory will
not support -mem-path anymore. This can be changed before the patches
are merged by migrating boards to use the function.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -1030,13 +1030,24 @@ void memory_region_init_ram(MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram; - if (mem_path) { - mr->ram_addr = qemu_ram_alloc_from_file(size, mr, mem_path); - } else { - mr->ram_addr = qemu_ram_alloc(size, mr); - } + mr->ram_addr = qemu_ram_alloc(size, mr); } +#ifdef __linux__ +void memory_region_init_ram_from_file(MemoryRegion *mr, + struct Object *owner, + const char *name, + uint64_t size, + const char *path) +{ + memory_region_init(mr, owner, name, size); + mr->ram = true; + mr->terminates = true; + mr->destructor = memory_region_destructor_ram; + mr->ram_addr = qemu_ram_alloc_from_file(size, mr, path); +} +#endif + void memory_region_init_ram_ptr(MemoryRegion *mr, Object *owner, const char *name, |