[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/56] arm/acpi: TPM2 ACPI table support
From: |
Michael S. Tsirkin |
Subject: |
[PULL 16/56] arm/acpi: TPM2 ACPI table support |
Date: |
Wed, 10 Jun 2020 00:27:08 -0400 |
From: Eric Auger <eric.auger@redhat.com>
Add a TPM2 ACPI table if a TPM2.0 sysbus device has been
dynamically instantiated.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20200601095737.32671-4-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/sysemu/tpm.h | 2 ++
hw/acpi/aml-build.c | 5 +++--
hw/arm/virt-acpi-build.c | 7 +++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index f37851b1aa..03fb25941c 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -50,6 +50,8 @@ typedef struct TPMIfClass {
#define TPM_IS_TIS_ISA(chr) \
object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_ISA)
+#define TPM_IS_TIS_SYSBUS(chr) \
+ object_dynamic_cast(OBJECT(chr), TYPE_TPM_TIS_SYSBUS)
#define TPM_IS_CRB(chr) \
object_dynamic_cast(OBJECT(chr), TYPE_TPM_CRB)
#define TPM_IS_SPAPR(chr) \
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index b37052c1b4..d24e9e6c3a 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1885,17 +1885,18 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker,
GArray *tcpalog)
unsigned log_addr_offset =
(char *)&tpm2_ptr->log_area_start_address - table_data->data;
uint8_t start_method_params[12] = {};
+ TPMIf *tpmif = tpm_find();
/* platform class */
build_append_int_noprefix(table_data, TPM2_ACPI_CLASS_CLIENT, 2);
/* reserved */
build_append_int_noprefix(table_data, 0, 2);
- if (TPM_IS_TIS_ISA(tpm_find())) {
+ if (TPM_IS_TIS_ISA(tpmif) || TPM_IS_TIS_SYSBUS(tpmif)) {
/* address of control area */
build_append_int_noprefix(table_data, 0, 8);
/* start method */
build_append_int_noprefix(table_data, TPM2_START_METHOD_MMIO, 4);
- } else if (TPM_IS_CRB(tpm_find())) {
+ } else if (TPM_IS_CRB(tpmif)) {
build_append_int_noprefix(table_data, TPM_CRB_ADDR_CTRL, 8);
build_append_int_noprefix(table_data, TPM2_START_METHOD_CRB, 4);
} else {
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 2cbccd5fe2..ca31f70f7f 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -41,12 +41,14 @@
#include "hw/acpi/pci.h"
#include "hw/acpi/memory_hotplug.h"
#include "hw/acpi/generic_event_device.h"
+#include "hw/acpi/tpm.h"
#include "hw/pci/pcie_host.h"
#include "hw/pci/pci.h"
#include "hw/arm/virt.h"
#include "hw/mem/nvdimm.h"
#include "sysemu/numa.h"
#include "sysemu/reset.h"
+#include "sysemu/tpm.h"
#include "kvm_arm.h"
#include "migration/vmstate.h"
#include "hw/acpi/ghes.h"
@@ -848,6 +850,11 @@ void virt_acpi_build(VirtMachineState *vms,
AcpiBuildTables *tables)
build_iort(tables_blob, tables->linker, vms);
}
+ if (tpm_get_version(tpm_find()) == TPM_VERSION_2_0) {
+ acpi_add_table(table_offsets, tables_blob);
+ build_tpm2(tables_blob, tables->linker, tables->tcpalog);
+ }
+
/* XSDT is pointed to by RSDP */
xsdt = tables_blob->len;
build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL);
--
MST
- [PULL 01/56] msix: allow qword MSI-X table accesses, (continued)
- [PULL 01/56] msix: allow qword MSI-X table accesses, Michael S. Tsirkin, 2020/06/10
- [PULL 06/56] acpi: move aml builder code for rtc device, Michael S. Tsirkin, 2020/06/10
- [PULL 07/56] acpi: rtc: use a single crs range, Michael S. Tsirkin, 2020/06/10
- [PULL 08/56] acpi: serial: don't use _STA method, Michael S. Tsirkin, 2020/06/10
- [PULL 09/56] acpi: move aml builder code for serial device, Michael S. Tsirkin, 2020/06/10
- [PULL 10/56] acpi: parallel: don't use _STA method, Michael S. Tsirkin, 2020/06/10
- [PULL 12/56] tests/acpi: update DSDT expected files, Michael S. Tsirkin, 2020/06/10
- [PULL 13/56] acpi: tpm: Do not build TCPA table for TPM 2, Michael S. Tsirkin, 2020/06/10
- [PULL 14/56] acpi: Convert build_tpm2() to build_append* API, Michael S. Tsirkin, 2020/06/10
- [PULL 15/56] acpi: Move build_tpm2() in the generic part, Michael S. Tsirkin, 2020/06/10
- [PULL 16/56] arm/acpi: TPM2 ACPI table support,
Michael S. Tsirkin <=
- [PULL 17/56] test/tpm-emu: include sockets and channel headers in tpm-emu header, Michael S. Tsirkin, 2020/06/10
- [PULL 18/56] tests/acpi: Add void tables for Q35/TPM-TIS bios-tables-test, Michael S. Tsirkin, 2020/06/10
- [PULL 19/56] tests: tpm-emu: Remove assert on TPM2_ST_NO_SESSIONS, Michael S. Tsirkin, 2020/06/10
- [PULL 20/56] bios-tables-test: Add Q35/TPM-TIS test, Michael S. Tsirkin, 2020/06/10
- [PULL 22/56] virtio-balloon: fix free page hinting without an iothread, Michael S. Tsirkin, 2020/06/10
- [PULL 21/56] bios-tables-test: Generate reference tables for Q35/TPM-TIS, Michael S. Tsirkin, 2020/06/10
- [PULL 23/56] virtio-balloon: fix free page hinting check on unrealize, Michael S. Tsirkin, 2020/06/10
- [PULL 25/56] virtio-balloon: Implement support for page poison reporting feature, Michael S. Tsirkin, 2020/06/10
- [PULL 24/56] virtio-balloon: unref the iothread when unrealizing, Michael S. Tsirkin, 2020/06/10
- [PULL 27/56] MAINTAINERS: Fix the classification of bios-tables-test-allowed-diff.h, Michael S. Tsirkin, 2020/06/10