From: Igor Mammedov <imammedo@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: peter.maydell@linaro.org, drjones@redhat.com, gshan@redhat.com,
mst@redhat.com, qemu-devel@nongnu.org, shannon.zhaosl@gmail.com,
qemu-arm@nongnu.org, marcandre.lureau@redhat.com,
eric.auger.pro@gmail.com, lersek@redhat.com, ardb@kernel.org,
stefanb@linux.ibm.com
Subject: Re: [PATCH v2 2/3] arm/acpi: TPM2 ACPI table support
Date: Tue, 12 May 2020 16:27:16 +0200 [thread overview]
Message-ID: <20200512162716.7a4204dd@redhat.com> (raw)
In-Reply-To: <20200505144419.29174-3-eric.auger@redhat.com>
On Tue, 5 May 2020 16:44:18 +0200
Eric Auger <eric.auger@redhat.com> wrote:
> Add a TPM2 ACPI table if a TPM2.0 sysbus device has been
> dynamically instantiated.
>
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
on x86 we also do:
fw_cfg_add_file(x86ms->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
question is why it's not necessary in case of ARM?
>
> ---
>
> v1 -> v2:
> - reuse generic build_tpm2() and alloc log area externally
> - call tpm_find() once in build_tpm2()
> ---
> include/sysemu/tpm.h | 2 ++
> hw/acpi/aml-build.c | 5 +++--
> hw/arm/virt-acpi-build.c | 11 +++++++++++
> 3 files changed, 16 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 1f7fd09112..4224675cb2 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1882,12 +1882,13 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)
> 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;
> + TPMIf *tpmif = tpm_find();
>
> tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT);
> - if (TPM_IS_TIS_ISA(tpm_find())) {
> + if (TPM_IS_TIS_ISA(tpmif) || TPM_IS_TIS_SYSBUS(tpmif)) {
> tpm2_ptr->control_area_address = cpu_to_le64(0);
> tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO);
> - } else if (TPM_IS_CRB(tpm_find())) {
> + } else if (TPM_IS_CRB(tpmif)) {
> tpm2_ptr->control_area_address = cpu_to_le64(TPM_CRB_ADDR_CTRL);
> tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_CRB);
> } else {
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 81d41a3990..1a2ec10c8f 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -41,11 +41,13 @@
> #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 "sysemu/numa.h"
> #include "sysemu/reset.h"
> +#include "sysemu/tpm.h"
> #include "kvm_arm.h"
> #include "migration/vmstate.h"
>
> @@ -831,6 +833,15 @@ 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_data_push(tables->tcpalog, TPM_LOG_AREA_MINIMUM_SIZE);
> + bios_linker_loader_alloc(tables->linker, ACPI_BUILD_TPMLOG_FILE,
> + tables->tcpalog, 1, false);
> +
> + 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);
next prev parent reply other threads:[~2020-05-12 14:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:44 [PATCH v2 0/3] vTPM/aarch64 ACPI support Eric Auger
2020-05-05 14:44 ` [PATCH v2 1/3] acpi: Move build_tpm2() in the generic part Eric Auger
2020-05-05 16:17 ` Stefan Berger
2020-05-06 6:33 ` Andrew Jones
2020-05-06 9:50 ` Auger Eric
2020-05-12 14:10 ` Igor Mammedov
2020-05-12 14:56 ` Auger Eric
2020-05-06 9:58 ` Michael S. Tsirkin
2020-05-12 14:14 ` Igor Mammedov
2020-05-12 15:59 ` Auger Eric
2020-05-14 9:53 ` Igor Mammedov
2020-05-05 14:44 ` [PATCH v2 2/3] arm/acpi: TPM2 ACPI table support Eric Auger
2020-05-05 16:16 ` Stefan Berger
2020-05-12 14:27 ` Igor Mammedov [this message]
2020-05-12 16:06 ` Auger Eric
2020-05-05 14:44 ` [PATCH v2 3/3] arm/acpi: Add the TPM2.0 device under the DSDT Eric Auger
2020-05-08 15:24 ` Shannon Zhao
2020-05-08 15:25 ` Ard Biesheuvel
2020-05-08 19:15 ` Stefan Berger
2020-05-12 14:57 ` Igor Mammedov
2020-05-05 16:19 ` [PATCH v2 0/3] vTPM/aarch64 ACPI support Ard Biesheuvel
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=20200512162716.7a4204dd@redhat.com \
--to=imammedo@redhat.com \
--cc=ardb@kernel.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=gshan@redhat.com \
--cc=lersek@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhaosl@gmail.com \
--cc=stefanb@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.