cryptospore / rpms / qemu-kvm

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