9ae3a8
From fc20209d16cb8ce59b20f3e9b98f99044b8bebaa Mon Sep 17 00:00:00 2001
9ae3a8
From: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Date: Tue, 11 Feb 2014 14:03:48 +0100
9ae3a8
Subject: [PATCH 12/28] acpi: Fix PCI hole handling on build_srat()
9ae3a8
9ae3a8
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Message-id: <1392127428-9286-3-git-send-email-ehabkost@redhat.com>
9ae3a8
Patchwork-id: 57205
9ae3a8
O-Subject: [PATCH 2/2] acpi: Fix PCI hole handling on build_srat()
9ae3a8
Bugzilla: 1048080
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
9ae3a8
Bugzilla: 1048080
9ae3a8
Brew scratch build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7027865
9ae3a8
9ae3a8
The original SeaBIOS code used the RamSize variable, that was used by
9ae3a8
SeaBIOS for the size of RAM below 4GB, not for all RAM. When copied to
9ae3a8
QEMU, the code was changed to use the full RAM size, and this broke the
9ae3a8
build_srat() code that handles the PCI hole.
9ae3a8
9ae3a8
Change build_srat() to use ram_size_below_4g instead of ram_size, to
9ae3a8
restore the original behavior from SeaBIOS.
9ae3a8
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
(cherry picked from commit 4c8a949b2416158a311abefc09a20153aa107e93)
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 10 +++++-----
9ae3a8
 1 file changed, 5 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c |   10 +++++-----
9ae3a8
 1 files changed, 5 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
9ae3a8
index befc39f..33012c9 100644
9ae3a8
--- a/hw/i386/acpi-build.c
9ae3a8
+++ b/hw/i386/acpi-build.c
9ae3a8
@@ -867,16 +867,16 @@ build_srat(GArray *table_data, GArray *linker,
9ae3a8
         next_base = mem_base + mem_len;
9ae3a8
 
9ae3a8
         /* Cut out the ACPI_PCI hole */
9ae3a8
-        if (mem_base <= guest_info->ram_size &&
9ae3a8
-            next_base > guest_info->ram_size) {
9ae3a8
-            mem_len -= next_base - guest_info->ram_size;
9ae3a8
+        if (mem_base <= guest_info->ram_size_below_4g &&
9ae3a8
+            next_base > guest_info->ram_size_below_4g) {
9ae3a8
+            mem_len -= next_base - guest_info->ram_size_below_4g;
9ae3a8
             if (mem_len > 0) {
9ae3a8
                 numamem = acpi_data_push(table_data, sizeof *numamem);
9ae3a8
                 acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
9ae3a8
             }
9ae3a8
             mem_base = 1ULL << 32;
9ae3a8
-            mem_len = next_base - guest_info->ram_size;
9ae3a8
-            next_base += (1ULL << 32) - guest_info->ram_size;
9ae3a8
+            mem_len = next_base - guest_info->ram_size_below_4g;
9ae3a8
+            next_base += (1ULL << 32) - guest_info->ram_size_below_4g;
9ae3a8
         }
9ae3a8
         numamem = acpi_data_push(table_data, sizeof *numamem);
9ae3a8
         acpi_build_srat_memory(numamem, mem_base, mem_len, i - 1, 1);
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8