From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch uq/master 1/2] Allocate memory below 4GB as one chunk Date: Wed, 24 Feb 2010 18:11:19 -0300 Message-ID: <20100224211507.671656939@amt.cnet> References: <20100224211117.958583246@amt.cnet> Cc: avi@redhat.com To: kvm@vger.kernel.org, qemu-devel@nongnu.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38506 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758119Ab0BXVQf (ORCPT ); Wed, 24 Feb 2010 16:16:35 -0500 Content-Disposition: inline; filename=one-4gb-area.patch Sender: kvm-owner@vger.kernel.org List-ID: From: Avi Kivity Instead of allocating a separate chunk for the first 640KB and another for 1MB+, allocate one large chunk. This plays well in terms of alignment and size with large pages. Signed-off-by: Avi Kivity (cherry picked from commit cfe0cef63988a7876a9bbcb098500a3983e63814) Index: qemu-kvm/hw/pc.c =================================================================== --- qemu-kvm.orig/hw/pc.c +++ qemu-kvm/hw/pc.c @@ -798,18 +798,11 @@ static void pc_init1(ram_addr_t ram_size vmport_init(); /* allocate RAM */ - ram_addr = qemu_ram_alloc(0xa0000); + ram_addr = qemu_ram_alloc(below_4g_mem_size); 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); + ram_addr + 0x100000); /* above 4giga memory allocation */ if (above_4g_mem_size > 0) {