[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 6/7] pc: memhotplug: keep reserved-memory-end broken
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 6/7] pc: memhotplug: keep reserved-memory-end broken on 2.4 and earlier machines |
Date: |
Thu, 10 Sep 2015 12:18:00 +0300 |
From: Igor Mammedov <address@hidden>
it will prevent guests on old machines from seeing
inconsistent memory mapping in firmware/ACPI views.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
---
include/hw/i386/pc.h | 1 +
hw/i386/pc.c | 8 ++++++--
hw/i386/pc_piix.c | 2 ++
hw/i386/pc_q35.c | 2 ++
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d0cad87..ff0b48b 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -59,6 +59,7 @@ struct PCMachineClass {
MachineClass parent_class;
/*< public >*/
+ bool broken_reserved_end;
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
DeviceState *dev);
};
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 354e1b3..b5107f7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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));
}
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 117f8dc..eab39fc 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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";
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 4b38dee..11601ab 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -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;
--
MST
- [Qemu-devel] [PULL 0/7] virtio,pc,acpi fixes, cleanups, Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 1/7] pci: Fix pci_device_iommu_address_space() bus propagation, Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 2/7] pc: Remove redundant arguments from xen_hvm_init(), Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 4/7] acpi: Remove unused definition., Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 5/7] pc: memhotplug: fix incorrectly set reserved-memory-end, Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 3/7] virtio: avoid leading underscores for helpers, Michael S. Tsirkin, 2015/09/10
- [Qemu-devel] [PULL 6/7] pc: memhotplug: keep reserved-memory-end broken on 2.4 and earlier machines,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 7/7] hw/pci: fix pci_update_mappings() trace events, Michael S. Tsirkin, 2015/09/10
- Re: [Qemu-devel] [PULL 0/7] virtio,pc,acpi fixes, cleanups, Peter Maydell, 2015/09/10