acpi: Update TPM2 ACPI table to more recent specs
PATCH 1/1 acpi: Update TPM2 ACPI table to more recent specs
From: Stefan Berger <Stefan Berger [email protected]>
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 <[email protected]>
--- hw/i386/acpi-build.c | 19 ++++++++++++++----- include/hw/acpi/acpi-defs.h | 7 +++++-- 2 files changed, 19 insertions(+), 7 deletions(-)
hw/i386/acpi-build.c +14 -5
@@ -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) {
include/hw/acpi/acpi-defs.h +5 -2
@@ -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 ;
Signature · 1 line
2.5.5
Quoted 7 lines · Stefan Berger
From: Stefan Berger <Stefan Berger [email protected]>
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 <[email protected]>
I think ACPI tables change shouldn't fail migration, since tables are loaded by firmware,
Reviewed-by Marc-André Lureau <[email protected]>
Quoted 77 lines
--- hw/i386/acpi-build.c | 19 ++++++++++++++----- include/hw/acpi/acpi-defs.h | 7 +++++-- 2 files changed, 19 insertions(+), 7 deletions(-)hw/i386/acpi-build.c +14
-5@@ -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) {include/hw/acpi/acpi-defs.h +5
-3@@ -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
Signature · 1 line
Marc-André Lureau