All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 22/48] hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in TPMState
Date: Wed, 22 Apr 2026 21:57:20 +0200	[thread overview]
Message-ID: <20260422195746.88865-23-philmd@linaro.org> (raw)
In-Reply-To: <20260422195746.88865-1-philmd@linaro.org>

Of the TPM devices using FIFO mode, only the ISA variant has
PPI, and calls tpm_ppi_init() to initialize the PPI state.
Propagate @ppi_enabled to tpm_tis_reset() so it only resets
the PPI part when requested (ISA case) otherwise the PPI is in
uninitialized state. Remove the now unused TPMState::ppi_enabled
field. Set the generic TPMIfClass::ppi_enabled so ACPI subsystem
can keep checking its availability.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20260317120241.16320-5-philmd@linaro.org>
---
 hw/tpm/tpm_tis.h        |  3 +--
 hw/tpm/tpm_tis_common.c |  4 ++--
 hw/tpm/tpm_tis_i2c.c    |  2 +-
 hw/tpm/tpm_tis_isa.c    | 10 ++++------
 hw/tpm/tpm_tis_sysbus.c |  2 +-
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
index 184632ff66b..1531620bf9d 100644
--- a/hw/tpm/tpm_tis.h
+++ b/hw/tpm/tpm_tis.h
@@ -75,7 +75,6 @@ typedef struct TPMState {
 
     size_t be_buffer_size;
 
-    bool ppi_enabled;
     TPMPPI ppi;
 } TPMState;
 
@@ -83,7 +82,7 @@ extern const VMStateDescription vmstate_locty;
 extern const MemoryRegionOps tpm_tis_memory_ops;
 
 int tpm_tis_pre_save(TPMState *s);
-void tpm_tis_reset(TPMState *s);
+void tpm_tis_reset(TPMState *s, bool ppi_enabled);
 enum TPMVersion tpm_tis_get_tpm_version(TPMState *s);
 void tpm_tis_request_completed(TPMState *s, int ret);
 uint32_t tpm_tis_read_data(TPMState *s, hwaddr addr, unsigned size);
diff --git a/hw/tpm/tpm_tis_common.c b/hw/tpm/tpm_tis_common.c
index f594b15b8ab..a134d5c2059 100644
--- a/hw/tpm/tpm_tis_common.c
+++ b/hw/tpm/tpm_tis_common.c
@@ -813,7 +813,7 @@ enum TPMVersion tpm_tis_get_tpm_version(TPMState *s)
  * This function is called when the machine starts, resets or due to
  * S3 resume.
  */
-void tpm_tis_reset(TPMState *s)
+void tpm_tis_reset(TPMState *s, bool ppi_enabled)
 {
     int c;
 
@@ -821,7 +821,7 @@ void tpm_tis_reset(TPMState *s)
     s->be_buffer_size = MIN(tpm_backend_get_buffer_size(s->be_driver),
                             TPM_TIS_BUFFER_MAX);
 
-    if (s->ppi_enabled) {
+    if (ppi_enabled) {
         tpm_ppi_reset(&s->ppi);
     }
     tpm_backend_reset(s->be_driver);
diff --git a/hw/tpm/tpm_tis_i2c.c b/hw/tpm/tpm_tis_i2c.c
index 9f13e0ec120..b4f258c7bcb 100644
--- a/hw/tpm/tpm_tis_i2c.c
+++ b/hw/tpm/tpm_tis_i2c.c
@@ -523,7 +523,7 @@ static void tpm_tis_i2c_reset(DeviceState *dev)
     i2cst->csum_enable = 0;
     i2cst->loc_sel = 0x00;
 
-    return tpm_tis_reset(s);
+    return tpm_tis_reset(s, false);
 }
 
 static void tpm_tis_i2c_class_init(ObjectClass *klass, const void *data)
diff --git a/hw/tpm/tpm_tis_isa.c b/hw/tpm/tpm_tis_isa.c
index 61e95434f5b..1ca403241de 100644
--- a/hw/tpm/tpm_tis_isa.c
+++ b/hw/tpm/tpm_tis_isa.c
@@ -88,13 +88,12 @@ static void tpm_tis_isa_reset(DeviceState *dev)
     TPMStateISA *isadev = TPM_TIS_ISA(dev);
     TPMState *s = &isadev->state;
 
-    return tpm_tis_reset(s);
+    return tpm_tis_reset(s, true);
 }
 
 static const Property tpm_tis_isa_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMStateISA, state.irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMStateISA, state.be_driver),
-    DEFINE_PROP_BOOL("ppi", TPMStateISA, state.ppi_enabled, true),
 };
 
 static void tpm_tis_isa_initfn(Object *obj)
@@ -132,10 +131,8 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error **errp)
     memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
                                 TPM_TIS_ADDR_BASE, &s->mmio);
 
