From patchwork Wed Feb 24 21:11:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 46207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 752CFB7C59 for ; Thu, 25 Feb 2010 08:22:03 +1100 (EST) Received: from localhost ([127.0.0.1]:48042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkOgC-0003DR-Lc for incoming@patchwork.ozlabs.org; Wed, 24 Feb 2010 16:22:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkOb1-0002A3-Lc for qemu-devel@nongnu.org; Wed, 24 Feb 2010 16:16:39 -0500 Received: from [199.232.76.173] (port=51045 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkOb0-000296-IE for qemu-devel@nongnu.org; Wed, 24 Feb 2010 16:16:38 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkOax-0003yb-9F for qemu-devel@nongnu.org; Wed, 24 Feb 2010 16:16:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47452) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkOav-0003xx-T3 for qemu-devel@nongnu.org; Wed, 24 Feb 2010 16:16:34 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1OLGU6g002871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 24 Feb 2010 16:16:30 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1OLGT8f011619; Wed, 24 Feb 2010 16:16:30 -0500 Received: from amt.cnet (vpn-11-25.rdu.redhat.com [10.11.11.25]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o1OLGSGh006795; Wed, 24 Feb 2010 16:16:28 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 4B5ED66E10D; Wed, 24 Feb 2010 18:15:44 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o1OLFhMT014262; Wed, 24 Feb 2010 18:15:43 -0300 Message-Id: <20100224211507.671656939@amt.cnet> User-Agent: quilt/0.47-1 Date: Wed, 24 Feb 2010 18:11:19 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org, qemu-devel@nongnu.org References: <20100224211117.958583246@amt.cnet> Content-Disposition: inline; filename=one-4gb-area.patch X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: avi@redhat.com Subject: [Qemu-devel] [patch uq/master 1/2] Allocate memory below 4GB as one chunk X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {