thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From 8d2dfb2e031ded182868c14423b874464cd98949 Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Mon, 27 Jan 2014 10:31:27 +0100
0a122b
Subject: [PATCH 01/14] piix: gigabyte alignment for ram
0a122b
0a122b
Message-id: <1389867959-12463-2-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 56744
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 1/4] piix: gigabyte 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 3G (i440fx) of memory below 4G, so the RAM pieces
0a122b
are nicely aligned to gigabyte borders.
0a122b
0a122b
Keep old memory layout for (a) old machine types and (b) in case all
0a122b
memory fits below 4G and thus we don't have to split RAM into pieces
0a122b
in the first place.  The later makes sure this change doesn't take
0a122b
away memory from 32bit guests.
0a122b
0a122b
So, with i440fx and up to 3.5 GB of memory, all of it will be mapped
0a122b
below 4G.  With more than 3.5 GB of memory 3 GB will be mapped below
0a122b
4G and the remaining amount will be mapped above 4G.
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit bb43d3839c29b17a2f5c122114cd4ca978065a18)
0a122b
0a122b
Conflicts:
0a122b
	hw/i386/pc_piix.c
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c |    9 ++++++---
0a122b
 1 files changed, 6 insertions(+), 3 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 663c9d5..9f1d0b5 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -61,6 +61,7 @@ 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
+static bool gigabyte_align = true;
0a122b
 
0a122b
 /* PC hardware initialisation */
0a122b
 static void pc_init1(QEMUMachineInitArgs *args,
0a122b
@@ -101,9 +102,10 @@ static void pc_init1(QEMUMachineInitArgs *args,
0a122b
         kvmclock_create();
0a122b
     }
0a122b
 
0a122b
-    if (args->ram_size >= QEMU_BELOW_4G_RAM_END ) {
0a122b
-        above_4g_mem_size = args->ram_size - QEMU_BELOW_4G_RAM_END;
0a122b
-        below_4g_mem_size = QEMU_BELOW_4G_RAM_END;
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
+        below_4g_mem_size = lowmem;
0a122b
     } else {
0a122b
         above_4g_mem_size = 0;
0a122b
         below_4g_mem_size = args->ram_size;
0a122b
@@ -929,6 +931,7 @@ static void pc_compat_rhel650(QEMUMachineInitArgs *args)
0a122b
 
0a122b
     rom_file_in_ram = false; 
0a122b
     has_acpi_build = false;
0a122b
+    gigabyte_align = false;
0a122b
 }
0a122b
 
0a122b
 static void pc_init_rhel650(QEMUMachineInitArgs *args)
0a122b
-- 
0a122b
1.7.1
0a122b