Revision 22486aa0

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) {
b/target-s390x/op_helper.c
2361 2361
int sclp_service_call(CPUState *env, uint32_t sccb, uint64_t code)
2362 2362
{
2363 2363
    int r = 0;
2364
    int shift = 0;
2364 2365

  
2365 2366
#ifdef DEBUG_HELPER
2366 2367
    printf("sclp(0x%x, 0x%" PRIx64 ")\n", sccb, code);
......
2375 2376
    switch(code) {
2376 2377
        case SCLP_CMDW_READ_SCP_INFO:
2377 2378
        case SCLP_CMDW_READ_SCP_INFO_FORCED:
2378
            stw_phys(sccb + SCP_MEM_CODE, ram_size >> 20);
2379
            stb_phys(sccb + SCP_INCREMENT, 1);
2379
            while ((ram_size >> (20 + shift)) > 65535) {
2380
                shift++;
2381
            }
2382
            stw_phys(sccb + SCP_MEM_CODE, ram_size >> (20 + shift));
2383
            stb_phys(sccb + SCP_INCREMENT, 1 << shift);
2380 2384
            stw_phys(sccb + SCP_RESPONSE_CODE, 0x10);
2381 2385

  
2382 2386
            if (kvm_enabled()) {

Also available in: Unified diff