ACPI ERST: create ACPI ERST table for pc/x86 machines

This change exposes ACPI ERST support for x86 guests.

Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <1643402289-22216-8-git-send-email-eric.devolder@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Eric DeVolder 2022-01-28 15:38:06 -05:00 committed by Michael S. Tsirkin
parent c9cd06ca00
commit 8486f12f0b
3 changed files with 35 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "sysemu/tpm.h" #include "sysemu/tpm.h"
#include "hw/acpi/tpm.h" #include "hw/acpi/tpm.h"
#include "hw/acpi/vmgenid.h" #include "hw/acpi/vmgenid.h"
#include "hw/acpi/erst.h"
#include "sysemu/tpm_backend.h" #include "sysemu/tpm_backend.h"
#include "hw/rtc/mc146818rtc_regs.h" #include "hw/rtc/mc146818rtc_regs.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"
@ -74,6 +75,8 @@
#include "hw/acpi/hmat.h" #include "hw/acpi/hmat.h"
#include "hw/acpi/viot.h" #include "hw/acpi/viot.h"
#include CONFIG_DEVICES
/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
* -M pc-i440fx-2.0. Even if the actual amount of AML generated grows * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows
* a little bit, there should be plenty of free space since the DSDT * a little bit, there should be plenty of free space since the DSDT
@ -2575,6 +2578,18 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id, ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
x86ms->oem_table_id); x86ms->oem_table_id);
#ifdef CONFIG_ACPI_ERST
{
Object *erst_dev;
erst_dev = find_erst_dev();
if (erst_dev) {
acpi_add_table(table_offsets, tables_blob);
build_erst(tables_blob, tables->linker, erst_dev,
x86ms->oem_id, x86ms->oem_table_id);
}
}
#endif
vmgenid_dev = find_vmgenid_dev(); vmgenid_dev = find_vmgenid_dev();
if (vmgenid_dev) { if (vmgenid_dev) {
acpi_add_table(table_offsets, tables_blob); acpi_add_table(table_offsets, tables_blob);

View File

@ -30,6 +30,7 @@
#include "hw/acpi/bios-linker-loader.h" #include "hw/acpi/bios-linker-loader.h"
#include "hw/acpi/generic_event_device.h" #include "hw/acpi/generic_event_device.h"
#include "hw/acpi/utils.h" #include "hw/acpi/utils.h"
#include "hw/acpi/erst.h"
#include "hw/i386/fw_cfg.h" #include "hw/i386/fw_cfg.h"
#include "hw/i386/microvm.h" #include "hw/i386/microvm.h"
#include "hw/pci/pci.h" #include "hw/pci/pci.h"
@ -40,6 +41,8 @@
#include "acpi-common.h" #include "acpi-common.h"
#include "acpi-microvm.h" #include "acpi-microvm.h"
#include CONFIG_DEVICES
static void acpi_dsdt_add_virtio(Aml *scope, static void acpi_dsdt_add_virtio(Aml *scope,
MicrovmMachineState *mms) MicrovmMachineState *mms)
{ {
@ -207,6 +210,18 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id, ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
x86ms->oem_table_id); x86ms->oem_table_id);
#ifdef CONFIG_ACPI_ERST
{
Object *erst_dev;
erst_dev = find_erst_dev();
if (erst_dev) {
acpi_add_table(table_offsets, tables_blob);
build_erst(tables_blob, tables->linker, erst_dev,
x86ms->oem_id, x86ms->oem_table_id);
}
}
#endif
xsdt = tables_blob->len; xsdt = tables_blob->len;
build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id, build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id,
x86ms->oem_table_id); x86ms->oem_table_id);

View File

@ -16,4 +16,9 @@ void build_erst(GArray *table_data, BIOSLinker *linker, Object *erst_dev,
#define TYPE_ACPI_ERST "acpi-erst" #define TYPE_ACPI_ERST "acpi-erst"
/* returns NULL unless there is exactly one device */
static inline Object *find_erst_dev(void)
{
return object_resolve_path_type("", TYPE_ACPI_ERST, NULL);
}
#endif #endif