Add PPI memory region and ACPI _STA, _DSM to tpm-tis-sysbus so
Windows 11 ARM64 guests no longer log Event ID 15 errors from
tpm.sys on every boot.
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
---
hw/arm/virt-acpi-build.c | 9 ++++++++-
hw/tpm/tpm_tis_sysbus.c | 11 +++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 591cfc993c..5b5ac551f8 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -240,7 +240,8 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
Aml *dev = aml_device("TPM0");
aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device")));
- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
+ aml_append(dev, aml_name_decl("_UID", aml_int(1)));
+ aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
Aml *crs = aml_resource_template();
aml_append(crs,
@@ -248,6 +249,12 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
(uint32_t)memory_region_size(sbdev_mr),
AML_READ_WRITE));
aml_append(dev, aml_name_decl("_CRS", crs));
+
+ hwaddr ppi_base = platform_bus_get_mmio_addr(pbus, sbdev, 1);
+ if (ppi_base != -1) {
+ ppi_base += pbus_base;
+ tpm_build_ppi_acpi(TPM_IF(sbdev), dev, ppi_base);
+ }
aml_append(scope, dev);
}
#endif
diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index dd30344d5a..6bec30c36f 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -30,6 +30,7 @@
#include "hw/core/sysbus.h"
#include "tpm_tis.h"
#include "qom/object.h"
+#include "qemu/memalign.h"
struct TPMStateSysBus {
/*< private >*/
@@ -99,6 +100,7 @@ static void tpm_tis_sysbus_initfn(Object *obj)
{
TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(obj);
TPMState *s = &sbdev->state;
+ size_t host_page_size = qemu_real_host_page_size();
memory_region_init_io(&s->mmio, obj, &tpm_tis_memory_ops,
s, "tpm-tis-mmio",
@@ -106,6 +108,12 @@ static void tpm_tis_sysbus_initfn(Object *obj)
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
+
+ s->ppi.buf = qemu_memalign(host_page_size,
+ ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
+ memory_region_init_ram_device_ptr(&s->ppi.ram, obj, "tpm-ppi",
+ TPM_PPI_ADDR_SIZE, s->ppi.buf);
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram);
}
static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
@@ -122,6 +130,8 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
error_setg(errp, "'tpmdev' property is required");
return;
}
+
+ vmstate_register_ram(&s->ppi.ram, dev);
}
static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
@@ -132,6 +142,7 @@ static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
device_class_set_props(dc, tpm_tis_sysbus_properties);
dc->vmsd = &vmstate_tpm_tis_sysbus;
tc->model = TPM_MODEL_TPM_TIS;
+ tc->ppi_enabled = true;
dc->realize = tpm_tis_sysbus_realizefn;
device_class_set_legacy_reset(dc, tpm_tis_sysbus_reset);
tc->request_completed = tpm_tis_sysbus_request_completed;
--
2.53.0
Hi,
On 27/3/26 18:32, Mohammadfaiz Bawa wrote:
> Add PPI memory region and ACPI _STA, _DSM to tpm-tis-sysbus so
> Windows 11 ARM64 guests no longer log Event ID 15 errors from
> tpm.sys on every boot.
>
> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
> ---
> hw/arm/virt-acpi-build.c | 9 ++++++++-
> hw/tpm/tpm_tis_sysbus.c | 11 +++++++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 591cfc993c..5b5ac551f8 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -240,7 +240,8 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
> Aml *dev = aml_device("TPM0");
> aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
> aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device")));
> - aml_append(dev, aml_name_decl("_UID", aml_int(0)));
> + aml_append(dev, aml_name_decl("_UID", aml_int(1)));
> + aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
>
> Aml *crs = aml_resource_template();
> aml_append(crs,
> @@ -248,6 +249,12 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
> (uint32_t)memory_region_size(sbdev_mr),
> AML_READ_WRITE));
> aml_append(dev, aml_name_decl("_CRS", crs));
> +
> + hwaddr ppi_base = platform_bus_get_mmio_addr(pbus, sbdev, 1);
> + if (ppi_base != -1) {
> + ppi_base += pbus_base;
> + tpm_build_ppi_acpi(TPM_IF(sbdev), dev, ppi_base);
Matter of style, I'd rather:
tpm_build_ppi_acpi(TPM_IF(sbdev), dev, pbus_base + ppi_base);
> + }
> aml_append(scope, dev);
> }
> #endif
Hmm I see in tests/qtest/bios-tables-test.c that test_acpi_tcg_tpm()
only tests X86 (Q35). Could you see how to add coverage for Aarch64
virt machine? (It could be a patch on top, no need to repost a v4).
Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On Sat, Mar 28, 2026 at 5:17 AM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Hi,
>
> On 27/3/26 18:32, Mohammadfaiz Bawa wrote:
> > Add PPI memory region and ACPI _STA, _DSM to tpm-tis-sysbus so
> > Windows 11 ARM64 guests no longer log Event ID 15 errors from
> > tpm.sys on every boot.
> >
> > Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> > Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
> > ---
> > hw/arm/virt-acpi-build.c | 9 ++++++++-
> > hw/tpm/tpm_tis_sysbus.c | 11 +++++++++++
> > 2 files changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> > index 591cfc993c..5b5ac551f8 100644
> > --- a/hw/arm/virt-acpi-build.c
> > +++ b/hw/arm/virt-acpi-build.c
> > @@ -240,7 +240,8 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
> > Aml *dev = aml_device("TPM0");
> > aml_append(dev, aml_name_decl("_HID", aml_string("MSFT0101")));
> > aml_append(dev, aml_name_decl("_STR", aml_string("TPM 2.0 Device")));
> > - aml_append(dev, aml_name_decl("_UID", aml_int(0)));
> > + aml_append(dev, aml_name_decl("_UID", aml_int(1)));
> > + aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
> >
> > Aml *crs = aml_resource_template();
> > aml_append(crs,
> > @@ -248,6 +249,12 @@ static void acpi_dsdt_add_tpm(Aml *scope, VirtMachineState *vms)
> > (uint32_t)memory_region_size(sbdev_mr),
> > AML_READ_WRITE));
> > aml_append(dev, aml_name_decl("_CRS", crs));
> > +
> > + hwaddr ppi_base = platform_bus_get_mmio_addr(pbus, sbdev, 1);
> > + if (ppi_base != -1) {
> > + ppi_base += pbus_base;
> > + tpm_build_ppi_acpi(TPM_IF(sbdev), dev, ppi_base);
>
> Matter of style, I'd rather:
>
> tpm_build_ppi_acpi(TPM_IF(sbdev), dev, pbus_base + ppi_base);
>
> > + }
> > aml_append(scope, dev);
> > }
> > #endif
>
> Hmm I see in tests/qtest/bios-tables-test.c that test_acpi_tcg_tpm()
> only tests X86 (Q35). Could you see how to add coverage for Aarch64
> virt machine? (It could be a patch on top, no need to repost a v4).
>
> Otherwise,
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
Noted, and I'll look into adding tests aarch64 virt coverage as a follow-up.
Thanks,
Faiz
© 2016 - 2026 Red Hat, Inc.