[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 07/80] vl.c: ensure that ram_size matches size of machine.memo
From: |
Igor Mammedov |
Subject: |
[PATCH v4 07/80] vl.c: ensure that ram_size matches size of machine.memory-backend |
Date: |
Fri, 31 Jan 2020 16:08:37 +0100 |
Extend set_memory_options() to check that size specified by -m
matches the size of backend pointed by memory-backend.
And in case of -m was omitted adjust ram_size to match that
of explicitly provided backend.
Signed-off-by: Igor Mammedov <address@hidden>
---
CC: address@hidden
CC: address@hidden
---
vl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/vl.c b/vl.c
index 1c0314d..4ce0799 100644
--- a/vl.c
+++ b/vl.c
@@ -2689,6 +2689,21 @@ static void set_memory_options(uint64_t *ram_slots,
ram_addr_t *maxram_size,
exit(EXIT_FAILURE);
}
+ if (current_machine->ram_memdev_id) {
+ Object *backend;
+ ram_addr_t backend_size;
+
+ backend = object_resolve_path_type(current_machine->ram_memdev_id,
+ TYPE_MEMORY_BACKEND, NULL);
+ backend_size = object_property_get_uint(backend, "size",
&error_abort);
+ if (mem_str && backend_size != ram_size) {
+ error_report("Size specified by -m option must match size of "
+ "explicitly specified 'memory-backend' property");
+ exit(EXIT_FAILURE);
+ }
+ ram_size = backend_size;
+ }
+
if (!xen_enabled()) {
/* On 32-bit hosts, QEMU is limited by virtual address space */
if (ram_size > (2047 << 20) && HOST_LONG_BITS == 32) {
--
2.7.4
- [PATCH v4 00/80] refactor main RAM allocation to use hostmem backend, Igor Mammedov, 2020/01/31
- [PATCH v4 02/80] machine: introduce memory-backend property, Igor Mammedov, 2020/01/31
- [PATCH v4 01/80] numa: remove deprecated -mem-path fallback to anonymous RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 04/80] machine: introduce convenience MachineState::ram, Igor Mammedov, 2020/01/31
- [PATCH v4 05/80] initialize MachineState::ram in NUMA case, Igor Mammedov, 2020/01/31
- [PATCH v4 11/80] arm/collie: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 08/80] alpha/dp264: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 06/80] vl.c: move -m parsing after memory backends has been processed, Igor Mammedov, 2020/01/31
- [PATCH v4 07/80] vl.c: ensure that ram_size matches size of machine.memory-backend,
Igor Mammedov <=
- [PATCH v4 10/80] arm/aspeed: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 14/80] arm/highbank: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 09/80] arm/aspeed: actually check RAM size, Igor Mammedov, 2020/01/31
- [PATCH v4 13/80] arm/digic_boards: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 12/80] arm/cubieboard: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 03/80] machine: alias -mem-path and -mem-prealloc into memory-foo backend, Igor Mammedov, 2020/01/31
- [PATCH v4 19/80] arm/kzm: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 16/80] arm/imx25_pdk: use memdev for RAM, Igor Mammedov, 2020/01/31
- [PATCH v4 15/80] arm/imx25_pdk: drop RAM size fixup, Igor Mammedov, 2020/01/31
- [PATCH v4 23/80] arm/mps2: use memdev for RAM, Igor Mammedov, 2020/01/31