diff options
author | Igor Mammedov <imammedo@redhat.com> | 2015-09-07 13:55:31 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-09-10 12:15:30 +0300 |
commit | 3385e8e2640e5c38582f6e8413042bd23d97c640 (patch) | |
tree | 8fbff6aed49a72d314de70373348ff3b51f5e92e | |
parent | 9372e3f5678cdd86e1ddfb957d9da4b1889a0dd0 (diff) | |
download | qemu-3385e8e2640e5c38582f6e8413042bd23d97c640.zip qemu-3385e8e2640e5c38582f6e8413042bd23d97c640.tar.gz qemu-3385e8e2640e5c38582f6e8413042bd23d97c640.tar.bz2 |
pc: memhotplug: fix incorrectly set reserved-memory-end
reserved-memory-end tells firmware address from which
it could start treating memory as PCI address space
and map PCI BARs after it to avoid collisions with
RAM.
Currently it is incorrectly pointing to address where
hotplugged memory range starts which could redirect
hotplugged RAM accesses to PCI BARs when firmware
maps them over RAM or viceverse.
Fix this by pointing reserved-memory-end to the end
of memory hotplug area.
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>
-rw-r--r-- | hw/i386/pc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9f2924e..354e1b3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1412,7 +1412,9 @@ FWCfgState *pc_memory_init(PCMachineState *pcms, if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) { uint64_t *val = g_malloc(sizeof(*val)); - *val = cpu_to_le64(ROUND_UP(pcms->hotplug_memory.base, 0x1ULL << 30)); + uint64_t res_mem_end = pcms->hotplug_memory.base + + 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)); } |