958e1b
From aa98e5248b83b5eed5230e582a21156373d9fc72 Mon Sep 17 00:00:00 2001
958e1b
From: Laszlo Ersek <lersek@redhat.com>
958e1b
Date: Wed, 13 Aug 2014 07:59:41 +0200
958e1b
Subject: [PATCH 04/11] acpi: fix tables for no-hpet configuration
958e1b
958e1b
Message-id: <1407916781-22610-2-git-send-email-lersek@redhat.com>
958e1b
Patchwork-id: 60549
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] acpi: fix tables for no-hpet configuration
958e1b
Bugzilla: 1129552
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
958e1b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
958e1b
958e1b
From: "Michael S. Tsirkin" <mst@redhat.com>
958e1b
958e1b
acpi build tried to add offset of hpet table to rsdt even when hpet was
958e1b
disabled.  If no tables follow hpet, this could lead to a malformed
958e1b
rsdt.
958e1b
958e1b
Fix it up.
958e1b
958e1b
To avoid such errors in the future, rearrange code slightly to make it
958e1b
clear that acpi_add_table stores the offset of the following table - not
958e1b
of the previous one.
958e1b
958e1b
Reported-by: TeLeMan <geleman@gmail.com>
958e1b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
958e1b
Cc: qemu-stable@nongnu.org
958e1b
(cherry picked from commit 9ac1c4c07e7e6ab16a3e2149e9b32c0d092cb3f5)
958e1b
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
958e1b
---
958e1b
 hw/i386/acpi-build.c | 7 ++++---
958e1b
 1 file changed, 4 insertions(+), 3 deletions(-)
958e1b
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
---
958e1b
 hw/i386/acpi-build.c |    7 ++++---
958e1b
 1 files changed, 4 insertions(+), 3 deletions(-)
958e1b
958e1b
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
958e1b
index 33012c9..8be1286 100644
958e1b
--- a/hw/i386/acpi-build.c
958e1b
+++ b/hw/i386/acpi-build.c
958e1b
@@ -1076,15 +1076,16 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
958e1b
     /* ACPI tables pointed to by RSDT */
958e1b
     acpi_add_table(table_offsets, tables->table_data);
958e1b
     build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
958e1b
-    acpi_add_table(table_offsets, tables->table_data);
958e1b
 
958e1b
+    acpi_add_table(table_offsets, tables->table_data);
958e1b
     build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
958e1b
                guest_info);
958e1b
-    acpi_add_table(table_offsets, tables->table_data);
958e1b
 
958e1b
-    build_madt(tables->table_data, tables->linker, &cpu, guest_info);
958e1b
     acpi_add_table(table_offsets, tables->table_data);
958e1b
+    build_madt(tables->table_data, tables->linker, &cpu, guest_info);
958e1b
+
958e1b
     if (misc.has_hpet) {
958e1b
+        acpi_add_table(table_offsets, tables->table_data);
958e1b
         build_hpet(tables->table_data, tables->linker);
958e1b
     }
958e1b
     if (guest_info->numa_nodes) {
958e1b
-- 
958e1b
1.7.1
958e1b