]> git.proxmox.com Git - mirror_qemu.git/commitdiff
pc: memhotplug: keep reserved-memory-end broken on 2.4 and earlier machines
authorIgor Mammedov <imammedo@redhat.com>
Mon, 7 Sep 2015 11:55:32 +0000 (13:55 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 10 Sep 2015 09:15:30 +0000 (12:15 +0300)
it will prevent guests on old machines from seeing
inconsistent memory mapping in firmware/ACPI views.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
hw/i386/pc.c
hw/i386/pc_piix.c
hw/i386/pc_q35.c
include/hw/i386/pc.h

index 354e1b3157c17c7c7a3004901a4cfffbf9debadd..b5107f7c5823e6e601767cee3a33ff51daa6044e 100644 (file)
@@ -1412,8 +1412,12 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
 
     if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) {
         uint64_t *val = g_malloc(sizeof(*val));
-        uint64_t res_mem_end = pcms->hotplug_memory.base +
-                               memory_region_size(&pcms->hotplug_memory.mr);
+        PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
+        uint64_t res_mem_end = pcms->hotplug_memory.base;
+
+        if (!pcmc->broken_reserved_end) {
+            res_mem_end += memory_region_size(&pcms->hotplug_memory.mr);
+        }
         *val = cpu_to_le64(ROUND_UP(res_mem_end, 0x1ULL << 30));
         fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val));
     }
index 117f8dc4178e623a9937dbaaa2441479594a954f..eab39fc098a796abd42edab556c9883d542bc317 100644 (file)
@@ -449,7 +449,9 @@ static void pc_i440fx_machine_options(MachineClass *m)
 
 static void pc_i440fx_2_4_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_i440fx_machine_options(m);
+    pcmc->broken_reserved_end = true;
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
     m->alias = "pc";
index 4b38deee48340bb936d4da68875fea17773948e9..11601ab0059dedb4edb82051dffcca61090a7644 100644 (file)
@@ -368,7 +368,9 @@ static void pc_q35_machine_options(MachineClass *m)
 
 static void pc_q35_2_4_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_q35_machine_options(m);
+    pcmc->broken_reserved_end = true;
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
     m->no_floppy = 1;
index d0cad87d215970ad95e25c4a7e407d9b4ce6dc90..ff0b48bf58daf6d7eded443ad9ec8b9f072be659 100644 (file)
@@ -59,6 +59,7 @@ struct PCMachineClass {
     MachineClass parent_class;
 
     /*< public >*/
+    bool broken_reserved_end;
     HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
                                            DeviceState *dev);
 };