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: peter.maydell@linaro.org,
	Stefan Berger <"Stefan Bergerstefanb"@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL v1 10/10] acpi: Update TPM2 ACPI table to more recent specs
Date: Fri, 22 Dec 2017 15:16:25 -0500	[thread overview]
Message-ID: <1513973785-14427-11-git-send-email-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <1513973785-14427-1-git-send-email-stefanb@linux.vnet.ibm.com>

From: Stefan Berger <Stefan Berger stefanb@linux.vnet.ibm.com>

More recent specs of the TPM2 ACPI table add fields for the log area
start address and the log area minimum size, which we already use
for the TCPA table.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/i386/acpi-build.c        | 19 ++++++++++++++-----
 include/hw/acpi/acpi-defs.h |  7 +++++--
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5a6dee0..18b939e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2274,16 +2274,25 @@ build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
 }
 
 static void
-build_tpm2(GArray *table_data, BIOSLinker *linker)
+build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
 {
-    Acpi20TPM2 *tpm2_ptr;
-
-    tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr);
+    Acpi20TPM2 *tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr);
+    unsigned log_addr_size = sizeof(tpm2_ptr->log_area_start_address);
+    unsigned log_addr_offset =
+        (char *)&tpm2_ptr->log_area_start_address - table_data->data;
 
     tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
     if (TPM_IS_TIS(tpm_find())) {
         tpm2_ptr->control_area_address = cpu_to_le64(0);
         tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
+
+        tpm2_ptr->log_area_minimum_length =
+            cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE);
+
+        /* log area start address to be filled by Guest linker */
+        bios_linker_loader_add_pointer(linker,
+            ACPI_BUILD_TABLE_FILE, log_addr_offset, log_addr_size,
+            ACPI_BUILD_TPMLOG_FILE, 0);
     } else {
         g_warn_if_reached();
     }
@@ -2695,7 +2704,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
 
         if (misc.tpm_version == TPM_VERSION_2_0) {
             acpi_add_table(table_offsets, tables_blob);
-            build_tpm2(tables_blob, tables->linker);
+            build_tpm2(tables_blob, tables->linker, tables->tcpalog);
         }
     }
     if (pcms->numa_nodes) {
diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
index 72be675..80c8099 100644
--- a/include/hw/acpi/acpi-defs.h
+++ b/include/hw/acpi/acpi-defs.h
@@ -558,8 +558,8 @@ typedef struct Acpi20Tcpa Acpi20Tcpa;
 /*
  * TPM2
  *
- * Following Level 00, Rev 00.37 of specs:
- * http://www.trustedcomputinggroup.org/resources/tcg_acpi_specification
+ * Following Version 1.2, Revision 8 of specs:
+ * https://trustedcomputinggroup.org/tcg-acpi-specification/
  */
 struct Acpi20TPM2 {
     ACPI_TABLE_HEADER_DEF
@@ -567,6 +567,9 @@ struct Acpi20TPM2 {
     uint16_t reserved;
     uint64_t control_area_address;
     uint32_t start_method;
+    uint8_t start_method_params[12];
+    uint32_t log_area_minimum_length;
+    uint64_t log_area_start_address;
 } QEMU_PACKED;
 typedef struct Acpi20TPM2 Acpi20TPM2;
 
-- 
2.5.5

  parent reply	other threads:[~2017-12-22 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 20:16 [Qemu-devel] [PULL v1 00/10] Merge tpm 2017/12/22 Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 01/10] tpm_emulator: Add a caching layer for the TPM Established flag Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 02/10] tpm_tis: convert uint32_t to size_t Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 03/10] tpm_tis: limit size of buffer from backend Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 04/10] tpm_tis: remove TPMSizeBuffer usage Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 05/10] tpm_tis: move buffers from localities into common location Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 06/10] tpm_tis: merge read and write buffer into single buffer Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 07/10] tpm_tis: move r/w_offsets to TPMState Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 08/10] tpm_tis: merge r/w_offset into rw_offset Stefan Berger
2017-12-22 20:16 ` [Qemu-devel] [PULL v1 09/10] tpm: Implement tpm_sized_buffer_reset Stefan Berger
2017-12-22 20:16 ` Stefan Berger [this message]
2018-01-08 11:39 ` [Qemu-devel] [PULL v1 00/10] Merge tpm 2017/12/22 Peter Maydell

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=1513973785-14427-11-git-send-email-stefanb@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc="Stefan Bergerstefanb"@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --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).