9ae3a8
From 607904cf94b1dee91c74522aedebda308ffba93d Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Wed, 11 May 2016 12:33:48 +0200
9ae3a8
Subject: [PATCH 09/10] pc: set the OEM fields in the RSDT and the FADT from
9ae3a8
 the SLIC
9ae3a8
9ae3a8
RH-Author: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: <1462970028-10959-8-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 70384
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 7/7] pc: set the OEM fields in the RSDT and the FADT from the SLIC
9ae3a8
Bugzilla: 1330969
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9ae3a8
9ae3a8
The Microsoft spec about the SLIC and MSDM ACPI tables at
9ae3a8
<http://go.microsoft.com/fwlink/p/?LinkId=234834> requires the OEM ID and
9ae3a8
OEM Table ID fields to be consistent between the SLIC and the RSDT/XSDT.
9ae3a8
That further affects the FADT, because a similar match between the FADT
9ae3a8
and the RSDT/XSDT is required by the ACPI spec in general.
9ae3a8
9ae3a8
This patch wires up the previous three patches.
9ae3a8
9ae3a8
Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
9ae3a8
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
9ae3a8
Cc: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
9ae3a8
Cc: Richard W.M. Jones <rjones@redhat.com>
9ae3a8
Cc: Aleksei Kovura <alex3kov@zoho.com>
9ae3a8
Cc: Michael Tokarev <mjt@tls.msk.ru>
9ae3a8
Cc: Steven Newbury <steve@snewbury.org.uk>
9ae3a8
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
9ae3a8
LP: https://bugs.launchpad.net/qemu/+bug/1533848
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Reviewed-by: Steven Newbury <steve@snewbury.org.uk>
9ae3a8
(cherry picked from commit ae12374951f07157f7a52c8d848b90f8eec722fb)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	hw/i386/acpi-build.c
9ae3a8
9ae3a8
RHEL-7 backport note: conflict due to downstream lacking 7c2c1fa5f428
9ae3a8
("pc: acpi: use local var for accessing ACPI tables blob in
9ae3a8
acpi_build()").
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 13 +++++++++----
9ae3a8
 qemu-options.hx      |  4 ++++
9ae3a8
 2 files changed, 13 insertions(+), 4 deletions(-)
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 13 +++++++++----
9ae3a8
 qemu-options.hx      |  4 ++++
9ae3a8
 2 files changed, 13 insertions(+), 4 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
9ae3a8
index d9433e6..85291f5 100644
9ae3a8
--- a/hw/i386/acpi-build.c
9ae3a8
+++ b/hw/i386/acpi-build.c
9ae3a8
@@ -511,7 +511,8 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
9ae3a8
 /* FADT */
9ae3a8
 static void
9ae3a8
 build_fadt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,
9ae3a8
-           unsigned facs, unsigned dsdt)
9ae3a8
+           unsigned facs, unsigned dsdt,
9ae3a8
+           const char *oem_id, const char *oem_table_id)
9ae3a8
 {
9ae3a8
     AcpiFadtDescriptorRev1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
9ae3a8
 
9ae3a8
@@ -532,7 +533,7 @@ build_fadt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,
9ae3a8
     fadt_setup(fadt, pm);
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL, NULL);
9ae3a8
+                 (void *)fadt, "FACP", sizeof(*fadt), 1, oem_id, oem_table_id);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -1065,6 +1066,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
9ae3a8
     AcpiMcfgInfo mcfg;
9ae3a8
     PcPciInfo pci;
9ae3a8
     uint8_t *u;
9ae3a8
+    AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
9ae3a8
 
9ae3a8
     acpi_get_cpu_info(&cpu);
9ae3a8
     acpi_get_pm_info(&pm);
9ae3a8
@@ -1072,6 +1074,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
9ae3a8
     acpi_get_hotplug_info(&misc);
9ae3a8
     acpi_get_misc_info(&misc);
9ae3a8
     acpi_get_pci_info(&pci;;
9ae3a8
+    acpi_get_slic_oem(&slic_oem);
9ae3a8
 
9ae3a8
     table_offsets = g_array_new(false, true /* clear */,
9ae3a8
                                         sizeof(uint32_t));
9ae3a8
@@ -1095,7 +1098,8 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
9ae3a8
 
9ae3a8
     /* ACPI tables pointed to by RSDT */
9ae3a8
     acpi_add_table(table_offsets, tables->table_data);
9ae3a8
-    build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
9ae3a8
+    build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt,
9ae3a8
+               slic_oem.id, slic_oem.table_id);
9ae3a8
 
9ae3a8
     acpi_add_table(table_offsets, tables->table_data);
9ae3a8
     build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
9ae3a8
@@ -1127,7 +1131,8 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
9ae3a8
 
9ae3a8
     /* RSDT is pointed to by RSDP */
9ae3a8
     rsdt = tables->table_data->len;
9ae3a8
-    build_rsdt(tables->table_data, tables->linker, table_offsets, NULL, NULL);
9ae3a8
+    build_rsdt(tables->table_data, tables->linker, table_offsets,
9ae3a8
+               slic_oem.id, slic_oem.table_id);
9ae3a8
 
9ae3a8
     /* RSDP is in FSEG memory, so allocate it separately */
9ae3a8
     build_rsdp(tables->rsdp, tables->linker, rsdt);
9ae3a8
diff --git a/qemu-options.hx b/qemu-options.hx
9ae3a8
index 62c3e06..24ffab6 100644
9ae3a8
--- a/qemu-options.hx
9ae3a8
+++ b/qemu-options.hx
9ae3a8
@@ -1295,6 +1295,10 @@ ACPI headers (possible overridden by other options).
9ae3a8
 For data=, only data
9ae3a8
 portion of the table is used, all header information is specified in the
9ae3a8
 command line.
9ae3a8
+If a SLIC table is supplied to QEMU, then the SLIC's oem_id and oem_table_id
9ae3a8
+fields will override the same in the RSDT and the FADT (a.k.a. FACP), in order
9ae3a8
+to ensure the field matches required by the Microsoft SLIC spec and the ACPI
9ae3a8
+spec.
9ae3a8
 ETEXI
9ae3a8
 
9ae3a8
 DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8