aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-10-10 10:30:27 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-10-17 13:06:11 +0200
commit0624c7f916b4d97f17726d9b295d6a6b0dc5076d (patch)
treeb5ab2845a5e344cc587b20e544403808b5923188 /hw/i386
parent1680d485777ecf436d724631ea8722cc0c66990e (diff)
e820: pass high memory too.
We have a fw_cfg entry to pass e820 entries from qemu to the firmware. Today it's used to pass reservations only. This patch makes qemu pass entries for RAM too. This allows to pass RAM sizes larger than 1TB to the firmware and it will also allow to pass non-contignous memory ramges should we decide to implement that some day, say for our virtual numa nodes. Obviously this needs some extra care to not break existing firware. SeaBIOS loads the entries and happily adds them without looking at the type. Which is problematic for memory below 4g as this will overwrite reservations added for bios memory etc. For memory above 4g it works just fine, seabios will merge the entry derived from cmos with the one loaded from fw_cfg. OVMF doesn't look at the fw_cfg e820 table. coreboot doesn't look at the fw_cfg e820 table. Cc: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/pc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0c313feb0b..ec5508b288 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1134,12 +1134,20 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
memory_region_init_alias(ram_below_4g, NULL, "ram-below-4g", ram,
0, below_4g_mem_size);
memory_region_add_subregion(system_memory, 0, ram_below_4g);
+ if (0) {
+ /*
+ * Ideally we should do that too, but that would ruin the e820
+ * reservations added by seabios before initializing fw_cfg.
+ */
+ e820_add_entry(0, below_4g_mem_size, E820_RAM);
+ }
if (above_4g_mem_size > 0) {
ram_above_4g = g_malloc(sizeof(*ram_above_4g));
memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g", ram,
below_4g_mem_size, above_4g_mem_size);
memory_region_add_subregion(system_memory, 0x100000000ULL,
ram_above_4g);
+ e820_add_entry(0x100000000ULL, above_4g_mem_size, E820_RAM);
}