[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/32] ACPI ERST: create ACPI ERST table for pc/x86 machines
From: |
Michael S. Tsirkin |
Subject: |
[PULL 28/32] ACPI ERST: create ACPI ERST table for pc/x86 machines |
Date: |
Fri, 4 Feb 2022 20:43:55 -0500 |
From: Eric DeVolder <eric.devolder@oracle.com>
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>
---
include/hw/acpi/erst.h | 5 +++++
hw/i386/acpi-build.c | 15 +++++++++++++++
hw/i386/acpi-microvm.c | 15 +++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/include/hw/acpi/erst.h b/include/hw/acpi/erst.h
index 9d637179fe..b747fe7739 100644
--- a/include/hw/acpi/erst.h
+++ b/include/hw/acpi/erst.h
@@ -16,4 +16,9 @@ void build_erst(GArray *table_data, BIOSLinker *linker,
Object *erst_dev,
#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
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index ce823e8fcb..ebd47aa26f 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -43,6 +43,7 @@
#include "sysemu/tpm.h"
#include "hw/acpi/tpm.h"
#include "hw/acpi/vmgenid.h"
+#include "hw/acpi/erst.h"
#include "sysemu/tpm_backend.h"
#include "hw/rtc/mc146818rtc_regs.h"
#include "migration/vmstate.h"
@@ -74,6 +75,8 @@
#include "hw/acpi/hmat.h"
#include "hw/acpi/viot.h"
+#include CONFIG_DEVICES
+
/* 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
* 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,
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();
if (vmgenid_dev) {
acpi_add_table(table_offsets, tables_blob);
diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c
index 196d318499..68ca7e7fc2 100644
--- a/hw/i386/acpi-microvm.c
+++ b/hw/i386/acpi-microvm.c
@@ -30,6 +30,7 @@
#include "hw/acpi/bios-linker-loader.h"
#include "hw/acpi/generic_event_device.h"
#include "hw/acpi/utils.h"
+#include "hw/acpi/erst.h"
#include "hw/i386/fw_cfg.h"
#include "hw/i386/microvm.h"
#include "hw/pci/pci.h"
@@ -40,6 +41,8 @@
#include "acpi-common.h"
#include "acpi-microvm.h"
+#include CONFIG_DEVICES
+
static void acpi_dsdt_add_virtio(Aml *scope,
MicrovmMachineState *mms)
{
@@ -207,6 +210,18 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_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;
build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id,
x86ms->oem_table_id);
--
MST
- [PULL 06/32] tests: acpi: update expected blobs, (continued)
- [PULL 06/32] tests: acpi: update expected blobs, Michael S. Tsirkin, 2022/02/04
- [PULL 11/32] libvhost-user: fix VHOST_USER_REM_MEM_REG not closing the fd, Michael S. Tsirkin, 2022/02/04
- [PULL 16/32] virtio: add vhost support for virtio devices, Michael S. Tsirkin, 2022/02/04
- [PULL 24/32] ACPI ERST: PCI device_id for ERST, Michael S. Tsirkin, 2022/02/04
- [PULL 22/32] hmp: add virtio commands, Michael S. Tsirkin, 2022/02/04
- [PULL 19/32] qmp: decode feature & status bits in virtio-status, Michael S. Tsirkin, 2022/02/04
- [PULL 26/32] ACPI ERST: support for ACPI ERST feature, Michael S. Tsirkin, 2022/02/04
- [PULL 29/32] ACPI ERST: qtest for ERST, Michael S. Tsirkin, 2022/02/04
- [PULL 08/32] libvhost-user: Add vu_rem_mem_reg input validation, Michael S. Tsirkin, 2022/02/04
- [PULL 32/32] util/oslib-posix: Fix missing unlock in the error path of os_mem_prealloc(), Michael S. Tsirkin, 2022/02/04
- [PULL 28/32] ACPI ERST: create ACPI ERST table for pc/x86 machines,
Michael S. Tsirkin <=
- [PULL 15/32] virtio: drop name parameter for virtio_init(), Michael S. Tsirkin, 2022/02/04
- [PULL 21/32] qmp: add QMP command x-query-virtio-queue-element, Michael S. Tsirkin, 2022/02/04
- [PULL 31/32] ACPI ERST: step 6 of bios-tables-test.c, Michael S. Tsirkin, 2022/02/04
- [PULL 30/32] ACPI ERST: bios-tables-test testcase, Michael S. Tsirkin, 2022/02/04
- [PULL 17/32] qmp: add QMP command x-query-virtio, Michael S. Tsirkin, 2022/02/04
- [PULL 20/32] qmp: add QMP commands for virtio/vhost queue-status, Michael S. Tsirkin, 2022/02/04
- [PULL 25/32] ACPI ERST: header file for ERST, Michael S. Tsirkin, 2022/02/04
- Re: [PULL 00/32] virtio,pc: features, cleanups, fixes, Peter Maydell, 2022/02/05