yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-acpi-take-oem_id-in-build_header-optionally.patch

34b321
From 0decede8a51451da8f5913b0ad13c8e3bdcef582 Mon Sep 17 00:00:00 2001
34b321
From: Laszlo Ersek <lersek@redhat.com>
34b321
Date: Wed, 11 May 2016 12:33:45 +0200
34b321
Subject: [PATCH 06/10] acpi: take oem_id in build_header(), optionally
34b321
34b321
RH-Author: Laszlo Ersek <lersek@redhat.com>
34b321
Message-id: <1462970028-10959-5-git-send-email-lersek@redhat.com>
34b321
Patchwork-id: 70381
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 4/7] acpi: take oem_id in build_header(), optionally
34b321
Bugzilla: 1330969
34b321
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
34b321
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
34b321
RH-Acked-by: Thomas Huth <thuth@redhat.com>
34b321
34b321
This patch is the continuation of commit 8870ca0e94f2 ("acpi: support
34b321
specified oem table id for build_header"). It will allow us to control the
34b321
OEM ID field too in the SDT header.
34b321
34b321
Cc: "Michael S. Tsirkin" <mst@redhat.com> (supporter:ACPI/SMBIOS)
34b321
Cc: Igor Mammedov <imammedo@redhat.com> (supporter:ACPI/SMBIOS)
34b321
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com> (maintainer:NVDIMM)
34b321
Cc: Shannon Zhao <zhaoshenglong@huawei.com> (maintainer:ARM ACPI Subsystem)
34b321
Cc: Paolo Bonzini <pbonzini@redhat.com> (maintainer:X86)
34b321
Cc: Richard W.M. Jones <rjones@redhat.com>
34b321
Cc: Aleksei Kovura <alex3kov@zoho.com>
34b321
Cc: Michael Tokarev <mjt@tls.msk.ru>
34b321
Cc: Steven Newbury <steve@snewbury.org.uk>
34b321
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1248758
34b321
LP: https://bugs.launchpad.net/qemu/+bug/1533848
34b321
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
34b321
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
34b321
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
34b321
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
34b321
(cherry picked from commit 37ad223c515da2fe9f1c679768cb5ccaa42e57e1)
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
34b321
Conflicts:
34b321
	hw/acpi/aml-build.c
34b321
	hw/acpi/nvdimm.c
34b321
	hw/arm/virt-acpi-build.c
34b321
	hw/i386/acpi-build.c
34b321
	include/hw/acpi/aml-build.h
34b321
34b321
RHEL-7 backport note: this is actually a manual reimplementation of the
34b321
upstream patch, which is mostly mechanic. A clean cherry-pick would depend
34b321
on a lot of reorganizatorial upstream patches (e.g., 658c27181bf3
34b321
("hw/i386/acpi-build: move generic acpi building helpers into dedictated
34b321
file")), and many new features that overlap with ACPI generation (e.g.,
34b321
the "virt" machtype of the arm/aarch64 targets).
34b321
34b321
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
34b321
---
34b321
 hw/i386/acpi-build.c | 25 +++++++++++++++----------
34b321
 1 file changed, 15 insertions(+), 10 deletions(-)
34b321
---
34b321
 hw/i386/acpi-build.c | 25 +++++++++++++++----------
34b321
 1 file changed, 15 insertions(+), 10 deletions(-)
34b321
34b321
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
34b321
index a9d9f97..4839b0e 100644
34b321
--- a/hw/i386/acpi-build.c
34b321
+++ b/hw/i386/acpi-build.c
34b321
@@ -244,12 +244,17 @@ static void acpi_get_pci_info(PcPciInfo *info)
34b321
 static void
34b321
 build_header(GArray *linker, GArray *table_data,
34b321
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
34b321
-             const char *oem_table_id)
34b321
+             const char *oem_id, const char *oem_table_id)
34b321
 {
34b321
     memcpy(&h->signature, sig, 4);
34b321
     h->length = cpu_to_le32(len);
34b321
     h->revision = rev;
34b321
-    memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
34b321
+
34b321
+    if (oem_id) {
34b321
+        strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
34b321
+    } else {
34b321
+        memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
34b321
+    }
34b321
 
34b321
     if (oem_table_id) {
34b321
         strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
34b321
@@ -527,7 +532,7 @@ build_fadt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,
34b321
     fadt_setup(fadt, pm);
34b321
 
34b321
     build_header(linker, table_data,
34b321
-                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL);
34b321
+                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static void
34b321
@@ -597,7 +602,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu,
34b321
 
34b321
     build_header(linker, table_data,
34b321
                  (void *)(table_data->data + madt_start), "APIC",
34b321
-                 table_data->len - madt_start, 1, NULL);
34b321
+                 table_data->len - madt_start, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 /* Encode a hex value */
34b321
@@ -789,7 +794,7 @@ build_ssdt(GArray *table_data, GArray *linker,
34b321
 
34b321
     build_header(linker, table_data,
34b321
                  (void *)(table_data->data + ssdt_start),
34b321
-                 "SSDT", table_data->len - ssdt_start, 1, NULL);
34b321
+                 "SSDT", table_data->len - ssdt_start, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static void
34b321
@@ -804,7 +809,7 @@ build_hpet(GArray *table_data, GArray *linker)
34b321
     hpet->timer_block_id = cpu_to_le32(0x8086a201);
34b321
     hpet->addr.address = cpu_to_le64(HPET_BASE);
34b321
     build_header(linker, table_data,
34b321
-                 (void *)hpet, "HPET", sizeof(*hpet), 1, NULL);
34b321
+                 (void *)hpet, "HPET", sizeof(*hpet), 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static void
34b321
@@ -897,7 +902,7 @@ build_srat(GArray *table_data, GArray *linker,
34b321
     build_header(linker, table_data,
34b321
                  (void *)(table_data->data + srat_start),
34b321
                  "SRAT",
34b321
-                 table_data->len - srat_start, 1, NULL);
34b321
+                 table_data->len - srat_start, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static void
34b321
@@ -926,7 +931,7 @@ build_mcfg_q35(GArray *table_data, GArray *linker, AcpiMcfgInfo *info)
34b321
     } else {
34b321
         sig = "MCFG";
34b321
     }
34b321
-    build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL);
34b321
+    build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static void
34b321
@@ -941,7 +946,7 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
34b321
 
34b321
     memset(dsdt, 0, sizeof *dsdt);
34b321
     build_header(linker, table_data, dsdt, "DSDT",
34b321
-                 misc->dsdt_size, 1, NULL);
34b321
+                 misc->dsdt_size, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 /* Build final rsdt table */
34b321
@@ -965,7 +970,7 @@ build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
34b321
                                        sizeof(uint32_t));
34b321
     }
34b321
     build_header(linker, table_data,
34b321
-                 (void *)rsdt, "RSDT", rsdt_len, 1, NULL);
34b321
+                 (void *)rsdt, "RSDT", rsdt_len, 1, NULL, NULL);
34b321
 }
34b321
 
34b321
 static GArray *
34b321
-- 
34b321
1.8.3.1
34b321