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 /hw/arm/virt.c | |
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 'hw/arm/virt.c')
-rw-r--r-- | hw/arm/virt.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 399da73454..0c65fe38a0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2155,6 +2155,49 @@ static void virt_set_its(Object *obj, bool value, Error **errp) vms->its = value; } +static char *virt_get_oem_id(Object *obj, Error **errp) +{ + VirtMachineState *vms = VIRT_MACHINE(obj); + + return g_strdup(vms->oem_id); +} + +static void virt_set_oem_id(Object *obj, const char *value, Error **errp) +{ + VirtMachineState *vms = VIRT_MACHINE(obj); + size_t len = strlen(value); + + if (len > 6) { + error_setg(errp, + "User specified oem-id value is bigger than 6 bytes in size"); + return; + } + + strncpy(vms->oem_id, value, len + 1); +} + +static char *virt_get_oem_table_id(Object *obj, Error **errp) +{ + VirtMachineState *vms = VIRT_MACHINE(obj); + + return g_strdup(vms->oem_table_id); +} + +static void virt_set_oem_table_id(Object *obj, const char *value, + Error **errp) +{ + VirtMachineState *vms = VIRT_MACHINE(obj); + size_t len = strlen(value); + + if (len > 8) { + error_setg(errp, + "User specified oem-table-id value is bigger than 8 bytes in size"); + return; + } + strncpy(vms->oem_table_id, value, len + 1); +} + + bool virt_is_acpi_enabled(VirtMachineState *vms) { if (vms->acpi == ON_OFF_AUTO_OFF) { @@ -2604,6 +2647,23 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) "Set on/off to enable/disable " "ITS instantiation"); + object_class_property_add_str(oc, "oem-id", + virt_get_oem_id, + virt_set_oem_id); + object_class_property_set_description(oc, "oem-id", + "Override the default value of field OEMID " + "in ACPI table header." + "The string may be up to 6 bytes in size"); + + + object_class_property_add_str(oc, "oem-table-id", + virt_get_oem_table_id, + virt_set_oem_table_id); + object_class_property_set_description(oc, "oem-table-id", + "Override the default value of field OEM Table ID " + "in ACPI table header." + "The string may be up to 8 bytes in size"); + } static void virt_instance_init(Object *obj) @@ -2645,6 +2705,9 @@ static void virt_instance_init(Object *obj) vms->irqmap = a15irqmap; virt_flash_create(vms); + + vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); + vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); } static const TypeInfo virt_machine_info = { |