]> git.proxmox.com Git - mirror_qemu.git/commitdiff
machine: Use host_memory_backend_is_mapped() in machine_consume_memdev()
authorDavid Hildenbrand <david@redhat.com>
Tue, 2 Nov 2021 16:43:15 +0000 (17:43 +0100)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tue, 18 Jan 2022 09:45:35 +0000 (10:45 +0100)
memory_region_is_mapped() is the wrong check, we actually want to check
whether the backend is already marked mapped.

For example, memory regions mapped via an alias, such as NVDIMMs,
currently don't make memory_region_is_mapped() return "true". As the
machine is initialized before any memory devices (and thereby before
NVDIMMs are initialized), this isn't a fix but merely a cleanup.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20211102164317.45658-2-david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/core/machine.c

index debcdc0e70a4ba7a92966b13ab601e7063c7b071..d856485cb4d0a3be2bd99057d95bd568db5c3828 100644 (file)
@@ -1091,7 +1091,7 @@ MemoryRegion *machine_consume_memdev(MachineState *machine,
 {
     MemoryRegion *ret = host_memory_backend_get_memory(backend);
 
-    if (memory_region_is_mapped(ret)) {
+    if (host_memory_backend_is_mapped(backend)) {
         error_report("memory backend %s can't be used multiple times.",
                      object_get_canonical_path_component(OBJECT(backend)));
         exit(EXIT_FAILURE);