Skip to contentSkip to conversation

split memory allocation

PATCH Applied Glauber Costa 3 participants 3 messages Sep 15, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 split memory allocation

Right now, kvm keeps the memory allocation split, so we can handle different areas in different ways. This schema works with qemu too, so it appears to be the common ground.

This patch proposes using this common ground for everyone, by spliting raw qemu.

---
 hw/pc.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
hw/pc.c +16 -4
index 435c7d4..9fd1bdf 100644
@@ -777,16 +777,28 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
     vmport_init();
 
     /* allocate RAM */
-    ram_addr = qemu_ram_alloc(ram_size);
-    cpu_register_physical_memory(0, below_4g_mem_size, ram_addr);
+    ram_addr = qemu_ram_alloc(0xa0000);
+    cpu_register_physical_memory(0, 0xa0000, ram_addr);
+
+    /* Allocate, even though we won't register, so we don't break the
+     * phys_ram_base + PA assumption. This range includes vga (0xa0000 - 0xc0000),
+     * and some bios areas, which will be registered later
+     */
+    ram_addr = qemu_ram_alloc(0x100000 - 0xa0000);
+    ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000);
+    cpu_register_physical_memory(0x100000,
+                 below_4g_mem_size - 0x100000,
+                 ram_addr);
 
     /* above 4giga memory allocation */
     if (above_4g_mem_size > 0) {
-        cpu_register_physical_memory((target_phys_addr_t) 0x100000000ULL,
+        ram_addr = qemu_ram_alloc(above_4g_mem_size);
+        cpu_register_physical_memory(0x100000000ULL,
                                      above_4g_mem_size,
-                                     ram_addr + below_4g_mem_size);
+                                     ram_addr);
     }
 
+
     /* allocate VGA RAM */
     vga_ram_addr = qemu_ram_alloc(vga_ram_size);
 
Signature · 1 line
1.5.5.1
#1 lore raw
Quoted 7 lines · Glauber Costa

Right now, kvm keeps the memory allocation split, so we can handle different areas in different ways. This schema works with qemu too, so it appears to be the common ground.

This patch proposes using this common ground for everyone, by spliting raw qemu.

Applied. Thanks.

Regards,

Anthony Liguori

#2 lore raw
Quoted 11 lines · Anthony Liguori
Quoted 8 lines · Glauber Costa

Right now, kvm keeps the memory allocation split, so we can handle different areas in different ways. This schema works with qemu too, so it appears to be the common ground.

This patch proposes using this common ground for everyone, by spliting raw qemu.

Applied. Thanks.

you're welcome ;-)

Quoted 8 lines

Regards,

Anthony Liguori

Signature · 5 lines
Glauber Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."