From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v3 1/5] hw/tpm: Factor tpm_ppi_enabled() out
Date: Tue, 17 Mar 2026 13:02:37 +0100 [thread overview]
Message-ID: <20260317120241.16320-2-philmd@linaro.org> (raw)
In-Reply-To: <20260317120241.16320-1-philmd@linaro.org>
Factor tpm_ppi_enabled() out before modifying it in a unique place.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/system/tpm.h | 9 +++++++++
hw/acpi/tpm.c | 2 +-
hw/i386/acpi-build.c | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/include/system/tpm.h b/include/system/tpm.h
index 1ee568b3b62..b90dd4e8cb0 100644
--- a/include/system/tpm.h
+++ b/include/system/tpm.h
@@ -13,6 +13,7 @@
#define QEMU_TPM_H
#include "qapi/qapi-types-tpm.h"
+#include "qapi/error.h"
#include "qom/object.h"
#ifdef CONFIG_TPM
@@ -78,6 +79,14 @@ static inline TPMVersion tpm_get_version(TPMIf *ti)
return TPM_IF_GET_CLASS(ti)->get_version(ti);
}
+static inline bool tpm_ppi_enabled(TPMIf *ti)
+{
+ if (!ti) {
+ return false;
+ }
+ return object_property_get_bool(OBJECT(ti), "ppi", &error_abort);
+}
+
#else /* CONFIG_TPM */
#define tpm_init() (0)
diff --git a/hw/acpi/tpm.c b/hw/acpi/tpm.c
index cdc02275365..5fe95f2e3f1 100644
--- a/hw/acpi/tpm.c
+++ b/hw/acpi/tpm.c
@@ -25,7 +25,7 @@ void tpm_build_ppi_acpi(TPMIf *tpm, Aml *dev)
Aml *method, *field, *ifctx, *ifctx2, *ifctx3, *func_mask,
*not_implemented, *pak, *tpm2, *tpm3, *pprm, *pprq, *zero, *one;
- if (!object_property_get_bool(OBJECT(tpm), "ppi", &error_abort)) {
+ if (!tpm_ppi_enabled(tpm)) {
return;
}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index f622b91b76a..4f01e2c476e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2218,7 +2218,7 @@ void acpi_setup(void)
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
tpm = tpm_find();
- if (tpm && object_property_get_bool(OBJECT(tpm), "ppi", &error_abort)) {
+ if (tpm_ppi_enabled(tpm)) {
tpm_config = (FwCfgTPMConfig) {
.tpmppi_address = cpu_to_le32(TPM_PPI_ADDR_BASE),
.tpm_version = tpm_get_version(tpm),
--
2.53.0
next prev parent reply other threads:[~2026-03-17 12:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 12:02 [PATCH v3 0/5] hw/tpm: Remove instance @ppi_enabled field Philippe Mathieu-Daudé
2026-03-17 12:02 ` Philippe Mathieu-Daudé [this message]
2026-03-17 13:18 ` [PATCH v3 1/5] hw/tpm: Factor tpm_ppi_enabled() out Stefan Berger
2026-03-17 12:02 ` [PATCH v3 2/5] hw/tpm: Add TPMIfClass::ppi_enabled field Philippe Mathieu-Daudé
2026-03-17 13:17 ` Stefan Berger
2026-03-17 15:15 ` Philippe Mathieu-Daudé
2026-03-17 12:02 ` [PATCH v3 3/5] hw/tpm: Remove CRBState::ppi_enabled field Philippe Mathieu-Daudé
2026-03-17 13:19 ` Stefan Berger
2026-03-17 15:16 ` Philippe Mathieu-Daudé
2026-03-17 16:58 ` Stefan Berger
2026-03-17 12:02 ` [PATCH v3 4/5] hw/tpm: Propagate @ppi_enabled to tpm_tis_reset() and remove in TPMState Philippe Mathieu-Daudé
2026-03-17 13:21 ` Stefan Berger
2026-03-17 12:02 ` [PATCH v3 5/5] hw/tpm: Simplify tpm_ppi_enabled() Philippe Mathieu-Daudé
2026-03-17 13:21 ` Stefan Berger
2026-03-23 9:56 ` [PATCH v3 0/5] hw/tpm: Remove instance @ppi_enabled field 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=20260317120241.16320-2-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=anisinha@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox