diff options
author | Matthew Rosato <mjrosato@linux.vnet.ibm.com> | 2014-08-28 11:25:34 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-09-01 09:25:32 +0200 |
commit | e7f1314f97a8e9e035100e9aa4e9613f245fb00c (patch) | |
tree | e506c70de1db161bfbb08e4d9800044cdede85a4 /hw/s390x/s390-virtio.c | |
parent | b6fe01248e66a3c1b1b22a9cd640bfa86d4c358c (diff) | |
download | qemu-e7f1314f97a8e9e035100e9aa4e9613f245fb00c.tar.gz qemu-e7f1314f97a8e9e035100e9aa4e9613f245fb00c.tar.bz2 qemu-e7f1314f97a8e9e035100e9aa4e9613f245fb00c.zip |
s390-virtio: Apply same memory boundaries as virtio-ccw
Although s390-virtio won't support memory hotplug, it should
enforce the same memory boundaries so that it can use shared codepaths
(like read_SCP_info).
Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'hw/s390x/s390-virtio.c')
-rw-r--r-- | hw/s390x/s390-virtio.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index 1a75a1cf81..4ca52b7190 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -230,18 +230,21 @@ static void s390_init(MachineState *machine) ram_addr_t my_ram_size = machine->ram_size; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); - int shift = 0; + int increment_size = 20; uint8_t *storage_keys; void *virtio_region; hwaddr virtio_region_len; hwaddr virtio_region_start; - /* s390x ram size detection needs a 16bit multiplier + an increment. So - guests > 64GB can be specified in 2MB steps etc. */ - while ((my_ram_size >> (20 + shift)) > 65535) { - shift++; + /* + * The storage increment size is a multiple of 1M and is a power of 2. + * The number of storage increments must be MAX_STORAGE_INCREMENTS or + * fewer. + */ + while ((my_ram_size >> increment_size) > MAX_STORAGE_INCREMENTS) { + increment_size++; } - my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); + my_ram_size = my_ram_size >> increment_size << increment_size; /* let's propagate the changed ram size into the global variable. */ ram_size = my_ram_size; |