|
|
34b321 |
From 87f01cd69488bf39e80c422b92717029fed0bef6 Mon Sep 17 00:00:00 2001
|
|
|
34b321 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
34b321 |
Date: Wed, 11 May 2016 12:33:43 +0200
|
|
|
34b321 |
Subject: [PATCH 04/10] acpi: fix endian-ness for table ids
|
|
|
34b321 |
|
|
|
34b321 |
RH-Author: Laszlo Ersek <lersek@redhat.com>
|
|
|
34b321 |
Message-id: <1462970028-10959-3-git-send-email-lersek@redhat.com>
|
|
|
34b321 |
Patchwork-id: 70379
|
|
|
34b321 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 2/7] acpi: fix endian-ness for table ids
|
|
|
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 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
34b321 |
|
|
|
34b321 |
when using signature for table ID, we forgot to byte-swap it.
|
|
|
34b321 |
signatures are really ASCII strings, let's treat them as such.
|
|
|
34b321 |
While at it, get rid of most of _SIGNATURE macros.
|
|
|
34b321 |
|
|
|
34b321 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
34b321 |
(cherry picked from commit 821e3227863ea8db057190e578efa0f1f57ed9de)
|
|
|
34b321 |
|
|
|
34b321 |
RHEL-7 backport notes: this patch is being backported only to decrease the
|
|
|
34b321 |
number of conflicts in the upcoming patches; we only support x86_64 hosts,
|
|
|
34b321 |
which is unaffected by the endianness issue described in the upstream
|
|
|
34b321 |
commit message.
|
|
|
34b321 |
|
|
|
34b321 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
34b321 |
---
|
|
|
34b321 |
hw/i386/acpi-defs.h | 14 --------------
|
|
|
34b321 |
hw/i386/acpi-build.c | 31 ++++++++++++++++---------------
|
|
|
34b321 |
2 files changed, 16 insertions(+), 29 deletions(-)
|
|
|
34b321 |
|
|
|
34b321 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
34b321 |
---
|
|
|
34b321 |
hw/i386/acpi-build.c | 31 ++++++++++++++++---------------
|
|
|
34b321 |
hw/i386/acpi-defs.h | 14 --------------
|
|
|
34b321 |
2 files changed, 16 insertions(+), 29 deletions(-)
|
|
|
34b321 |
|
|
|
34b321 |
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
|
|
|
34b321 |
index a3a4c3b..be32bc3 100644
|
|
|
34b321 |
--- a/hw/i386/acpi-build.c
|
|
|
34b321 |
+++ b/hw/i386/acpi-build.c
|
|
|
34b321 |
@@ -243,14 +243,14 @@ static void acpi_get_pci_info(PcPciInfo *info)
|
|
|
34b321 |
|
|
|
34b321 |
static void
|
|
|
34b321 |
build_header(GArray *linker, GArray *table_data,
|
|
|
34b321 |
- AcpiTableHeader *h, uint32_t sig, int len, uint8_t rev)
|
|
|
34b321 |
+ AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
|
|
|
34b321 |
{
|
|
|
34b321 |
- h->signature = cpu_to_le32(sig);
|
|
|
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 |
memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
|
|
|
34b321 |
- memcpy(h->oem_table_id + 4, (void *)&sig, 4);
|
|
|
34b321 |
+ memcpy(h->oem_table_id + 4, sig, 4);
|
|
|
34b321 |
h->oem_revision = cpu_to_le32(1);
|
|
|
34b321 |
memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);
|
|
|
34b321 |
h->asl_compiler_revision = cpu_to_le32(1);
|
|
|
34b321 |
@@ -463,7 +463,7 @@ static void
|
|
|
34b321 |
build_facs(GArray *table_data, GArray *linker, PcGuestInfo *guest_info)
|
|
|
34b321 |
{
|
|
|
34b321 |
AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs);
|
|
|
34b321 |
- facs->signature = cpu_to_le32(ACPI_FACS_SIGNATURE);
|
|
|
34b321 |
+ memcpy(&facs->signature, "FACS", 4);
|
|
|
34b321 |
facs->length = cpu_to_le32(sizeof(*facs));
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
@@ -520,7 +520,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, ACPI_FACP_SIGNATURE, sizeof(*fadt), 1);
|
|
|
34b321 |
+ (void *)fadt, "FACP", sizeof(*fadt), 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
static void
|
|
|
34b321 |
@@ -589,7 +589,7 @@ build_madt(GArray *table_data, GArray *linker, AcpiCpuInfo *cpu,
|
|
|
34b321 |
local_nmi->lint = 1; /* ACPI_LINT1 */
|
|
|
34b321 |
|
|
|
34b321 |
build_header(linker, table_data,
|
|
|
34b321 |
- (void *)(table_data->data + madt_start), ACPI_APIC_SIGNATURE,
|
|
|
34b321 |
+ (void *)(table_data->data + madt_start), "APIC",
|
|
|
34b321 |
table_data->len - madt_start, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
@@ -782,7 +782,7 @@ build_ssdt(GArray *table_data, GArray *linker,
|
|
|
34b321 |
|
|
|
34b321 |
build_header(linker, table_data,
|
|
|
34b321 |
(void *)(table_data->data + ssdt_start),
|
|
|
34b321 |
- ACPI_SSDT_SIGNATURE, table_data->len - ssdt_start, 1);
|
|
|
34b321 |
+ "SSDT", table_data->len - ssdt_start, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
static void
|
|
|
34b321 |
@@ -797,7 +797,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, ACPI_HPET_SIGNATURE, sizeof(*hpet), 1);
|
|
|
34b321 |
+ (void *)hpet, "HPET", sizeof(*hpet), 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
static void
|
|
|
34b321 |
@@ -889,7 +889,7 @@ build_srat(GArray *table_data, GArray *linker,
|
|
|
34b321 |
|
|
|
34b321 |
build_header(linker, table_data,
|
|
|
34b321 |
(void *)(table_data->data + srat_start),
|
|
|
34b321 |
- ACPI_SRAT_SIGNATURE,
|
|
|
34b321 |
+ "SRAT",
|
|
|
34b321 |
table_data->len - srat_start, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
@@ -897,7 +897,7 @@ static void
|
|
|
34b321 |
build_mcfg_q35(GArray *table_data, GArray *linker, AcpiMcfgInfo *info)
|
|
|
34b321 |
{
|
|
|
34b321 |
AcpiTableMcfg *mcfg;
|
|
|
34b321 |
- uint32_t sig;
|
|
|
34b321 |
+ const char *sig;
|
|
|
34b321 |
int len = sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]);
|
|
|
34b321 |
|
|
|
34b321 |
mcfg = acpi_data_push(table_data, len);
|
|
|
34b321 |
@@ -914,9 +914,10 @@ build_mcfg_q35(GArray *table_data, GArray *linker, AcpiMcfgInfo *info)
|
|
|
34b321 |
* ACPI spec requires OSPMs to ignore such tables.
|
|
|
34b321 |
*/
|
|
|
34b321 |
if (info->mcfg_base == PCIE_BASE_ADDR_UNMAPPED) {
|
|
|
34b321 |
- sig = ACPI_RSRV_SIGNATURE;
|
|
|
34b321 |
+ /* Reserved signature: ignored by OSPM */
|
|
|
34b321 |
+ sig = "QEMU";
|
|
|
34b321 |
} else {
|
|
|
34b321 |
- sig = ACPI_MCFG_SIGNATURE;
|
|
|
34b321 |
+ sig = "MCFG";
|
|
|
34b321 |
}
|
|
|
34b321 |
build_header(linker, table_data, (void *)mcfg, sig, len, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
@@ -932,7 +933,7 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
|
|
|
34b321 |
memcpy(dsdt, misc->dsdt_code, misc->dsdt_size);
|
|
|
34b321 |
|
|
|
34b321 |
memset(dsdt, 0, sizeof *dsdt);
|
|
|
34b321 |
- build_header(linker, table_data, dsdt, ACPI_DSDT_SIGNATURE,
|
|
|
34b321 |
+ build_header(linker, table_data, dsdt, "DSDT",
|
|
|
34b321 |
misc->dsdt_size, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
@@ -957,7 +958,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, ACPI_RSDT_SIGNATURE, rsdt_len, 1);
|
|
|
34b321 |
+ (void *)rsdt, "RSDT", rsdt_len, 1);
|
|
|
34b321 |
}
|
|
|
34b321 |
|
|
|
34b321 |
static GArray *
|
|
|
34b321 |
@@ -968,7 +969,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
|
|
|
34b321 |
bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 1,
|
|
|
34b321 |
true /* fseg memory */);
|
|
|
34b321 |
|
|
|
34b321 |
- rsdp->signature = cpu_to_le64(ACPI_RSDP_SIGNATURE);
|
|
|
34b321 |
+ memcpy(&rsdp->signature, "RSD PTR ", 8);
|
|
|
34b321 |
memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, 6);
|
|
|
34b321 |
rsdp->rsdt_physical_address = cpu_to_le32(rsdt);
|
|
|
34b321 |
/* Address to be filled by Guest linker */
|
|
|
34b321 |
diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h
|
|
|
34b321 |
index 78ca204..e93babb 100644
|
|
|
34b321 |
--- a/hw/i386/acpi-defs.h
|
|
|
34b321 |
+++ b/hw/i386/acpi-defs.h
|
|
|
34b321 |
@@ -52,8 +52,6 @@ struct Acpi20GenericAddress {
|
|
|
34b321 |
} QEMU_PACKED;
|
|
|
34b321 |
typedef struct Acpi20GenericAddress Acpi20GenericAddress;
|
|
|
34b321 |
|
|
|
34b321 |
-#define ACPI_RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR "
|
|
|
34b321 |
-
|
|
|
34b321 |
struct AcpiRsdpDescriptor { /* Root System Descriptor Pointer */
|
|
|
34b321 |
uint64_t signature; /* ACPI signature, contains "RSD PTR " */
|
|
|
34b321 |
uint8_t checksum; /* To make sum of struct == 0 */
|
|
|
34b321 |
@@ -92,7 +90,6 @@ typedef struct AcpiTableHeader AcpiTableHeader;
|
|
|
34b321 |
/*
|
|
|
34b321 |
* ACPI 1.0 Fixed ACPI Description Table (FADT)
|
|
|
34b321 |
*/
|
|
|
34b321 |
-#define ACPI_FACP_SIGNATURE 0x50434146 // FACP
|
|
|
34b321 |
struct AcpiFadtDescriptorRev1
|
|
|
34b321 |
{
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
|
|
|
34b321 |
@@ -141,7 +138,6 @@ typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
|
|
|
34b321 |
/*
|
|
|
34b321 |
* ACPI 1.0 Root System Description Table (RSDT)
|
|
|
34b321 |
*/
|
|
|
34b321 |
-#define ACPI_RSDT_SIGNATURE 0x54445352 // RSDT
|
|
|
34b321 |
struct AcpiRsdtDescriptorRev1
|
|
|
34b321 |
{
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
|
|
|
34b321 |
@@ -153,7 +149,6 @@ typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1;
|
|
|
34b321 |
/*
|
|
|
34b321 |
* ACPI 1.0 Firmware ACPI Control Structure (FACS)
|
|
|
34b321 |
*/
|
|
|
34b321 |
-#define ACPI_FACS_SIGNATURE 0x53434146 // FACS
|
|
|
34b321 |
struct AcpiFacsDescriptorRev1
|
|
|
34b321 |
{
|
|
|
34b321 |
uint32_t signature; /* ACPI Signature */
|
|
|
34b321 |
@@ -169,7 +164,6 @@ typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1;
|
|
|
34b321 |
/*
|
|
|
34b321 |
* Differentiated System Description Table (DSDT)
|
|
|
34b321 |
*/
|
|
|
34b321 |
-#define ACPI_DSDT_SIGNATURE 0x54445344 // DSDT
|
|
|
34b321 |
|
|
|
34b321 |
/*
|
|
|
34b321 |
* MADT values and structures
|
|
|
34b321 |
@@ -182,7 +176,6 @@ typedef struct AcpiFacsDescriptorRev1 AcpiFacsDescriptorRev1;
|
|
|
34b321 |
|
|
|
34b321 |
/* Master MADT */
|
|
|
34b321 |
|
|
|
34b321 |
-#define ACPI_APIC_SIGNATURE 0x43495041 // APIC
|
|
|
34b321 |
struct AcpiMultipleApicTable
|
|
|
34b321 |
{
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
|
|
|
34b321 |
@@ -253,7 +246,6 @@ typedef struct AcpiMadtLocalNmi AcpiMadtLocalNmi;
|
|
|
34b321 |
/*
|
|
|
34b321 |
* HPET Description Table
|
|
|
34b321 |
*/
|
|
|
34b321 |
-#define ACPI_HPET_SIGNATURE 0x54455048 // HPET
|
|
|
34b321 |
struct Acpi20Hpet {
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF /* ACPI common table header */
|
|
|
34b321 |
uint32_t timer_block_id;
|
|
|
34b321 |
@@ -268,7 +260,6 @@ typedef struct Acpi20Hpet Acpi20Hpet;
|
|
|
34b321 |
* SRAT (NUMA topology description) table
|
|
|
34b321 |
*/
|
|
|
34b321 |
|
|
|
34b321 |
-#define ACPI_SRAT_SIGNATURE 0x54415253 // SRAT
|
|
|
34b321 |
struct AcpiSystemResourceAffinityTable
|
|
|
34b321 |
{
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF
|
|
|
34b321 |
@@ -316,11 +307,6 @@ struct AcpiMcfgAllocation {
|
|
|
34b321 |
} QEMU_PACKED;
|
|
|
34b321 |
typedef struct AcpiMcfgAllocation AcpiMcfgAllocation;
|
|
|
34b321 |
|
|
|
34b321 |
-#define ACPI_MCFG_SIGNATURE 0x4746434d // MCFG
|
|
|
34b321 |
-
|
|
|
34b321 |
-/* Reserved signature: ignored by OSPM */
|
|
|
34b321 |
-#define ACPI_RSRV_SIGNATURE 0x554d4551 // QEMU
|
|
|
34b321 |
-
|
|
|
34b321 |
struct AcpiTableMcfg {
|
|
|
34b321 |
ACPI_TABLE_HEADER_DEF;
|
|
|
34b321 |
uint8_t reserved[8];
|
|
|
34b321 |
--
|
|
|
34b321 |
1.8.3.1
|
|
|
34b321 |
|