From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vv82m-0005tn-EO for qemu-devel@nongnu.org; Mon, 23 Dec 2013 11:07:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vv82f-0000pA-Gl for qemu-devel@nongnu.org; Mon, 23 Dec 2013 11:07:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vv82f-0000p4-9G for qemu-devel@nongnu.org; Mon, 23 Dec 2013 11:07:41 -0500 Date: Mon, 23 Dec 2013 18:11:36 +0200 From: "Michael S. Tsirkin" Message-ID: <1387815007-1272-3-git-send-email-mst@redhat.com> References: <1387815007-1272-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1387815007-1272-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 02/19] pc_piix: document gigabyte_align List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori Document the logic behind the below/above 4G split. Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index acb9445..832e20c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -61,6 +61,10 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; static bool has_pci_info; static bool has_acpi_build = true; static bool smbios_type1_defaults = true; +/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to + * host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte + * pages in the host. + */ static bool gigabyte_align = true; /* PC hardware initialisation */ @@ -107,6 +111,13 @@ static void pc_init1(QEMUMachineInitArgs *args, kvmclock_create(); } + /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory). + * If it doesn't, we need to split it in chunks below and above 4G. + * In any case, try to make sure that guest addresses aligned at + * 1G boundaries get mapped to host addresses aligned at 1G boundaries. + * For old machine types, use whatever split we used historically to avoid + * breaking migration. + */ if (args->ram_size >= 0xe0000000) { ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000; above_4g_mem_size = args->ram_size - lowmem; -- MST