Commit 82b36dc39890f1ba6b7017b8d2e912503cef6cf9

Authored by aliguori
1 parent 434929bf

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.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5228 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 16 additions and 4 deletions
@@ -777,16 +777,28 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, @@ -777,16 +777,28 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
777 vmport_init(); 777 vmport_init();
778 778
779 /* allocate RAM */ 779 /* allocate RAM */
780 - ram_addr = qemu_ram_alloc(ram_size);  
781 - cpu_register_physical_memory(0, below_4g_mem_size, ram_addr); 780 + ram_addr = qemu_ram_alloc(0xa0000);
  781 + cpu_register_physical_memory(0, 0xa0000, ram_addr);
  782 +
  783 + /* Allocate, even though we won't register, so we don't break the
  784 + * phys_ram_base + PA assumption. This range includes vga (0xa0000 - 0xc0000),
  785 + * and some bios areas, which will be registered later
  786 + */
  787 + ram_addr = qemu_ram_alloc(0x100000 - 0xa0000);
  788 + ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000);
  789 + cpu_register_physical_memory(0x100000,
  790 + below_4g_mem_size - 0x100000,
  791 + ram_addr);
782 792
783 /* above 4giga memory allocation */ 793 /* above 4giga memory allocation */
784 if (above_4g_mem_size > 0) { 794 if (above_4g_mem_size > 0) {
785 - cpu_register_physical_memory((target_phys_addr_t) 0x100000000ULL, 795 + ram_addr = qemu_ram_alloc(above_4g_mem_size);
  796 + cpu_register_physical_memory(0x100000000ULL,
786 above_4g_mem_size, 797 above_4g_mem_size,
787 - ram_addr + below_4g_mem_size); 798 + ram_addr);
788 } 799 }
789 800
  801 +
790 /* allocate VGA RAM */ 802 /* allocate VGA RAM */
791 vga_ram_addr = qemu_ram_alloc(vga_ram_size); 803 vga_ram_addr = qemu_ram_alloc(vga_ram_size);
792 804