[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/19] machine: Use host_memory_backend_is_mapped() in machine_con
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 04/19] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev() |
Date: |
Tue, 18 Jan 2022 13:02:14 +0100 |
From: David Hildenbrand <david@redhat.com>
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
index debcdc0e70a..d856485cb4d 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.34.1
- [PULL 00/19] Memory API patches for 2022-01-18, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 01/19] memory: Directly dispatch alias accesses on origin memory region, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 04/19] machine: Use host_memory_backend_is_mapped() in machine_consume_memdev(),
Philippe Mathieu-Daudé <=
- [PULL 02/19] memory: Split mtree_info() as mtree_info_flatview() + mtree_info_as(), Philippe Mathieu-Daudé, 2022/01/18
- [PULL 03/19] memory: Have 'info mtree' remove duplicated Address Space information, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 06/19] memory: Update description of memory_region_is_mapped(), Philippe Mathieu-Daudé, 2022/01/18
- [PULL 08/19] stubs: Restrict fw_cfg to system emulation, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 10/19] hw/pci: Restrict pci-bus stub to sysemu, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 19/19] docs/devel: add some clarifying text for aliases, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 17/19] hw/dma: Use dma_addr_t type definition when relevant, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 12/19] hw/dma: Remove CONFIG_USER_ONLY check, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 07/19] memory: Fix incorrect calls of log_global_start/stop, Philippe Mathieu-Daudé, 2022/01/18
- [PULL 09/19] hw/nvram: Restrict fw_cfg QOM interface to sysemu and tools, Philippe Mathieu-Daudé, 2022/01/18