[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 1/3] machine: Use host_memory_backend_is_mapped() in machine_c

From: David Hildenbrand
Subject: [PATCH v3 1/3] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev()
Date: Tue, 2 Nov 2021 17:43:15 +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>
 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 e24e3e27db..57c82e9473 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1081,7 +1081,7 @@ MemoryRegion *machine_consume_memdev(MachineState 
     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.",

reply via email to

[Prev in Thread] Current Thread [Next in Thread]