diff options
author | Igor Mammedov <imammedo@redhat.com> | 2020-02-19 11:08:38 -0500 |
---|---|---|
committer | Patchew Importer <importer@patchew.org> | 2020-02-19 16:49:53 +0000 |
commit | 82b911aaff3ba33a3c028a533c5e169c274a7c3d (patch) | |
tree | 884387b1f8c4657ab5a1e8e366d7a159f11ca282 /hw/core/numa.c | |
parent | 900c0ba373aada4c13d47d95330aa72ec4067ba5 (diff) |
machine: introduce convenience MachineState::ram
the new field will be used by boards to get access to main
RAM memory region and will help to save boiler plate in
boards which often introduce a field or variable just for
this purpose.
Memory region will be equivalent to what currently used
memory_region_allocate_system_memory() is returning apart
from that it will come from hostmem backend.
Followup patches will incrementally switch boards to using
RAM from MachineState::ram.
Patch takes care of non-NUMA case and follow up patch will
initialize MachineState::ram for NUMA case.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200219160953.13771-5-imammedo@redhat.com>
Diffstat (limited to 'hw/core/numa.c')
-rw-r--r-- | hw/core/numa.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/hw/core/numa.c b/hw/core/numa.c index 840e68581f..8264336209 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -817,20 +817,8 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, if (!backend) { continue; } - MemoryRegion *seg = host_memory_backend_get_memory(backend); - - if (memory_region_is_mapped(seg)) { - char *path = object_get_canonical_path_component(OBJECT(backend)); - error_report("memory backend %s is used multiple times. Each " - "-numa option must use a different memdev value.", - path); - g_free(path); - exit(1); - } - - host_memory_backend_set_mapped(backend, true); + MemoryRegion *seg = machine_consume_memdev(ms, backend); memory_region_add_subregion(mr, addr, seg); - vmstate_register_ram_global(seg); addr += size; } } |