[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 15/18] s390x/sclp: make sure ram_size and maxram_
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v3 15/18] s390x/sclp: make sure ram_size and maxram_size stay in sync |
Date: |
Mon, 14 May 2018 12:00:20 +0200 |
On s390x, we sometimes have to shrink ram_size in order to be able to
correctly indicate the size to the guest.
In case maxmem is not set, ram_size and maxram_size should always be
kept equal. Make sure to also fixup maxram_size if necessary.
In case maxmem is set, we really want to bail out in case we have to
round down, as it basically can screw up the size of the device memory
area later on.
Pleas note that this fixup ususally does not happen with sane values
for the ram size.
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/s390x/sclp.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 047d577313..0757914374 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -21,6 +21,8 @@
#include "hw/s390x/event-facility.h"
#include "hw/s390x/s390-pci-bus.h"
#include "hw/s390x/ipl.h"
+#include "qemu/error-report.h"
+
static inline SCLPDevice *get_sclp_device(void)
{
@@ -318,9 +320,19 @@ static void sclp_memory_init(SCLPDevice *sclp)
* down to align with the nearest increment boundary. */
initial_mem = initial_mem >> increment_size << increment_size;
- machine->ram_size = initial_mem;
- /* let's propagate the changed ram size into the global variable. */
- ram_size = initial_mem;
+ /* also shrink maxram_size in case we don't have maxmem configured */
+ if (initial_mem != machine->ram_size) {
+ if (machine->ram_size < machine->maxram_size) {
+ error_report("Ram size ('" RAM_ADDR_FMT "') had to be rounded "
+ "down to ('" RAM_ADDR_FMT "'), maxmem not supported",
+ machine->ram_size, initial_mem);
+ exit(1);
+ }
+ /* propagate the changed ram size into the different places */
+ machine->ram_size = initial_mem;
+ ram_size = initial_mem;
+ machine->maxram_size = initial_mem;
+ }
}
static void sclp_init(Object *obj)
--
2.14.3
- Re: [qemu-s390x] [Qemu-devel] [Qemu-ppc] [PATCH v3 02/18] memory-device: introduce separate config option, (continued)
- [qemu-s390x] [PATCH v3 06/18] spapr: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 04/18] pc: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 09/18] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 08/18] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 11/18] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 07/18] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 10/18] memory-device: new functions to handle plug/unplug, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 14/18] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 13/18] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 15/18] s390x/sclp: make sure ram_size and maxram_size stay in sync,
David Hildenbrand <=
- [qemu-s390x] [PATCH v3 17/18] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 12/18] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 18/18] s390x: support memory devices, David Hildenbrand, 2018/05/14
- [qemu-s390x] [PATCH v3 16/18] s390x: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/14