0a122b
From 6a2046866f4e057da661d496fc8014e5bca0d44e Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Thu, 16 Jan 2014 10:25:59 +0100
0a122b
Subject: [PATCH 03/14] q35: gigabyle alignment for ram
0a122b
0a122b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Message-id: <1389867959-12463-5-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 56746
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 4/4] q35: gigabyle alignment for ram
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
Map 2G of memory below 4G, so the two RAM pieces are nicely
0a122b
aligned to gigabyte borders.
0a122b
0a122b
Keep old memory layout for in case all memory fits below 4G and
0a122b
thus we don't have to split RAM into pieces in the first place.
0a122b
0a122b
upstream: Not yet.  Planned, but want sort mmconf bar issues first.
0a122b
          Put into rhel7 nevertheless to make life simpler for rhel8
0a122b
          (i.e. no need to support gigabyte alignment the rhel6 way).
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_q35.c | 6 ++++--
0a122b
 1 file changed, 4 insertions(+), 2 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_q35.c |    6 ++++--
0a122b
 1 files changed, 4 insertions(+), 2 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
0a122b
index 232c62d..7e46799 100644
0a122b
--- a/hw/i386/pc_q35.c
0a122b
+++ b/hw/i386/pc_q35.c
0a122b
@@ -51,6 +51,7 @@
0a122b
 static bool smbios_type1_defaults = true;
0a122b
 static bool has_pci_info;
0a122b
 static bool has_acpi_build = true;
0a122b
+static bool gigabyte_align = true;
0a122b
 
0a122b
 /* PC hardware initialisation */
0a122b
 static void pc_q35_init(QEMUMachineInitArgs *args)
0a122b
@@ -87,8 +88,9 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
0a122b
     kvmclock_create();
0a122b
 
0a122b
     if (args->ram_size >= 0xb0000000) {
0a122b
-        above_4g_mem_size = args->ram_size - 0xb0000000;
0a122b
-        below_4g_mem_size = 0xb0000000;
0a122b
+        ram_addr_t lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;
0a122b
+        above_4g_mem_size = args->ram_size - lowmem;
0a122b
+        below_4g_mem_size = lowmem;
0a122b
     } else {
0a122b
         above_4g_mem_size = 0;
0a122b
         below_4g_mem_size = args->ram_size;
0a122b
-- 
0a122b
1.7.1
0a122b