On 3/17/26 8:02 AM, Philippe Mathieu-Daudé wrote:
Each TMP derived device has a @ppi_enabled field, itself

TPM?

exposed as a QOM property. External layers (like the ACPI
subsystem) wanting to know whether a device implements PPI
has to check for the QOM property available. This can be
simplified by declaring a single field in the TPM interface.

Here we add such field to TPMIfClass, before converting each
TPM devices to use it in the following commits.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  include/system/tpm.h | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/include/system/tpm.h b/include/system/tpm.h
index b90dd4e8cb0..9458ad6668a 100644
--- a/include/system/tpm.h
+++ b/include/system/tpm.h
@@ -43,6 +43,7 @@ struct TPMIfClass {
      enum TpmModel model;
      void (*request_completed)(TPMIf *obj, int ret);
      enum TPMVersion (*get_version)(TPMIf *obj);
+    bool ppi_enabled;
  };

  #define TYPE_TPM_TIS_ISA            "tpm-tis"
@@ -84,6 +85,9 @@ static inline bool tpm_ppi_enabled(TPMIf *ti)
      if (!ti) {
          return false;
      }
+    if (TPM_IF_GET_CLASS(ti)->ppi_enabled) {
+        return true;
+    }
      return object_property_get_bool(OBJECT(ti), "ppi", &error_abort);
  }


Reviewed-by: Stefan Berger <[email protected]>


Reply via email to