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