From: Chao Liu <chao.liu.zevorn@gmail.com>
To: tphan@ventanamicro.com
Cc: alistair.francis@wdc.com, dbarboza@ventanamicro.com,
liwei1518@gmail.com, palmer@dabbelt.com, qemu-devel@nongnu.org,
qemu-riscv@nongnu.org, sunilvl@ventanamicro.com,
zhiwei_liu@linux.alibaba.com
Subject: Re: [PATCH] hw/riscv/virt-acpi-build.c: Add TPM2 device node and ACPI table support
Date: Fri, 19 Dec 2025 16:29:59 +0800 [thread overview]
Message-ID: <5ed187df-61ae-4a59-98b2-cb2cc32b084a@gmail.com> (raw)
In-Reply-To: <20251203002259.2856-1-tphan@ventanamicro.com>
On Tue, 2 Dec 2025 16:22:59 -0800, Tuan Phan wrote:
> This patch enables TPM2 support in the RISC-V virt machine ACPI builder.
>
> Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
> ---
> hw/riscv/virt-acpi-build.c | 56 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
>
> diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
> index f1406cb68339..b5bf812a9d36 100644
> --- a/hw/riscv/virt-acpi-build.c
> +++ b/hw/riscv/virt-acpi-build.c
> @@ -32,6 +32,7 @@
> #include "hw/intc/riscv_aclint.h"
> #include "hw/nvram/fw_cfg_acpi.h"
> #include "hw/pci-host/gpex.h"
> +#include "hw/platform-bus.h"
> #include "hw/riscv/virt.h"
> #include "hw/riscv/numa.h"
> #include "hw/virtio/virtio-acpi.h"
> @@ -39,6 +40,7 @@
> #include "qapi/error.h"
> #include "qemu/error-report.h"
> #include "system/reset.h"
> +#include "system/tpm.h"
>
> #define ACPI_BUILD_TABLE_SIZE 0x20000
> #define ACPI_BUILD_INTC_ID(socket, index) ((socket << 24) | (index))
> @@ -224,6 +226,41 @@ static void acpi_dsdt_add_iommu_sys(Aml *scope, const
MemMapEntry *iommu_memmap,
> aml_append(scope, dev);
> }
>
> +#ifdef CONFIG_TPM
> +static void acpi_dsdt_add_tpm(Aml *scope, RISCVVirtState *s)
> +{
> + PlatformBusDevice *pbus = PLATFORM_BUS_DEVICE(s->platform_bus_dev);
> + hwaddr pbus_base = s->memmap[VIRT_PLATFORM_BUS].base;
> + SysBusDevice *sbdev = SYS_BUS_DEVICE(tpm_find());
> + MemoryRegion *sbdev_mr;
> + hwaddr tpm_base;
> +
> + if (!sbdev) {
> + return;
> + }
> +
> + tpm_base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
> + assert(tpm_base != -1);
> +
I suggest reporting an error message when the tpm_base check fails.
if (tpm_base == -1) {
error_report("Failed to get TPM MMIO address");
exit(1);
}
Thanks,
Chao
next prev parent reply other threads:[~2025-12-19 8:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 0:22 [PATCH] hw/riscv/virt-acpi-build.c: Add TPM2 device node and ACPI table support Tuan Phan
2025-12-04 7:14 ` Sunil V L
2025-12-19 8:29 ` Chao Liu [this message]
2026-01-09 19:18 ` Tuan Phan
-- strict thread matches above, loose matches on Subject: below --
2026-01-20 19:40 Tuan Phan
2026-01-26 11:59 ` Daniel Henrique Barboza
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=5ed187df-61ae-4a59-98b2-cb2cc32b084a@gmail.com \
--to=chao.liu.zevorn@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=sunilvl@ventanamicro.com \
--cc=tphan@ventanamicro.com \
--cc=zhiwei_liu@linux.alibaba.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.