xen: fix ram init regression
PATCH 1/1 xen: fix ram init regression
Commit "8156d48 pc: allow raising low memory via max-ram-below-4g option" causes a regression on xen, because it uses a different memory split.
This patch initializes max-ram-below-4g to zero and leaves the initialization to the memory initialization functions. That way they can pick different default values (max-ram-below-4g is zero still) or use the user supplied value (max-ram-below-4g is non-zero).
Also skip the whole ram split calculation on Xen. xen_ram_init() does its own split calculation anyway so it is superfluous, also this way xen_ram_init can actually see whenever max-ram-below-4g is zero or not.
Reported-by Anthony PERARD <[email protected]>
Tested-by Anthony PERARD <[email protected]>
Signed-off-by Gerd Hoffmann <[email protected]>
--- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 52 +++++++++++++++++++++++++++++----------------------- hw/i386/pc_q35.c | 3 +++ xen-hvm.c | 3 +++ 4 files changed, 36 insertions(+), 24 deletions(-)
hw/i386/pc.c +1 -1
@@ -1886,7 +1886,7 @@ static void pc_machine_initfn(Object *obj) pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); - pcms->max_ram_below_4g =0xe0000000 ;/* 3.5G */ + pcms->max_ram_below_4g =0 ;/* use default */ object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g,
hw/i386/pc_piix.c +29 -23
66 lines not on this page · raw message
hw/i386/pc_q35.c +3 -0
@@ -93,6 +93,9 @@ static void pc_q35_init(MachineState *machine)/* Handle the machine opt max-ram-below-4g. It is basically doing * min(qemu limit, user limit). */ +if (!pcms->max_ram_below_4g) { + pcms->max_ram_below_4g =1ULL <<32 ;/* default: 4G */ ; + }if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem &&
xen-hvm.c +3 -0
@@ -190,6 +190,9 @@ static void xen_ram_init(PCMachineState *pcms,/* Handle the machine opt max-ram-below-4g. It is basically doing * min(xen limit, user limit). */ +if (!user_lowmem) { + user_lowmem =HVM_BELOW_4G_RAM_END ;/* default */ + }if (HVM_BELOW_4G_RAM_END <= user_lowmem) { user_lowmem =HVM_BELOW_4G_RAM_END ; }
Signature · 1 line
1.8.3.1