qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric DeVolder <eric.devolder@oracle.com>
To: qemu-devel@nongnu.org, imammedo@redhat.com
Cc: ehabkost@redhat.com, konrad.wilk@oracle.com, mst@redhat.com,
	pbonzini@redhat.com, boris.ostrovsky@oracle.com, rth@twiddle.net
Subject: [PATCH v6 07/10] ACPI ERST: create ACPI ERST table for pc/x86 machines
Date: Thu,  5 Aug 2021 18:30:36 -0400	[thread overview]
Message-ID: <1628202639-16361-8-git-send-email-eric.devolder@oracle.com> (raw)
In-Reply-To: <1628202639-16361-1-git-send-email-eric.devolder@oracle.com>

This change exposes ACPI ERST support for x86 guests.

Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
---
 hw/i386/acpi-build.c   | 9 +++++++++
 hw/i386/acpi-microvm.c | 9 +++++++++
 include/hw/acpi/erst.h | 5 +++++
 3 files changed, 23 insertions(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a33ac8b..b55a548 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"
@@ -2443,6 +2444,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
     GArray *tables_blob = tables->table_data;
     AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
     Object *vmgenid_dev;
+    Object *erst_dev;
     char *oem_id;
     char *oem_table_id;
 
@@ -2504,6 +2506,13 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
                     ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
                     x86ms->oem_table_id);
 
+    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);
+    }
+
     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 1a0f77b..6578254 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"
@@ -159,6 +160,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
     X86MachineState *x86ms = X86_MACHINE(mms);
     GArray *table_offsets;
     GArray *tables_blob = tables->table_data;
+    Object *erst_dev;
     unsigned dsdt, xsdt;
     AcpiFadtData pmfadt = {
         /* ACPI 5.0: 4.1 Hardware-Reduced ACPI */
@@ -208,6 +210,13 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
                     ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
                     x86ms->oem_table_id);
 
+    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);
+    }
+
     xsdt = tables_blob->len;
     build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id,
                x86ms->oem_table_id);
diff --git a/include/hw/acpi/erst.h b/include/hw/acpi/erst.h
index 9d63717..b747fe7 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
-- 
1.8.3.1



  parent reply	other threads:[~2021-08-05 22:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 22:30 [PATCH v6 00/10] acpi: Error Record Serialization Table, ERST, support for QEMU Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 01/10] ACPI ERST: bios-tables-test.c steps 1 and 2 Eric DeVolder
2021-09-20 13:05   ` Igor Mammedov
2021-10-04 20:37     ` Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 02/10] ACPI ERST: specification for ERST support Eric DeVolder
2021-09-20 13:38   ` Igor Mammedov
2021-10-04 20:40     ` Eric DeVolder
2021-10-06  6:58   ` [PATCH] " Ani Sinha
2021-10-06  7:00     ` Ani Sinha
2021-10-06 20:07       ` Eric DeVolder
2021-10-07  4:39         ` Ani Sinha
2021-10-06  8:12   ` [PATCH v6 02/10] " Michael S. Tsirkin
2021-10-06 20:07     ` Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 03/10] ACPI ERST: PCI device_id for ERST Eric DeVolder
2021-09-21 11:32   ` Igor Mammedov
2021-08-05 22:30 ` [PATCH v6 04/10] ACPI ERST: header file " Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 05/10] ACPI ERST: support for ACPI ERST feature Eric DeVolder
2021-09-21 15:30   ` Igor Mammedov
2021-10-04 21:13     ` Eric DeVolder
2021-10-05 11:39       ` Igor Mammedov
2021-10-05 16:40         ` Eric DeVolder
2021-10-06 14:36           ` Igor Mammedov
2021-08-05 22:30 ` [PATCH v6 06/10] ACPI ERST: build the ACPI ERST table Eric DeVolder
2021-08-05 22:30 ` Eric DeVolder [this message]
2021-08-05 22:30 ` [PATCH v6 08/10] ACPI ERST: qtest for ERST Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 09/10] ACPI ERST: bios-tables-test testcase Eric DeVolder
2021-09-21 11:32   ` Igor Mammedov
2021-10-04 21:13     ` Eric DeVolder
2021-08-05 22:30 ` [PATCH v6 10/10] ACPI ERST: step 6 of bios-tables-test Eric DeVolder
2021-08-06 17:16   ` Eric DeVolder
2021-08-27 21:45     ` Eric DeVolder
2021-09-02  6:34       ` Igor Mammedov
2021-09-21 11:24   ` Igor Mammedov
2021-10-04 21:14     ` Eric DeVolder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1628202639-16361-8-git-send-email-eric.devolder@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).