From eef3a7abff8a5eab840868fffd6195d8a2a555d0 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Tue, 2 Nov 2021 17:43:15 +0100 Subject: [PATCH] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20211102164317.45658-2-david@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index debcdc0e70..d856485cb4 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -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); -- 2.30.2