[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v2 14/17] s390x/sclp: make sure ram_size and maxram_
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v2 14/17] s390x/sclp: make sure ram_size and maxram_size stay in sync |
Date: |
Fri, 11 May 2018 15:19:50 +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
- [qemu-s390x] [PATCH v2 05/17] spapr: prepare for multi stage hotplug handlers, (continued)
- [qemu-s390x] [PATCH v2 05/17] spapr: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 06/17] spapr: route all memory devices through the machine hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 03/17] pc: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 07/17] spapr: handle pc-dimm unplug via hotplug handler chain, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 08/17] spapr: handle cpu core unplug via hotplug handler chain, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 09/17] memory-device: new functions to handle plug/unplug, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 10/17] pc-dimm: implement new memory device functions, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 11/17] memory-device: factor out pre-plug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 12/17] memory-device: factor out unplug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 13/17] memory-device: factor out plug into hotplug handler, David Hildenbrand, 2018/05/11
- [qemu-s390x] [PATCH v2 14/17] s390x/sclp: make sure ram_size and maxram_size stay in sync,
David Hildenbrand <=
- [qemu-s390x] [PATCH v2 16/17] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/11
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 16/17] s390x: initialize memory region for memory devices, Murilo Opsfelder Araujo, 2018/05/11
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 16/17] s390x: initialize memory region for memory devices, Eduardo Habkost, 2018/05/11
- Re: [qemu-s390x] [Qemu-devel] [PATCH v2 16/17] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/12
- Re: [qemu-s390x] [Qemu-ppc] [Qemu-devel] [PATCH v2 16/17] s390x: initialize memory region for memory devices, Murilo Opsfelder Araujo, 2018/05/14
- Re: [qemu-s390x] [Qemu-devel] [Qemu-ppc] [PATCH v2 16/17] s390x: initialize memory region for memory devices, Markus Armbruster, 2018/05/15
- Re: [qemu-s390x] [Qemu-devel] [Qemu-ppc] [PATCH v2 16/17] s390x: initialize memory region for memory devices, David Hildenbrand, 2018/05/15
- Re: [qemu-s390x] [Qemu-ppc] [Qemu-devel] [PATCH v2 16/17] s390x: initialize memory region for memory devices, Murilo Opsfelder Araujo, 2018/05/15
[qemu-s390x] [PATCH v2 17/17] s390x: support memory devices, David Hildenbrand, 2018/05/11
[qemu-s390x] [PATCH v2 15/17] s390x: prepare for multi stage hotplug handlers, David Hildenbrand, 2018/05/11