aboutsummaryrefslogtreecommitdiff
path: root/backends/tpm.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-04-15 17:06:04 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-15 17:06:04 -0500
commit4ceb193d30fe9b1cda0dc73bddb8051659926fb9 (patch)
treea9ffbe92293ba9b0cc3298591e7564aae19a0ef1 /backends/tpm.c
parenta907cf59d8a41ecb909ad4367cd016c7d71f8546 (diff)
parentc72dd2d04bd28f7ec6b073316270258684ba5fc3 (diff)
Merge remote-tracking branch 'bonzini/hw-dirs' into staging
* bonzini/hw-dirs: exec: remove useless declarations from memory-internal.h memory: move core typedefs to qemu/typedefs.h include: avoid useless includes of exec/ headers sysemu: avoid proliferation of include/ subdirectories tpm: reorganize headers and split hardware part configure: fix TPM logic acpi.h: make it self contained acpi: move declarations from pc.h to acpi.h hw: Add lost ARM core again Fix failure to create q35 machine Add linux-headers to QEMU_INCLUDES arm: fix location of some include files Conflicts: configure aliguori: trivial conflict in configure output Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'backends/tpm.c')
-rw-r--r--backends/tpm.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/backends/tpm.c b/backends/tpm.c
index 28148c23cf..b73580134c 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -12,9 +12,11 @@
* Based on backends/rng.c by Anthony Liguori
*/
-#include "backends/tpm.h"
-#include "tpm/tpm_int.h"
+#include "sysemu/tpm_backend.h"
#include "qapi/qmp/qerror.h"
+#include "sysemu/tpm.h"
+#include "qemu/thread.h"
+#include "sysemu/tpm_backend_int.h"
enum TpmType tpm_backend_get_type(TPMBackend *s)
{
@@ -137,6 +139,40 @@ static void tpm_backend_instance_init(Object *obj)
NULL);
}
+void tpm_backend_thread_deliver_request(TPMBackendThread *tbt)
+{
+ g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD, NULL);
+}
+
+void tpm_backend_thread_create(TPMBackendThread *tbt,
+ GFunc func, gpointer user_data)
+{
+ if (!tbt->pool) {
+ tbt->pool = g_thread_pool_new(func, user_data, 1, TRUE, NULL);
+ g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL);
+ }
+}
+
+void tpm_backend_thread_end(TPMBackendThread *tbt)
+{
+ if (tbt->pool) {
+ g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_END, NULL);
+ g_thread_pool_free(tbt->pool, FALSE, TRUE);
+ tbt->pool = NULL;
+ }
+}
+
+void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt,
+ GFunc func, gpointer user_data)
+{
+ if (!tbt->pool) {
+ tpm_backend_thread_create(tbt, func, user_data);
+ } else {
+ g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_TPM_RESET,
+ NULL);
+ }
+}
+
static const TypeInfo tpm_backend_info = {
.name = TYPE_TPM_BACKEND,
.parent = TYPE_OBJECT,