diff options
author | Marian Postevca <posteuca@mutex.one> | 2021-01-19 02:32:13 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-02-05 08:52:59 -0500 |
commit | 602b458201ffd6f261fb8ee16b5175d733d3ec32 (patch) | |
tree | 7cd70e99e8b445eea3f4dff35a2cc22f93937bc8 /include | |
parent | 99f84ac0512b7ce29089a63c392da706fac14cb1 (diff) |
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 'include')
-rw-r--r-- | include/hw/acpi/acpi-defs.h | 2 | ||||
-rw-r--r-- | include/hw/acpi/aml-build.h | 8 | ||||
-rw-r--r-- | include/hw/acpi/ghes.h | 3 | ||||
-rw-r--r-- | include/hw/acpi/pci.h | 3 | ||||
-rw-r--r-- | include/hw/acpi/vmgenid.h | 2 | ||||
-rw-r--r-- | include/hw/arm/virt.h | 2 | ||||
-rw-r--r-- | include/hw/i386/microvm.h | 4 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 5 | ||||
-rw-r--r-- | include/hw/mem/nvdimm.h | 3 |
9 files changed, 23 insertions, 9 deletions
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 38a42f409a..cf9f44299c 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -41,7 +41,7 @@ enum { }; typedef struct AcpiRsdpData { - uint8_t oem_id[6] QEMU_NONSTRING; /* OEM identification */ + char *oem_id; /* OEM identification */ uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ unsigned *rsdt_tbl_offset; diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 54a5aec4d7..380d3e3924 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -8,7 +8,7 @@ #define ACPI_BUILD_TABLE_MAX_SIZE 0x200000 #define ACPI_BUILD_APPNAME6 "BOCHS " -#define ACPI_BUILD_APPNAME4 "BXPC" +#define ACPI_BUILD_APPNAME8 "BXPC " #define ACPI_BUILD_TABLE_FILE "etc/acpi/tables" #define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp" @@ -459,10 +459,12 @@ Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, uint64_t len, int node, MemoryAffinityFlags flags); -void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms); +void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, + const char *oem_id, const char *oem_table_id); void build_fadt(GArray *tbl, BIOSLinker *linker, const AcpiFadtData *f, const char *oem_id, const char *oem_table_id); -void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog); +void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, + const char *oem_id, const char *oem_table_id); #endif diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 4ad025e09a..2ae8bc1ded 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -67,7 +67,8 @@ typedef struct AcpiGhesState { } AcpiGhesState; void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker); -void acpi_build_hest(GArray *table_data, BIOSLinker *linker); +void acpi_build_hest(GArray *table_data, BIOSLinker *linker, + const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); int acpi_ghes_record_errors(uint8_t notify, uint64_t error_physical_addr); diff --git a/include/hw/acpi/pci.h b/include/hw/acpi/pci.h index bf2a3ed0ba..e514f179d8 100644 --- a/include/hw/acpi/pci.h +++ b/include/hw/acpi/pci.h @@ -33,5 +33,6 @@ typedef struct AcpiMcfgInfo { uint32_t size; } AcpiMcfgInfo; -void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info); +void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info, + const char *oem_id, const char *oem_table_id); #endif diff --git a/include/hw/acpi/vmgenid.h b/include/hw/acpi/vmgenid.h index cb4ad37fc5..dc8bb3433e 100644 --- a/include/hw/acpi/vmgenid.h +++ b/include/hw/acpi/vmgenid.h @@ -31,7 +31,7 @@ static inline Object *find_vmgenid_dev(void) } void vmgenid_build_acpi(VmGenIdState *vms, GArray *table_data, GArray *guid, - BIOSLinker *linker); + BIOSLinker *linker, const char *oem_id); void vmgenid_add_fw_cfg(VmGenIdState *vms, FWCfgState *s, GArray *guid); #endif diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 36fcb29641..ee9a93101e 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -165,6 +165,8 @@ struct VirtMachineState { DeviceState *acpi_dev; Notifier powerdown_notifier; PCIBus *bus; + char *oem_id; + char *oem_table_id; }; #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h index f25f837441..372b05774e 100644 --- a/include/hw/i386/microvm.h +++ b/include/hw/i386/microvm.h @@ -76,6 +76,8 @@ #define MICROVM_MACHINE_ISA_SERIAL "isa-serial" #define MICROVM_MACHINE_OPTION_ROMS "x-option-roms" #define MICROVM_MACHINE_AUTO_KERNEL_CMDLINE "auto-kernel-cmdline" +#define MICROVM_MACHINE_OEM_ID "oem-id" +#define MICROVM_MACHINE_OEM_TABLE_ID "oem-table-id" struct MicrovmMachineClass { X86MachineClass parent; @@ -104,6 +106,8 @@ struct MicrovmMachineState { Notifier machine_done; Notifier powerdown_req; struct GPEXConfig gpex; + char *oem_id; + char *oem_table_id; }; #define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm") diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 2aa8797c6e..5f93540a43 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -45,6 +45,8 @@ typedef struct PCMachineState { bool pit_enabled; bool hpet_enabled; uint64_t max_fw_size; + char *oem_id; + char *oem_table_id; /* NUMA information: */ uint64_t numa_nodes; @@ -62,7 +64,8 @@ typedef struct PCMachineState { #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" #define PC_MACHINE_MAX_FW_SIZE "max-fw-size" - +#define PC_MACHINE_OEM_ID "oem-id" +#define PC_MACHINE_OEM_TABLE_ID "oem-table-id" /** * PCMachineClass: * diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h index c699842dd0..bcf62f825c 100644 --- a/include/hw/mem/nvdimm.h +++ b/include/hw/mem/nvdimm.h @@ -154,7 +154,8 @@ void nvdimm_init_acpi_state(NVDIMMState *state, MemoryRegion *io, void nvdimm_build_srat(GArray *table_data); void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, NVDIMMState *state, - uint32_t ram_slots); + uint32_t ram_slots, const char *oem_id, + const char *oem_table_id); void nvdimm_plug(NVDIMMState *state); void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev); #endif |