qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, stefanb@linux.vnet.ibm.com, kevin@koconnor.net,
	marcandre.lureau@redhat.com, lersek@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/4] acpi: build QEMU table for PPI virtual memory device
Date: Tue, 16 Jan 2018 10:51:38 -0500	[thread overview]
Message-ID: <1516117900-11382-3-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1516117900-11382-1-git-send-email-stefanb@linux.vnet.ibm.com>

To avoid having to hard code the base address of the PPI virtual memory
device we introduce a QEMU ACPI table that holds the base address, if a
TPM 1.2 or 2 is used. This table gives us flexibility to move the base
address later on.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/i386/acpi-build.c        | 19 +++++++++++++++++++
 include/hw/acpi/acpi-defs.h |  8 ++++++++
 2 files changed, 27 insertions(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 18b939e..522d6d2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2628,6 +2628,20 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
     return true;
 }
 
+static void build_qemu(GArray *table_data, BIOSLinker *linker,
+                       TPMVersion tpm_version)
+{
+    AcpiTableQemu *qemu = acpi_data_push(table_data, sizeof(*qemu));
+
+    if (tpm_version != TPM_VERSION_UNSPEC) {
+        qemu->tpmppi_addr = TPM_PPI_ADDR_BASE;
+        qemu->tpm_version = tpm_version;
+    }
+
+    build_header(linker, table_data,
+                 (void *)qemu, "QEMU", sizeof(*qemu), 1, "QEMU", "CONF");
+}
+
 static
 void acpi_build(AcpiBuildTables *tables, MachineState *machine)
 {
@@ -2734,6 +2748,11 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
                           &pcms->acpi_nvdimm_state, machine->ram_slots);
     }
 
+    if (misc.tpm_version != TPM_VERSION_UNSPEC) {
+        acpi_add_table(table_offsets, tables_blob);
+        build_qemu(tables_blob, tables->linker, misc.tpm_version);
+    }
+
     /* Add tables supplied by user (if any) */
     for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
         unsigned len = acpi_table_len(u);
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index 80c8099..98764c1 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -573,6 +573,14 @@ struct Acpi20TPM2 {
 } QEMU_PACKED;
 typedef struct Acpi20TPM2 Acpi20TPM2;
 
+/* QEMU - Custom QEMU table */
+struct AcpiTableQemu {
+    ACPI_TABLE_HEADER_DEF
+    uint32_t tpmppi_addr;
+    uint8_t tpm_version; /* 1 = 1.2, 2 = 2 */
+};
+typedef struct AcpiTableQemu AcpiTableQemu;
+
 /* DMAR - DMA Remapping table r2.2 */
 struct AcpiTableDmar {
     ACPI_TABLE_HEADER_DEF
-- 
2.5.5

  parent reply	other threads:[~2018-01-16 15:51 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 15:51 [Qemu-devel] [PATCH v2 0/4] Implement Physical Presence interface for TPM 1.2 and 2 Stefan Berger
2018-01-16 15:51 ` [Qemu-devel] [PATCH v2 1/4] tpm: implement virtual memory device for TPM PPI Stefan Berger
2018-01-16 15:51 ` Stefan Berger [this message]
2018-01-16 16:35   ` [Qemu-devel] [PATCH v2 2/4] acpi: build QEMU table for PPI virtual memory device Michael S. Tsirkin
2018-01-16 20:42   ` Laszlo Ersek
2018-01-16 21:20     ` Stefan Berger
2018-01-16 15:51 ` [Qemu-devel] [PATCH v2 3/4] acpi: implement aml_lless_equal Stefan Berger
2018-01-16 16:13   ` Michael S. Tsirkin
2018-01-16 15:51 ` [Qemu-devel] [PATCH v2 4/4] acpi: build TPM Physical Presence interface Stefan Berger
2018-02-09 20:19   ` Stefan Berger
2018-02-12 14:27     ` Igor Mammedov
2018-02-12 16:44       ` Stefan Berger
2018-02-12 17:52         ` Igor Mammedov
2018-02-12 18:45           ` Stefan Berger
2018-02-13 12:50             ` Igor Mammedov
2018-02-12 19:45     ` Kevin O'Connor
2018-02-12 20:17       ` Stefan Berger
2018-02-13 12:57         ` Igor Mammedov
2018-02-13 13:31           ` Laszlo Ersek
2018-02-13 14:17             ` Igor Mammedov
2018-02-13 15:39               ` Laszlo Ersek
2018-02-13 16:19                 ` Igor Mammedov
2018-02-13 16:34                   ` Laszlo Ersek
2018-02-12 20:46     ` Kevin O'Connor
2018-02-12 20:49       ` Stefan Berger
2018-02-13 16:16         ` Laszlo Ersek
2018-02-13 16:34           ` Igor Mammedov
2018-02-13 17:01             ` Laszlo Ersek
2018-02-13 19:37           ` Kevin O'Connor
2018-02-13 19:59             ` Laszlo Ersek
2018-02-13 20:29               ` Stefan Berger
2018-02-13 21:04                 ` Laszlo Ersek
2018-02-13 21:32                   ` Stefan Berger
2018-02-14 18:39                 ` Kevin O'Connor
2018-02-15 11:52                   ` Stefan Berger

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=1516117900-11382-3-git-send-email-stefanb@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=kevin@koconnor.net \
    --cc=lersek@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).