Revision 22486aa0 hw/s390-virtio.c

b/hw/s390-virtio.c
131 131
}
132 132

  
133 133
/* PC hardware initialisation */
134
static void s390_init(ram_addr_t ram_size,
134
static void s390_init(ram_addr_t my_ram_size,
135 135
                      const char *boot_device,
136 136
                      const char *kernel_filename,
137 137
                      const char *kernel_cmdline,
......
143 143
    ram_addr_t kernel_size = 0;
144 144
    ram_addr_t initrd_offset;
145 145
    ram_addr_t initrd_size = 0;
146
    int shift = 0;
146 147
    uint8_t *storage_keys;
147 148
    int i;
148 149

  
150
    /* s390x ram size detection needs a 16bit multiplier + an increment. So
151
       guests > 64GB can be specified in 2MB steps etc. */
152
    while ((my_ram_size >> (20 + shift)) > 65535) {
153
        shift++;
154
    }
155
    my_ram_size = my_ram_size >> (20 + shift) << (20 + shift);
156

  
157
    /* lets propagate the changed ram size into the global variable. */
158
    ram_size = my_ram_size;
149 159

  
150 160
    /* get a BUS */
151
    s390_bus = s390_virtio_bus_init(&ram_size);
161
    s390_bus = s390_virtio_bus_init(&my_ram_size);
152 162

  
153 163
    /* allocate RAM */
154
    ram_addr = qemu_ram_alloc(NULL, "s390.ram", ram_size);
155
    cpu_register_physical_memory(0, ram_size, ram_addr);
164
    ram_addr = qemu_ram_alloc(NULL, "s390.ram", my_ram_size);
165
    cpu_register_physical_memory(0, my_ram_size, ram_addr);
156 166

  
157 167
    /* allocate storage keys */
158
    storage_keys = qemu_mallocz(ram_size / TARGET_PAGE_SIZE);
168
    storage_keys = qemu_mallocz(my_ram_size / TARGET_PAGE_SIZE);
159 169

  
160 170
    /* init CPUs */
161 171
    if (cpu_model == NULL) {

Also available in: Unified diff