summaryrefslogtreecommitdiff
path: root/hw/s390x/s390-virtio.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2015-05-29 13:53:08 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2015-09-07 16:10:44 +0200
commit1cf065fb87e8787e3e9cebcdb4713b81e4e61422 (patch)
treef5c3feb5ce68e96ddd4263a8b5f98525d45cf4c8 /hw/s390x/s390-virtio.c
parentb02ef3d92b19ad304a84433d3817f0903296ebc7 (diff)
downloadqemu-1cf065fb87e8787e3e9cebcdb4713b81e4e61422.tar.gz
qemu-1cf065fb87e8787e3e9cebcdb4713b81e4e61422.tar.bz2
qemu-1cf065fb87e8787e3e9cebcdb4713b81e4e61422.zip
s390: move memory calculation into the sclp device
The restrictions for memory calculation belong to the sclp device. Let's move the calculation to that point, so we are able to unify it for both s390 machines. The sclp device is the first device to be initialized. It performs the calculation and safely stores it in the machine, where other parts of the system can access an reuse it. The memory hotplug device is now only created when it is really needed. Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'hw/s390x/s390-virtio.c')
-rw-r--r--hw/s390x/s390-virtio.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index b0f339e9fb..c8e4737cba 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -261,10 +261,9 @@ int gtod_load(QEMUFile *f, void *opaque, int version_id)
/* PC hardware initialisation */
static void s390_init(MachineState *machine)
{
- ram_addr_t my_ram_size = machine->ram_size;
+ ram_addr_t my_ram_size;
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
- int increment_size = 20;
void *virtio_region;
hwaddr virtio_region_len;
hwaddr virtio_region_start;
@@ -273,22 +272,11 @@ static void s390_init(MachineState *machine)
error_report("Memory hotplug not supported by the selected machine.");
exit(EXIT_FAILURE);
}
- /*
- * 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 >> increment_size << increment_size;
-
- /* let's propagate the changed ram size into the global variable. */
- ram_size = my_ram_size;
+ s390_sclp_init();
+ my_ram_size = machine->ram_size;
/* get a BUS */
s390_bus = s390_virtio_bus_init(&my_ram_size);
- s390_sclp_init();
s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
machine->initrd_filename, ZIPL_FILENAME, false);
s390_flic_init();