aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/virt-acpi-build.c
diff options
context:
space:
mode:
authorMarian Postevca <posteuca@mutex.one>2021-01-19 02:32:13 +0200
committerMichael S. Tsirkin <mst@redhat.com>2021-02-05 08:52:59 -0500
commit602b458201ffd6f261fb8ee16b5175d733d3ec32 (patch)
tree7cd70e99e8b445eea3f4dff35a2cc22f93937bc8 /hw/arm/virt-acpi-build.c
parent99f84ac0512b7ce29089a63c392da706fac14cb1 (diff)
downloadqemu-602b458201ffd6f261fb8ee16b5175d733d3ec32.zip
qemu-602b458201ffd6f261fb8ee16b5175d733d3ec32.tar.gz
qemu-602b458201ffd6f261fb8ee16b5175d733d3ec32.tar.bz2
acpi: Permit OEM ID and OEM table ID fields to be changed
Qemu's ACPI table generation sets the fields OEM ID and OEM table ID to "BOCHS " and "BXPCxxxx" where "xxxx" is replaced by the ACPI table name. Some games like Red Dead Redemption 2 seem to check the ACPI OEM ID and OEM table ID for the strings "BOCHS" and "BXPC" and if they are found, the game crashes(this may be an intentional detection mechanism to prevent playing the game in a virtualized environment). This patch allows you to override these default values. The feature can be used in this manner: qemu -machine oem-id=ABCDEF,oem-table-id=GHIJKLMN The oem-id string can be up to 6 bytes in size, and the oem-table-id string can be up to 8 bytes in size. If the string are smaller than their respective sizes they will be padded with space. If either of these parameters is not set, the current default values will be used for the one missing. Note that the the OEM Table ID field will not be extended with the name of the table, but will use either the default name or the user provided one. This does not affect the -acpitable option (for user-defined ACPI tables), which has precedence over -machine option. Signed-off-by: Marian Postevca <posteuca@mutex.one> Message-Id: <20210119003216.17637-3-posteuca@mutex.one> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/arm/virt-acpi-build.c')
-rw-r--r--hw/arm/virt-acpi-build.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 9d9ee24..f9c9df9 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -341,7 +341,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
iort->length = cpu_to_le32(iort_length);
build_header(linker, table_data, (void *)(table_data->data + iort_start),
- "IORT", table_data->len - iort_start, 0, NULL, NULL);
+ "IORT", table_data->len - iort_start, 0, vms->oem_id,
+ vms->oem_table_id);
}
static void
@@ -375,7 +376,8 @@ build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
spcr->pci_vendor_id = 0xffff; /* PCI Vendor ID: not a PCI device */
build_header(linker, table_data, (void *)(table_data->data + spcr_start),
- "SPCR", table_data->len - spcr_start, 2, NULL, NULL);
+ "SPCR", table_data->len - spcr_start, 2, vms->oem_id,
+ vms->oem_table_id);
}
static void
@@ -427,7 +429,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
}
build_header(linker, table_data, (void *)(table_data->data + srat_start),
- "SRAT", table_data->len - srat_start, 3, NULL, NULL);
+ "SRAT", table_data->len - srat_start, 3, vms->oem_id,
+ vms->oem_table_id);
}
/* GTDT */
@@ -462,7 +465,8 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
build_header(linker, table_data,
(void *)(table_data->data + gtdt_start), "GTDT",
- table_data->len - gtdt_start, 2, NULL, NULL);
+ table_data->len - gtdt_start, 2, vms->oem_id,
+ vms->oem_table_id);
}
/* MADT */
@@ -551,7 +555,8 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
build_header(linker, table_data,
(void *)(table_data->data + madt_start), "APIC",
- table_data->len - madt_start, 3, NULL, NULL);
+ table_data->len - madt_start, 3, vms->oem_id,
+ vms->oem_table_id);
}
/* FADT */
@@ -581,7 +586,7 @@ static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker,
g_assert_not_reached();
}
- build_fadt(table_data, linker, &fadt, NULL, NULL);
+ build_fadt(table_data, linker, &fadt, vms->oem_id, vms->oem_table_id);
}
/* DSDT */
@@ -645,7 +650,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
build_header(linker, table_data,
(void *)(table_data->data + table_data->len - dsdt->buf->len),
- "DSDT", dsdt->buf->len, 2, NULL, NULL);
+ "DSDT", dsdt->buf->len, 2, vms->oem_id,
+ vms->oem_table_id);
free_aml_allocator();
}
@@ -704,7 +710,8 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
.base = vms->memmap[VIRT_ECAM_ID(vms->highmem_ecam)].base,
.size = vms->memmap[VIRT_ECAM_ID(vms->highmem_ecam)].size,
};
- build_mcfg(tables_blob, tables->linker, &mcfg);
+ build_mcfg(tables_blob, tables->linker, &mcfg, vms->oem_id,
+ vms->oem_table_id);
}
acpi_add_table(table_offsets, tables_blob);
@@ -713,7 +720,8 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
if (vms->ras) {
build_ghes_error_table(tables->hardware_errors, tables->linker);
acpi_add_table(table_offsets, tables_blob);
- acpi_build_hest(tables_blob, tables->linker);
+ acpi_build_hest(tables_blob, tables->linker, vms->oem_id,
+ vms->oem_table_id);
}
if (ms->numa_state->num_nodes > 0) {
@@ -721,13 +729,15 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
build_srat(tables_blob, tables->linker, vms);
if (ms->numa_state->have_numa_distance) {
acpi_add_table(table_offsets, tables_blob);
- build_slit(tables_blob, tables->linker, ms);
+ build_slit(tables_blob, tables->linker, ms, vms->oem_id,
+ vms->oem_table_id);
}
}
if (ms->nvdimms_state->is_enabled) {
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
- ms->nvdimms_state, ms->ram_slots);
+ ms->nvdimms_state, ms->ram_slots, vms->oem_id,
+ vms->oem_table_id);
}
if (its_class_name() && !vmc->no_its) {
@@ -737,18 +747,20 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) {
acpi_add_table(table_offsets, tables_blob);
- build_tpm2(tables_blob, tables->linker, tables->tcpalog);
+ build_tpm2(tables_blob, tables->linker, tables->tcpalog, vms->oem_id,
+ vms->oem_table_id);
}
/* XSDT is pointed to by RSDP */
xsdt = tables_blob->len;
- build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
+ build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id,
+ vms->oem_table_id);
/* RSDP is in FSEG memory, so allocate it separately */
{
AcpiRsdpData rsdp_data = {
.revision = 2,
- .oem_id = ACPI_BUILD_APPNAME6,
+ .oem_id = vms->oem_id,
.xsdt_tbl_offset = &xsdt,
.rsdt_tbl_offset = NULL,
};