microvm.c (0db949f1810f4d497762d57d8db6f219c0607529) microvm.c (e289655cea93bd50856a0896e2d49e5c7ed10c3b)
1/*
2 * Copyright (c) 2018 Intel Corporation
3 * Copyright (c) 2019 Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2 or later, as published by the Free Software Foundation.
8 *

--- 156 unchanged lines hidden (view full) ---

165
166static void microvm_memory_init(MicrovmMachineState *mms)
167{
168 MachineState *machine = MACHINE(mms);
169 X86MachineState *x86ms = X86_MACHINE(mms);
170 MemoryRegion *ram_below_4g, *ram_above_4g;
171 MemoryRegion *system_memory = get_system_memory();
172 FWCfgState *fw_cfg;
1/*
2 * Copyright (c) 2018 Intel Corporation
3 * Copyright (c) 2019 Red Hat, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2 or later, as published by the Free Software Foundation.
8 *

--- 156 unchanged lines hidden (view full) ---

165
166static void microvm_memory_init(MicrovmMachineState *mms)
167{
168 MachineState *machine = MACHINE(mms);
169 X86MachineState *x86ms = X86_MACHINE(mms);
170 MemoryRegion *ram_below_4g, *ram_above_4g;
171 MemoryRegion *system_memory = get_system_memory();
172 FWCfgState *fw_cfg;
173 ram_addr_t lowmem;
173 ram_addr_t lowmem = 0xc0000000; /* 3G */
174 int i;
175
176 /*
174 int i;
175
176 /*
177 * Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
178 * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
179 * also known as MMCFG).
180 * If it doesn't, we need to split it in chunks below and above 4G.
181 * In any case, try to make sure that guest addresses aligned at
182 * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
183 */
184 if (machine->ram_size >= 0xb0000000) {
185 lowmem = 0x80000000;
186 } else {
187 lowmem = 0xb0000000;
188 }
189
190 /*
191 * Handle the machine opt max-ram-below-4g. It is basically doing
192 * min(qemu limit, user limit).
193 */
194 if (!x86ms->max_ram_below_4g) {
195 x86ms->max_ram_below_4g = 4 * GiB;
196 }
197 if (lowmem > x86ms->max_ram_below_4g) {
198 lowmem = x86ms->max_ram_below_4g;

--- 369 unchanged lines hidden ---
177 * Handle the machine opt max-ram-below-4g. It is basically doing
178 * min(qemu limit, user limit).
179 */
180 if (!x86ms->max_ram_below_4g) {
181 x86ms->max_ram_below_4g = 4 * GiB;
182 }
183 if (lowmem > x86ms->max_ram_below_4g) {
184 lowmem = x86ms->max_ram_below_4g;

--- 369 unchanged lines hidden ---