-    if (s->ppi_enabled) {
-        tpm_ppi_init(&s->ppi, isa_address_space(ISA_DEVICE(dev)),
-                     TPM_PPI_ADDR_BASE, OBJECT(dev));
-    }
+    tpm_ppi_init(&s->ppi, isa_address_space(ISA_DEVICE(dev)),
+                 TPM_PPI_ADDR_BASE, OBJECT(dev));
 }
 
 static void build_tpm_tis_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
@@ -175,6 +172,7 @@ static void tpm_tis_isa_class_init(ObjectClass *klass, const void *data)
     device_class_set_props(dc, tpm_tis_isa_properties);
     dc->vmsd  = &vmstate_tpm_tis_isa;
     tc->model = TPM_MODEL_TPM_TIS;
+    tc->ppi_enabled = true;
     dc->realize = tpm_tis_isa_realizefn;
     device_class_set_legacy_reset(dc, tpm_tis_isa_reset);
     tc->request_completed = tpm_tis_isa_request_completed;
diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index e9372e73163..dd30344d5ac 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -87,7 +87,7 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
     TPMStateSysBus *sbdev = TPM_TIS_SYSBUS(dev);
     TPMState *s = &sbdev->state;
 
-    return tpm_tis_reset(s);
+    return tpm_tis_reset(s, false);
 }
 
 static const Property tpm_tis_sysbus_properties[] = {
-- 
2.53.0



  parent reply	other threads:[~2026-04-22 20:03 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22 19:56 [PULL 00/49] Misc HW patches for 2026-04-22 Philippe Mathieu-Daudé
2026-04-22 19:56 ` [PULL 01/48] hw/avr: Build as common unit files Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 02/48] hw/misc/cpc: Include missing 'hw/core/cpu.h' header Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 03/48] hw/alpha: Include full path to target 'cpu.h' header Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 04/48] hw/arm: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 05/48] hw/avr: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 06/48] hw/hppa: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 07/48] hw/i386: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 08/48] hw/m68k: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 09/48] hw/microblaze: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 10/48] hw/mips: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 11/48] hw/or1k: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 12/48] hw/ppc: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 13/48] hw/riscv: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 14/48] hw/s390x: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 15/48] hw/sh4: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 16/48] hw/sparc: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 17/48] hw/tricore: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 18/48] hw/xtensa: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 19/48] hw/tpm: Factor tpm_ppi_enabled() out Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 20/48] hw/tpm: Add TPMIfClass::ppi_enabled field Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 21/48] hw/tpm: Remove CRBState::ppi_enabled field Philippe Mathieu-Daudé
2026-04-22 19:57 ` Philippe Mathieu-Daudé [this message]
2026-04-22 19:57 ` [PULL 23/48] hw/tpm: Simplify tpm_ppi_enabled() Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 24/48] hw/ppc/spapr: Un-inline rtas_load/store() helpers Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 25/48] hw/hyperv: Replace legacy ld_phys() -> address_space_ld() Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 26/48] system/memory: Constify various AddressSpace arguments (flatview) Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 27/48] hw/core: Move compat_props_add() to 'hw/core/boards.h' Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 28/48] qom: Declare GlobalProperty structure in 'qom/compat-properties.h' Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 29/48] qom: Declare compat properties API " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 30/48] qom: Restrict compat properties API to system emulation Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 31/48] docs/specs/tpm: document PPI support on ARM64 virt Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 32/48] hw/acpi/tpm: parameterize PPI base address in tpm_build_ppi_acpi Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 33/48] hw/tpm: add PPI support to tpm-tis-device for ARM64 virt Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 34/48] physmem: Simplify dirty memory type checks with loop Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 35/48] hw/arm/smmuv3: Have smmuv3_accel_init() take an Error* parameter Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 36/48] hw/arm/smmuv3: Avoid including CONFIG_DEVICES in hw/ header Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 37/48] hw/ppc/e500: fix bus-frequency property hardcoded to zero in CPU FDT node Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 38/48] ati-vga: fix unsigned integer overflow in cursor bounds checks Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 39/48] ati-vga: mask out lock bit from CUR_OFFSET in cursor offset calculation Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 40/48] hw/virtio/virtio-iommu: remove duplicate include Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 41/48] hw/hyperv: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 42/48] hw/ppc/amigaone: " Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 43/48] hw/misc: Fix the valid access size to the avr-power device Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 44/48] hw/sh4/sh7750: Remove forgotten abort() in the MM_ITLB_DATA handler Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 45/48] MAINTAINERS: Remove my unused git tree locations Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 46/48] MAINTAINERS: Remove my disfunctional emails Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 47/48] MAINTAINERS: Remove PhilMD from NVMe Block Driver Philippe Mathieu-Daudé
2026-04-22 19:57 ` [PULL 48/48] MAINTAINERS: Transfer CI maintenance to Pierrick Philippe Mathieu-Daudé

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=20260422195746.88865-23-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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.