Skip to contentSkip to conversation

Add ACPI tables for TPM

PATCH In review Stefan Berger 3 participants 4 messages Aug 11, 2014 – Aug 24, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Add ACPI tables for TPM

From: Stefan Berger <[email protected]>

Add an SSDT ACPI table for the TPM device.
Add a TCPA table for BIOS logging area when a TPM is being used.

The latter follows this spec here:

http://www.trustedcomputinggroup.org/files/static_page_files/DCD4188E-1A4B-B294-D050A155FB6F7385/TCG_ACPIGeneralSpecification_PublicReview.pdf

This patch has Michael Tsirkin's patches folded in.

---
 hw/i386/Makefile.objs |  3 ++-
 hw/i386/acpi-build.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-defs.h   | 11 +++++++++++
 hw/i386/ssdt-tpm.dsl  | 43 +++++++++++++++++++++++++++++++++++++++++++
 hw/tpm/tpm_tis.h      |  8 +-------
 include/hw/acpi/tpm.h | 29 +++++++++++++++++++++++++++++
 include/sysemu/tpm.h  |  7 +++++++
 7 files changed, 138 insertions(+), 8 deletions(-)
 create mode 100644 hw/i386/ssdt-tpm.dsl
 create mode 100644 include/hw/acpi/tpm.h
hw/i386/Makefile.objs +2 -1
index 48014ab..3688cf8 100644
@@ -10,7 +10,8 @@ obj-y += bios-linker-loader.o
 hw/i386/acpi-build.o: hw/i386/acpi-build.c hw/i386/acpi-dsdt.hex \
 	hw/i386/ssdt-proc.hex hw/i386/ssdt-pcihp.hex hw/i386/ssdt-misc.hex \
 	hw/i386/acpi-dsdt.hex hw/i386/q35-acpi-dsdt.hex \
-	hw/i386/q35-acpi-dsdt.hex hw/i386/ssdt-mem.hex
+	hw/i386/q35-acpi-dsdt.hex hw/i386/ssdt-mem.hex \
+	hw/i386/ssdt-tpm.hex
 
 iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
     ; then echo "$(2)"; else echo "$(3)"; fi ;)
hw/i386/acpi-build.c +45 -0

81 lines not on this page · raw message

hw/i386/acpi-defs.h +11 -0
index e93babb..1bc974a 100644
@@ -314,4 +314,15 @@ struct AcpiTableMcfg {
 } QEMU_PACKED;
 typedef struct AcpiTableMcfg AcpiTableMcfg;
 
+/*
+ * TCPA Description Table
+ */
+struct Acpi20Tcpa {
+    ACPI_TABLE_HEADER_DEF                    /* ACPI common table header */
+    uint16_t platform_class;
+    uint32_t log_area_minimum_length;
+    uint64_t log_area_start_address;
+} QEMU_PACKED;
+typedef struct Acpi20Tcpa Acpi20Tcpa;
+
 #endif
hw/i386/ssdt-tpm.dsl new file +43 -0

43 lines not on this page · raw message

hw/tpm/tpm_tis.h +1 -7
index 916152a..1a0db23 100644
@@ -18,23 +18,17 @@
 #define TPM_TPM_TIS_H
 
 #include "hw/isa/isa.h"
+#include "hw/acpi/tpm.h"
 #include "qemu-common.h"
 
-#define TPM_TIS_ADDR_BASE           0xFED40000
-
 #define TPM_TIS_NUM_LOCALITIES      5     /* per spec */
 #define TPM_TIS_LOCALITY_SHIFT      12
 #define TPM_TIS_NO_LOCALITY         0xff
 
 #define TPM_TIS_IS_VALID_LOCTY(x)   ((x) < TPM_TIS_NUM_LOCALITIES)
 
-#define TPM_TIS_IRQ                 5
-
 #define TPM_TIS_BUFFER_MAX          4096
 
-#define TYPE_TPM_TIS                "tpm-tis"
-
-
 typedef enum {
     TPM_TIS_STATE_IDLE = 0,
     TPM_TIS_STATE_READY,
include/hw/acpi/tpm.h new file +29 -0
new file mode 100644
index 0000000..792fcbf
@@ -0,0 +1,29 @@
+/*
+ * tpm.h - TPM ACPI definitions
+ *
+ * Copyright (C) 2014 IBM Corporation
+ *
+ * Authors:
+ *  Stefan Berger <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ * Implementation of the TIS interface according to specs found at
+ * http://www.trustedcomputinggroup.org
+ *
+ */
+#ifndef HW_ACPI_TPM_H
+#define HW_ACPI_TPM_H
+
+#define TPM_TIS_ADDR_BASE           0xFED40000
+#define TPM_TIS_ADDR_SIZE           0x5000
+
+#define TPM_TIS_IRQ                 5
+
+#define TPM_LOG_AREA_MINIMUM_SIZE   (64 * 1024)
+
+#define TPM_TCPA_ACPI_CLASS_CLIENT  0
+#define TPM_TCPA_ACPI_CLASS_SERVER  1
+
+#endif /* HW_ACPI_TPM_H */
include/sysemu/tpm.h +7 -0
index 13febdd..9b81ce9 100644
@@ -20,4 +20,11 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
 int tpm_init(void);
 void tpm_cleanup(void);
 
+#define TYPE_TPM_TIS                "tpm-tis"
+
+static inline bool tpm_find(void)
+{
+    return object_resolve_path_type("", TYPE_TPM_TIS, NULL);
+}
+
 #endif /* QEMU_TPM_H */
Signature · 1 line
1.9.3
#1 lore raw
Quoted 5 lines · Stefan Berger

From: Stefan Berger <[email protected]>

Add an SSDT ACPI table for the TPM device.
Add a TCPA table for BIOS logging area when a TPM is being used.

Quoted 8 lines

The latter follows this spec here:

http://www.trustedcomputinggroup.org/files/static_page_files/DCD4188E-1A4B-B294-D050A155FB6F7385/TCG_ACPIGeneralSpecification_PublicReview.pdf

This patch has Michael Tsirkin's patches folded in.

Any comments on this patch?

Stefan

#2 lore raw
Quoted 10 lines · Stefan Berger
Quoted 9 lines · Stefan Berger

From: Stefan Berger <[email protected]>

Add an SSDT ACPI table for the TPM device.
Add a TCPA table for BIOS logging area when a TPM is being used.

The latter follows this spec here:

http://www.trustedcomputinggroup.org/files/static_page_files/DCD4188E-1A4B-B294-D050A155FB6F7385/TCG_ACPIGeneralSpecification_PublicReview.pdf

Quoted 8 lines
Quoted 4 lines

This patch has Michael Tsirkin's patches folded in.

Any comments on this patch?

Stefan

I applied this in my tree.

#3 lore raw
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Stefan Berger
Quoted 9 lines · Stefan Berger

From: Stefan Berger <[email protected]>

Add an SSDT ACPI table for the TPM device.
Add a TCPA table for BIOS logging area when a TPM is being used.

The latter follows this spec here:

http://www.trustedcomputinggroup.org/files/static_page_files/DCD4188E-1A4B-B294-D050A155FB6F7385/TCG_ACPIGeneralSpecification_PublicReview.pdf

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

This patch has Michael Tsirkin's patches folded in.

Any comments on this patch?

Stefan

I applied this in my tree.

Great. Thanks.