cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-acpi-support-specified-oem-table-id-for-build_header.patch

9ae3a8
From b36e60614f9c4a6eb3f417422c3cb99402b82963 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Wed, 11 May 2016 12:33:44 +0200
9ae3a8
Subject: [PATCH 05/10] acpi: support specified oem table id for build_header
9ae3a8
9ae3a8
RH-Author: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: <1462970028-10959-4-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 70380
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 3/7] acpi: support specified oem table id for build_header
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
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
9ae3a8
9ae3a8
Let build_header() support specified OEM table id so that we can build
9ae3a8
multiple SSDT later
9ae3a8
9ae3a8
If the oem table id is not specified (aka, NULL), we use the default id
9ae3a8
instead as the previous behavior
9ae3a8
9ae3a8
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.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 8870ca0e94f2524644812dd759863c0851ffb870)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	hw/acpi/aml-build.c
9ae3a8
	hw/arm/virt-acpi-build.c
9ae3a8
	hw/i386/acpi-build.c
9ae3a8
	include/hw/acpi/aml-build.h
9ae3a8
9ae3a8
RHEL-7 backport note: this is actually a manual reimplementation of the
9ae3a8
upstream patch, which is mostly mechanic. A clean cherry-pick would depend
9ae3a8
on a lot of reorganizatorial upstream patches (e.g., 658c27181bf3
9ae3a8
("hw/i386/acpi-build: move generic acpi building helpers into dedictated
9ae3a8
file")), and many new features that overlap with ACPI generation (e.g.,
9ae3a8
the "virt" machtype of the arm/aarch64 targets).
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 29 ++++++++++++++++++-----------
9ae3a8
 1 file changed, 18 insertions(+), 11 deletions(-)
9ae3a8
---
9ae3a8
 hw/i386/acpi-build.c | 29 ++++++++++++++++++-----------
9ae3a8
 1 file changed, 18 insertions(+), 11 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
9ae3a8
index be32bc3..a9d9f97 100644
9ae3a8
--- a/hw/i386/acpi-build.c
9ae3a8
+++ b/hw/i386/acpi-build.c
9ae3a8
@@ -243,14 +243,21 @@ static void acpi_get_pci_info(PcPciInfo *info)
9ae3a8
 
9ae3a8
 static void
9ae3a8
 build_header(GArray *linker, GArray *table_data,
9ae3a8
-             AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
9ae3a8
+             AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
9ae3a8
+             const char *oem_table_id)
9ae3a8
 {
9ae3a8
     memcpy(&h->signature, sig, 4);
9ae3a8
     h->length = cpu_to_le32(len);
9ae3a8
     h->revision = rev;
9ae3a8
     memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
9ae3a8
-    memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
9ae3a8
-    memcpy(h->oem_table_id + 4, sig, 4);
9ae3a8
+
9ae3a8
+    if (oem_table_id) {
9ae3a8
+        strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
9ae3a8
+    } else {
9ae3a8
+        memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
9ae3a8
+        memcpy(h->oem_table_id + 4, sig, 4);
9ae3a8
+    }
9ae3a8
+
9ae3a8
     h->oem_revision = cpu_to_le32(1);
9ae3a8
     memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);
9ae3a8
     h->asl_compiler_revision = cpu_to_le32(1);
9ae3a8
@@ -520,7 +527,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);
9ae3a8
+                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -590,7 +597,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu,
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + madt_start), "APIC",
9ae3a8
-                 table_data->len - madt_start, 1);
9ae3a8
+                 table_data->len - madt_start, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 /* Encode a hex value */
9ae3a8
@@ -782,7 +789,7 @@ build_ssdt(GArray *table_data, GArray *linker,
9ae3a8
 
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + ssdt_start),
9ae3a8
-                 "SSDT", table_data->len - ssdt_start, 1);
9ae3a8
+                 "SSDT", table_data->len - ssdt_start, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -797,7 +804,7 @@ build_hpet(GArray *table_data, GArray *linker)
9ae3a8
     hpet->timer_block_id = cpu_to_le32(0x8086a201);
9ae3a8
     hpet->addr.address = cpu_to_le64(HPET_BASE);
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)hpet, "HPET", sizeof(*hpet), 1);
9ae3a8
+                 (void *)hpet, "HPET", sizeof(*hpet), 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -890,7 +897,7 @@ build_srat(GArray *table_data, GArray *linker,
9ae3a8
     build_header(linker, table_data,
9ae3a8
                  (void *)(table_data->data + srat_start),
9ae3a8
                  "SRAT",
9ae3a8
-                 table_data->len - srat_start, 1);
9ae3a8
+                 table_data->len - srat_start, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -919,7 +926,7 @@ build_mcfg_q35(GArray *table_data, GArray *linker, AcpiMcfgInfo *info)
9ae3a8
     } else {
9ae3a8
         sig = "MCFG";
9ae3a8
     }
9ae3a8
-    build_header(linker, table_data, (void *)mcfg, sig, len, 1);
9ae3a8
+    build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static void
9ae3a8
@@ -934,7 +941,7 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
9ae3a8
 
9ae3a8
     memset(dsdt, 0, sizeof *dsdt);
9ae3a8
     build_header(linker, table_data, dsdt, "DSDT",
9ae3a8
-                 misc->dsdt_size, 1);
9ae3a8
+                 misc->dsdt_size, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 /* Build final rsdt table */
9ae3a8
@@ -958,7 +965,7 @@ build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
9ae3a8
                                        sizeof(uint32_t));
9ae3a8
     }
9ae3a8
     build_header(linker, table_data,
9ae3a8
-                 (void *)rsdt, "RSDT", rsdt_len, 1);
9ae3a8
+                 (void *)rsdt, "RSDT", rsdt_len, 1, NULL);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static GArray *
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8