[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 21/21] hw/core: Assert memory_region_allocate_system_memory has m
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 21/21] hw/core: Assert memory_region_allocate_system_memory has machine owner |
Date: |
Mon, 21 Oct 2019 00:56:50 +0200 |
All the memory_region_allocate_system_memory() pass a MachineState
argument. Add an assertion to ensure the new boards/machines added
set this argument, so all system memory object have the machine as
its QOM owner.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/core/numa.c | 4 +---
include/hw/boards.h | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 2e29e4bfe0..3e07e94d00 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -527,9 +527,7 @@ void memory_region_allocate_system_memory(MemoryRegion *mr,
MachineState *ms,
uint64_t addr = 0;
int i;
- if (!ms) {
- ms = MACHINE(qdev_get_machine());
- }
+ g_assert(ms);
if (ms->numa_state == NULL ||
ms->numa_state->num_nodes == 0 || !have_memdevs) {
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 3b6cb82b6c..31ab6e7586 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -14,7 +14,7 @@
/**
* memory_region_allocate_system_memory - Allocate a board's main memory
* @mr: the #MemoryRegion to be initialized
- * @ms: the #MachineState object that own the system memory
+ * @ms: the #MachineState object that own the system memory (must not be NULL)
* @name: name of the memory region
* @ram_size: size of the region in bytes
*
--
2.21.0
- Re: [PATCH 18/21] hw/mips: Let the machine be the owner of the system memory, (continued)
Re: [EXTERNAL][PATCH 18/21] hw/mips: Let the machine be the owner of the system memory, Aleksandar Markovic, 2019/10/21
[PATCH 19/21] hw/ppc: Let the machine be the owner of the system memory, Philippe Mathieu-Daudé, 2019/10/20
[PATCH 20/21] hw/sparc: Let the machine be the owner of the system memory, Philippe Mathieu-Daudé, 2019/10/20
[PATCH 21/21] hw/core: Assert memory_region_allocate_system_memory has machine owner,
Philippe Mathieu-Daudé <=
Re: [PATCH 00/21] hw: Let the machine be the owner of the system memory, no-reply, 2019/10/20
Re: [PATCH 00/21] hw: Let the machine be the owner of the system memory, Philippe Mathieu-Daudé, 2019/10/21