From: Stefan Berger <stefanb@linux.ibm.com>
To: "Mohammadfaiz Bawa" <mbawa@redhat.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>
Cc: Zhao Liu <zhao1.liu@intel.com>
Subject: Re: [PATCH v3 2/3] hw/tpm: gate PPI support on tpm-tis-device behind a device property
Date: Tue, 7 Jul 2026 11:01:35 -0400 [thread overview]
Message-ID: <28305b69-e56d-4d1e-b166-a3cfc845805d@linux.ibm.com> (raw)
In-Reply-To: <20260619093140.832136-3-mbawa@redhat.com>
On 6/19/26 5:31 AM, Mohammadfaiz Bawa wrote:
> Add a "ppi" boolean property (default: true) to tpm-tis-device.
> When ppi=off the RAMBlock is never registered and the migration
> stream omits "tpm-ppi", restoring backward compatibility.
>
> Move sysbus_init_mmio() calls from instance_init to realizefn so
> the memory regions are initialized before being registered. When
> ppi=off, the PPI MMIO region is simply not exposed.
>
> Fixes: 46cd2c1050f0 ("hw/tpm: add PPI support to tpm-tis-device for ARM64 virt")
> Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
> ---
> hw/tpm/tpm_tis.h | 1 +
> hw/tpm/tpm_tis_sysbus.c | 18 +++++++++++-------
> 2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
> index 1531620bf9..6ac9804050 100644
> --- a/hw/tpm/tpm_tis.h
> +++ b/hw/tpm/tpm_tis.h
> @@ -76,6 +76,7 @@ typedef struct TPMState {
> size_t be_buffer_size;
>
> TPMPPI ppi;
> + bool ppi_enabled;
> } TPMState;
>
> extern const VMStateDescription vmstate_locty;
> diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
> index 16bb17874b..a7b0002d82 100644
> --- a/hw/tpm/tpm_tis_sysbus.c
> +++ b/hw/tpm/tpm_tis_sysbus.c
> @@ -94,6 +94,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
> static const Property tpm_tis_sysbus_properties[] = {
> DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
> DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
> + DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, true),
> };
>
> static void tpm_tis_sysbus_initfn(Object *obj)
> @@ -101,9 +102,7 @@ static void tpm_tis_sysbus_initfn(Object *obj)
> TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(obj);
> TPMState *s = &sbdev->state;
>
> - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
> sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
> - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->ppi.ram);
> }
>
> static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
> @@ -122,14 +121,19 @@ static void tpm_tis_sysbus_realizefn(DeviceState *dev, Error **errp)
> return;
> }
>
> - s->ppi.buf = qemu_memalign(host_page_size,
> - ROUND_UP(TPM_PPI_ADDR_SIZE, host_page_size));
> memory_region_init_io(&s->mmio, OBJECT(dev), &tpm_tis_memory_ops,
> s, "tpm-tis-mmio",
> TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT);
> - memory_region_init_ram_device_ptr(&s->ppi.ram, OBJECT(dev), "tpm-ppi",
> - TPM_PPI_ADDR_SIZE, s->ppi.buf);
> - vmstate_register_ram(&s->ppi.ram, dev);
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
> +
> + if (s->ppi_enabled) {
> + 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, OBJECT(dev), "tpm-ppi",
> + TPM_PPI_ADDR_SIZE, s->ppi.buf);
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->ppi.ram);
> + vmstate_register_ram(&s->ppi.ram, dev);
> + }
> }
>
> static void tpm_tis_sysbus_class_init(ObjectClass *klass, const void *data)
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
next prev parent reply other threads:[~2026-07-07 15:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 9:31 [PATCH v3 0/3] hw/tpm: fix tpm-tis-device backward migration on aarch64 Mohammadfaiz Bawa
2026-06-19 9:31 ` [PATCH v3 1/3] hw/core/platform-bus: guard platform_bus_get_mmio_addr() against NULL Mohammadfaiz Bawa
2026-06-19 9:31 ` [PATCH v3 2/3] hw/tpm: gate PPI support on tpm-tis-device behind a device property Mohammadfaiz Bawa
2026-07-07 15:01 ` Stefan Berger [this message]
2026-06-19 9:31 ` [PATCH v3 3/3] hw/core/machine: disable tpm-tis-device PPI for machine type <= 11.0 Mohammadfaiz Bawa
2026-07-07 15:02 ` Stefan Berger
2026-06-29 4:53 ` [PATCH v3 0/3] hw/tpm: fix tpm-tis-device backward migration on aarch64 Mohammadfaiz Bawa
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=28305b69-e56d-4d1e-b166-a3cfc845805d@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=mbawa@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@mailo.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=zhao1.liu@intel.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.