0a122b
From 7212bc6c8e9b4a3118e1cc90157c2f123198139e Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Thu, 16 Jan 2014 10:25:57 +0100
0a122b
Subject: [PATCH 02/14] pc_piix: document gigabyte_align
0a122b
0a122b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Message-id: <1389867959-12463-3-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 56745
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 2/4] pc_piix: document gigabyte_align
0a122b
Bugzilla: 1026548
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
0a122b
Document the logic behind the below/above 4G split.
0a122b
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit ecdbfceb0f20a3ef784bf522ed7264660aa3d150)
0a122b
0a122b
Conflicts:
0a122b
	hw/i386/pc_piix.c
0a122b
---
0a122b
 hw/i386/pc_piix.c | 11 +++++++++++
0a122b
 1 file changed, 11 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c |   11 +++++++++++
0a122b
 1 files changed, 11 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 9f1d0b5..12351f9 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -61,6 +61,10 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
0a122b
 static bool smbios_type1_defaults = true;
0a122b
 static bool has_pci_info;
0a122b
 static bool has_acpi_build = true;
0a122b
+/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
0a122b
+ * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
0a122b
+ * pages in the host.
0a122b
+ */
0a122b
 static bool gigabyte_align = true;
0a122b
 
0a122b
 /* PC hardware initialisation */
0a122b
@@ -102,6 +106,13 @@ static void pc_init1(QEMUMachineInitArgs *args,
0a122b
         kvmclock_create();
0a122b
     }
0a122b
 
0a122b
+    /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
0a122b
+     * If it doesn't, we need to split it in chunks below and above 4G.
0a122b
+     * In any case, try to make sure that guest addresses aligned at
0a122b
+     * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
0a122b
+     * For old machine types, use whatever split we used historically to avoid
0a122b
+     * breaking migration.
0a122b
+     */
0a122b
     if (args->ram_size >= 0xe0000000) {
0a122b
         ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
0a122b
         above_4g_mem_size = args->ram_size - lowmem;
0a122b
-- 
0a122b
1.7.1
0a122b