qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 2/8] tpm_backend: Implement check whether tpm backend is suspe


From: Stefan Berger
Subject: [PATCH v4 2/8] tpm_backend: Implement check whether tpm backend is suspended
Date: Thu, 12 Dec 2019 13:07:38 -0500

Some frontends need to know whether the backend is suspended.
Implement tpm_backend_is_suspended().

Signed-off-by: Stefan Berger <address@hidden>

diff --git a/backends/tpm.c b/backends/tpm.c
index 375587e743..424c9fd485 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -163,6 +163,13 @@ size_t tpm_backend_get_buffer_size(TPMBackend *s)
     return k->get_buffer_size(s);
 }
 
+bool tpm_backend_is_suspended(TPMBackend *s)
+{
+    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
+
+    return k->is_suspended(s);
+}
+
 TPMInfo *tpm_backend_query_tpm(TPMBackend *s)
 {
     TPMInfo *info = g_new0(TPMInfo, 1);
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 9e7451fb52..f5d8051b45 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -84,6 +84,8 @@ struct TPMBackendClass {
     TpmTypeOptions *(*get_tpm_options)(TPMBackend *t);
 
     void (*handle_request)(TPMBackend *s, TPMBackendCmd *cmd, Error **errp);
+
+    bool (*is_suspended)(TPMBackend *t);
 };
 
 /**
@@ -213,6 +215,16 @@ void tpm_backend_finish_sync(TPMBackend *s);
  */
 TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
 
+/**
+ * tpm_backend_is_suspended:
+ * @s: the backend to call into
+ *
+ * Whether the backend is suspended
+ *
+ * Returns true in case the backend is suspended
+ */
+bool tpm_backend_is_suspended(TPMBackend *s);
+
 TPMBackend *qemu_find_tpm_be(const char *id);
 
 #endif
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]