summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/qemu/qemu/0001-tpm-Clean-up-driver-registration-lookup.patch154
-rw-r--r--meta/recipes-devtools/qemu/qemu/0002-tpm-Clean-up-model-registration-lookup.patch121
-rw-r--r--meta/recipes-devtools/qemu/qemu/0003-tpm-backend-Remove-unneeded-member-variable-from-bac.patch75
-rw-r--r--meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch417
-rw-r--r--meta/recipes-devtools/qemu/qemu/0005-tpm-backend-Initialize-and-free-data-members-in-it-s.patch185
-rw-r--r--meta/recipes-devtools/qemu/qemu/0006-tpm-backend-Made-few-interface-methods-optional.patch284
-rw-r--r--meta/recipes-devtools/qemu/qemu/0007-tpm-backend-Add-new-api-to-read-backend-TpmInfo.patch293
-rw-r--r--meta/recipes-devtools/qemu/qemu/0008-tpm-backend-Move-realloc_buffer-implementation-to-tp.patch140
-rw-r--r--meta/recipes-devtools/qemu/qemu/0009-tpm-passthrough-move-reusable-code-to-utils.patch182
-rw-r--r--meta/recipes-devtools/qemu/qemu/0010-tpm-Added-support-for-TPM-emulator.patch1059
-rw-r--r--meta/recipes-devtools/qemu/qemu/0011-tpm-Move-tpm_cleanup-to-right-place.patch43
-rw-r--r--meta/recipes-devtools/qemu/qemu/0012-tpm-Use-EMSGSIZE-instead-of-EBADMSG-to-compile-on-Op.patch67
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2017-17381.patch72
-rw-r--r--meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch72
-rw-r--r--meta/recipes-devtools/qemu/qemu/exclude-some-arm-EABI-obsolete-syscalls.patch87
-rw-r--r--meta/recipes-devtools/qemu/qemu/linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch35
-rw-r--r--meta/recipes-devtools/qemu/qemu/ppc_locking.patch105
-rw-r--r--meta/recipes-devtools/qemu/qemu_2.11.0.bb (renamed from meta/recipes-devtools/qemu/qemu_2.10.1.bb)20
18 files changed, 63 insertions, 3348 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/0001-tpm-Clean-up-driver-registration-lookup.patch b/meta/recipes-devtools/qemu/qemu/0001-tpm-Clean-up-driver-registration-lookup.patch
deleted file mode 100644
index 1a484b91c3..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0001-tpm-Clean-up-driver-registration-lookup.patch
+++ /dev/null
@@ -1,154 +0,0 @@
-From a0f8d150794164f41cd7288c9ed059bbf21c95ec Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
-Date: Thu, 24 Aug 2017 10:45:58 +0200
-Subject: [PATCH 01/12] tpm: Clean up driver registration & lookup
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-We have a strict separation between enum TpmType and be_drivers[]:
-
-* TpmType may have any number of members. It just happens to have one.
-
-* tpm_register_driver() uses the first empty slot in be_drivers[].
-
- If you register more than tpm_models[] has space,
- tpm_register_driver() fails. Its caller silently ignores the
- failure.
-
- If you register more than one with a given TpmType,
- tpm_display_backend_drivers() will shows all of them, but
- tpm_driver_find_by_type() and tpm_get_backend_driver() will find
- only the one one that registered first.
-
-Since we only ever register one driver, and be_drivers[] has space for
-just that one, this contraption even works.
-
-Turn be_drivers[] into a straight map from enum TpmType to driver.
-Much simpler, and has a decent chance to actually work should we ever
-acquire additional drivers.
-
-While there, use qapi_enum_parse() in tpm_get_backend_driver().
-
-Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Message-Id: <20170822132255.23945-8-marcandre.lureau@redhat.com>
-Reviewed-by: Markus Armbruster <armbru@redhat.com>
-[Rebased, superfluous initializer dropped, commit message rewritten]
-Cc: Stefan Berger <stefanb@us.ibm.com>
-Signed-off-by: Markus Armbruster <armbru@redhat.com>
-Message-Id: <1503564371-26090-4-git-send-email-armbru@redhat.com>
-
-Upstream-Status: Backport
----
- include/sysemu/tpm_backend.h | 2 +-
- tpm.c | 45 +++++++++++++-------------------------------
- 2 files changed, 14 insertions(+), 33 deletions(-)
-
-diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
-index b58f52d39f..1d21c6b19b 100644
---- a/include/sysemu/tpm_backend.h
-+++ b/include/sysemu/tpm_backend.h
-@@ -227,6 +227,6 @@ TPMBackend *qemu_find_tpm(const char *id);
-
- const TPMDriverOps *tpm_get_backend_driver(const char *type);
- int tpm_register_model(enum TpmModel model);
--int tpm_register_driver(const TPMDriverOps *tdo);
-+void tpm_register_driver(const TPMDriverOps *tdo);
-
- #endif
-diff --git a/tpm.c b/tpm.c
-index 9a7c7114d3..bb45d0c08e 100644
---- a/tpm.c
-+++ b/tpm.c
-@@ -14,6 +14,7 @@
- #include "qemu/osdep.h"
-
- #include "qapi/qmp/qerror.h"
-+#include "qapi/util.h"
- #include "sysemu/tpm_backend.h"
- #include "sysemu/tpm.h"
- #include "qemu/config-file.h"
-@@ -25,11 +26,8 @@ static QLIST_HEAD(, TPMBackend) tpm_backends =
-
-
- #define TPM_MAX_MODELS 1
--#define TPM_MAX_DRIVERS 1
-
--static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = {
-- NULL,
--};
-+static TPMDriverOps const *be_drivers[TPM_TYPE__MAX];
-
- static enum TpmModel tpm_models[TPM_MAX_MODELS] = {
- TPM_MODEL__MAX,
-@@ -63,31 +61,18 @@ static bool tpm_model_is_registered(enum TpmModel model)
-
- const TPMDriverOps *tpm_get_backend_driver(const char *type)
- {
-- int i;
--
-- for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
-- if (!strcmp(TpmType_lookup[be_drivers[i]->type], type)) {
-- return be_drivers[i];
-- }
-- }
-+ int i = qapi_enum_parse(TpmType_lookup, type, TPM_TYPE__MAX, -1, NULL);
-
-- return NULL;
-+ return i >= 0 ? be_drivers[i] : NULL;
- }
-
- #ifdef CONFIG_TPM
-
--int tpm_register_driver(const TPMDriverOps *tdo)
-+void tpm_register_driver(const TPMDriverOps *tdo)
- {
-- int i;
-+ assert(!be_drivers[tdo->type]);
-
-- for (i = 0; i < TPM_MAX_DRIVERS; i++) {
-- if (!be_drivers[i]) {
-- be_drivers[i] = tdo;
-- return 0;
-- }
-- }
-- error_report("Could not register TPM driver");
-- return 1;
-+ be_drivers[tdo->type] = tdo;
- }
-
- /*
-@@ -100,9 +85,12 @@ static void tpm_display_backend_drivers(void)
-
- fprintf(stderr, "Supported TPM types (choose only one):\n");
-
-- for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
-+ for (i = 0; i < TPM_TYPE__MAX; i++) {
-+ if (be_drivers[i] == NULL) {
-+ continue;
-+ }
- fprintf(stderr, "%12s %s\n",
-- TpmType_lookup[be_drivers[i]->type], be_drivers[i]->desc());
-+ TpmType_lookup[i], be_drivers[i]->desc());
- }
- fprintf(stderr, "\n");
- }
-@@ -239,14 +227,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
-
- static const TPMDriverOps *tpm_driver_find_by_type(enum TpmType type)
- {
-- int i;
--
-- for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
-- if (be_drivers[i]->type == type) {
-- return be_drivers[i];
-- }
-- }
-- return NULL;
-+ return be_drivers[type];
- }
-
- static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
---
-2.11.0
-
diff --git a/meta/recipes-devtools/qemu/qemu/0002-tpm-Clean-up-model-registration-lookup.patch b/meta/recipes-devtools/qemu/qemu/0002-tpm-Clean-up-model-registration-lookup.patch
deleted file mode 100644
index c223ba83b6..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0002-tpm-Clean-up-model-registration-lookup.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-From 89430c64784484214b3c99562520cdffe79cd801 Mon Sep 17 00:00:00 2001
-From: Markus Armbruster <armbru@redhat.com>
-Date: Thu, 24 Aug 2017 10:45:59 +0200
-Subject: [PATCH 02/12] tpm: Clean up model registration & lookup
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-We have a strict separation between enum TpmModel and tpm_models[]:
-
-* TpmModel may have any number of members. It just happens to have one.
-
-* tpm_register_model() uses the first empty slot in tpm_models[].
-
- If you register more than tpm_models[] has space,
- tpn_register_model() fails. Its caller silently ignores the
- failure.
-
- Register the same TpmModel more than once has no effect other than
- wasting tpm_models[] slots: tpm_model_is_registered() is happy with
- the first one it finds.
-
-Since we only ever register one model, and tpm_models[] has space for
-just that one, this contraption even works.
-
-Turn tpm_models[] into a straight map from enum TpmType to bool. Much
-simpler.
-
-Cc: Stefan Berger <stefanb@us.ibm.com>
-Signed-off-by: Markus Armbruster <armbru@redhat.com>
-Message-Id: <1503564371-26090-5-git-send-email-armbru@redhat.com>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-[Commit message typo fixed]
-
-Upstream-Status: Backport
----
- include/sysemu/tpm_backend.h | 2 +-
- tpm.c | 37 +++++--------------------------------
- 2 files changed, 6 insertions(+), 33 deletions(-)
-
-diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
-index 1d21c6b19b..b0a9731aee 100644
---- a/include/sysemu/tpm_backend.h
-+++ b/include/sysemu/tpm_backend.h
-@@ -226,7 +226,7 @@ TPMVersion tpm_backend_get_tpm_version(TPMBackend *s);
- TPMBackend *qemu_find_tpm(const char *id);
-
- const TPMDriverOps *tpm_get_backend_driver(const char *type);
--int tpm_register_model(enum TpmModel model);
-+void tpm_register_model(enum TpmModel model);
- void tpm_register_driver(const TPMDriverOps *tdo);
-
- #endif
-diff --git a/tpm.c b/tpm.c
-index bb45d0c08e..2dbea70645 100644
---- a/tpm.c
-+++ b/tpm.c
-@@ -24,39 +24,12 @@
- static QLIST_HEAD(, TPMBackend) tpm_backends =
- QLIST_HEAD_INITIALIZER(tpm_backends);
-
--
--#define TPM_MAX_MODELS 1
--
- static TPMDriverOps const *be_drivers[TPM_TYPE__MAX];
-+static bool tpm_models[TPM_MODEL__MAX];
-
--static enum TpmModel tpm_models[TPM_MAX_MODELS] = {
-- TPM_MODEL__MAX,
--};
--
--int tpm_register_model(enum TpmModel model)
--{
-- int i;
--
-- for (i = 0; i < TPM_MAX_MODELS; i++) {
-- if (tpm_models[i] == TPM_MODEL__MAX) {
-- tpm_models[i] = model;
-- return 0;
-- }
-- }
-- error_report("Could not register TPM model");
-- return 1;
--}
--
--static bool tpm_model_is_registered(enum TpmModel model)
-+void tpm_register_model(enum TpmModel model)
- {
-- int i;
--
-- for (i = 0; i < TPM_MAX_MODELS; i++) {
-- if (tpm_models[i] == model) {
-- return true;
-- }
-- }
-- return false;
-+ tpm_models[model] = true;
- }
-
- const TPMDriverOps *tpm_get_backend_driver(const char *type)
-@@ -270,7 +243,7 @@ TPMInfoList *qmp_query_tpm(Error **errp)
- TPMInfoList *info, *head = NULL, *cur_item = NULL;
-
- QLIST_FOREACH(drv, &tpm_backends, list) {
-- if (!tpm_model_is_registered(drv->fe_model)) {
-+ if (!tpm_models[drv->fe_model]) {
- continue;
- }
- info = g_new0(TPMInfoList, 1);
-@@ -317,7 +290,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
- TpmModelList *head = NULL, *prev = NULL, *cur_item;
-
- for (i = 0; i < TPM_MODEL__MAX; i++) {
-- if (!tpm_model_is_registered(i)) {
-+ if (!tpm_models[i]) {
- continue;
- }
- cur_item = g_new0(TpmModelList, 1);
---
-2.11.0
-
diff --git a/meta/recipes-devtools/qemu/qemu/0003-tpm-backend-Remove-unneeded-member-variable-from-bac.patch b/meta/recipes-devtools/qemu/qemu/0003-tpm-backend-Remove-unneeded-member-variable-from-bac.patch
deleted file mode 100644
index 6b94eba720..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0003-tpm-backend-Remove-unneeded-member-variable-from-bac.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From cac845f55b8f27e5c90e0f2e3dcbeea7013df67c Mon Sep 17 00:00:00 2001
-From: Amarnath Valluri <amarnath.valluri@intel.com>
-Date: Thu, 30 Mar 2017 15:55:17 +0300
-Subject: [PATCH 03/12] tpm-backend: Remove unneeded member variable from
- backend class
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-TPMDriverOps inside TPMBackend is not required, as it is supposed to be a class
-member. The only possible reason for keeping in TPMBackend was, to get the
-backend type in tpm.c where dedicated backend api, tpm_backend_get_type() is
-present.
-
-Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
-
-Upstream-Status: Backport [fb4b0c6765471dad2363875989e7661ca5f9a608]
----
- hw/tpm/tpm_passthrough.c | 4 ----
- include/sysemu/tpm_backend.h | 1 -
- tpm.c | 2 +-
- 3 files changed, 1 insertion(+), 6 deletions(-)
-
-diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
-index 9234eb3459..a0baf5f080 100644
---- a/hw/tpm/tpm_passthrough.c
-+++ b/hw/tpm/tpm_passthrough.c
-@@ -46,8 +46,6 @@
- #define TPM_PASSTHROUGH(obj) \
- OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
-
--static const TPMDriverOps tpm_passthrough_driver;
--
- /* data structures */
- typedef struct TPMPassthruThreadParams {
- TPMState *tpm_state;
-@@ -462,8 +460,6 @@ static TPMBackend *tpm_passthrough_create(QemuOpts *opts, const char *id)
- /* let frontend set the fe_model to proper value */
- tb->fe_model = -1;
-
-- tb->ops = &tpm_passthrough_driver;
--
- if (tpm_passthrough_handle_device_opts(opts, tb)) {
- goto err_exit;
- }
-diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
-index b0a9731aee..3708413035 100644
---- a/include/sysemu/tpm_backend.h
-+++ b/include/sysemu/tpm_backend.h
-@@ -50,7 +50,6 @@ struct TPMBackend {
- enum TpmModel fe_model;
- char *path;
- char *cancel_path;
-- const TPMDriverOps *ops;
-
- QLIST_ENTRY(TPMBackend) list;
- };
-diff --git a/tpm.c b/tpm.c
-index 2dbea70645..b7166ca200 100644
---- a/tpm.c
-+++ b/tpm.c
-@@ -212,7 +212,7 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
- res->model = drv->fe_model;
- res->options = g_new0(TpmTypeOptions, 1);
-
-- switch (drv->ops->type) {
-+ switch (tpm_backend_get_type(drv)) {
- case TPM_TYPE_PASSTHROUGH:
- res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH;
- tpo = g_new0(TPMPassthroughOptions, 1);
---
-2.11.0
-
diff --git a/meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch b/meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch
deleted file mode 100644
index 64e88b6de9..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch
+++ /dev/null
@@ -1,417 +0,0 @@
-From 5767322022d54ceb5a2ed6c650f667a4d24aa150 Mon Sep 17 00:00:00 2001
-From: Amarnath Valluri <amarnath.valluri@intel.com>
-Date: Thu, 30 Mar 2017 16:20:25 +0300
-Subject: [PATCH 04/12] tpm-backend: Move thread handling inside TPMBackend
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Move thread handling inside TPMBackend, this way backend implementations need
-not to maintain their own thread life cycle, instead they needs to implement
-'handle_request()' class method that always been called from a thread.
-
-This change made tpm_backend_int.h kind of useless, hence removed it.
-
-Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
-
-Upstream-Status: Backport [b19a5eea5a26e9bd83a48c742172d2a6aa8c4180]
----
- backends/tpm.c | 62 +++++++++++++++++++++++++---------------
- hw/tpm/tpm_passthrough.c | 58 ++++++-------------------------------
- include/sysemu/tpm_backend.h | 32 +++++++++++++--------
- include/sysemu/tpm_backend_int.h | 41 --------------------------
- 4 files changed, 67 insertions(+), 126 deletions(-)
- delete mode 100644 include/sysemu/tpm_backend_int.h
-
-diff --git a/backends/tpm.c b/backends/tpm.c
-index 536f262bb7..ce56c3b74d 100644
---- a/backends/tpm.c
-+++ b/backends/tpm.c
-@@ -18,7 +18,24 @@
- #include "qapi/qmp/qerror.h"
- #include "sysemu/tpm.h"
- #include "qemu/thread.h"
--#include "sysemu/tpm_backend_int.h"
-+
-+static void tpm_backend_worker_thread(gpointer data, gpointer user_data)
-+{
-+ TPMBackend *s = TPM_BACKEND(user_data);
-+ TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-+
-+ assert(k->handle_request != NULL);
-+ k->handle_request(s, (TPMBackendCmd)data);
-+}
-+
-+static void tpm_backend_thread_end(TPMBackend *s)
-+{
-+ if (s->thread_pool) {
-+ g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_END, NULL);
-+ g_thread_pool_free(s->thread_pool, FALSE, TRUE);
-+ s->thread_pool = NULL;
-+ }
-+}
-
- enum TpmType tpm_backend_get_type(TPMBackend *s)
- {
-@@ -39,6 +56,8 @@ void tpm_backend_destroy(TPMBackend *s)
- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
- k->ops->destroy(s);
-+
-+ tpm_backend_thread_end(s);
- }
-
- int tpm_backend_init(TPMBackend *s, TPMState *state,
-@@ -46,13 +65,23 @@ int tpm_backend_init(TPMBackend *s, TPMState *state,
- {
- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-- return k->ops->init(s, state, datacb);
-+ s->tpm_state = state;
-+ s->recv_data_callback = datacb;
-+
-+ return k->ops->init(s);
- }
-
- int tpm_backend_startup_tpm(TPMBackend *s)
- {
- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-+ /* terminate a running TPM */
-+ tpm_backend_thread_end(s);
-+
-+ s->thread_pool = g_thread_pool_new(tpm_backend_worker_thread, s, 1, TRUE,
-+ NULL);
-+ g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL);
-+
- return k->ops->startup_tpm(s);
- }
-
-@@ -72,9 +101,8 @@ size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb)
-
- void tpm_backend_deliver_request(TPMBackend *s)
- {
-- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
--
-- k->ops->deliver_request(s);
-+ g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD,
-+ NULL);
- }
-
- void tpm_backend_reset(TPMBackend *s)
-@@ -82,6 +110,8 @@ void tpm_backend_reset(TPMBackend *s)
- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
- k->ops->reset(s);
-+
-+ tpm_backend_thread_end(s);
- }
-
- void tpm_backend_cancel_cmd(TPMBackend *s)
-@@ -156,29 +186,14 @@ static void tpm_backend_instance_init(Object *obj)
- tpm_backend_prop_get_opened,
- tpm_backend_prop_set_opened,
- 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)
-+static void tpm_backend_instance_finalize(Object *obj)
- {
-- 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);
-- }
--}
-+ TPMBackend *s = TPM_BACKEND(obj);
-
--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;
-- }
-+ tpm_backend_thread_end(s);
- }
-
- static const TypeInfo tpm_backend_info = {
-@@ -186,6 +201,7 @@ static const TypeInfo tpm_backend_info = {
- .parent = TYPE_OBJECT,
- .instance_size = sizeof(TPMBackend),
- .instance_init = tpm_backend_instance_init,
-+ .instance_finalize = tpm_backend_instance_finalize,
- .class_size = sizeof(TPMBackendClass),
- .abstract = true,
- };
-diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
-index a0baf5f080..f50d9cffd7 100644
---- a/hw/tpm/tpm_passthrough.c
-+++ b/hw/tpm/tpm_passthrough.c
-@@ -30,7 +30,6 @@
- #include "tpm_int.h"
- #include "hw/hw.h"
- #include "hw/i386/pc.h"
--#include "sysemu/tpm_backend_int.h"
- #include "tpm_tis.h"
- #include "tpm_util.h"
-
-@@ -47,20 +46,9 @@
- OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
-
- /* data structures */
--typedef struct TPMPassthruThreadParams {
-- TPMState *tpm_state;
--
-- TPMRecvDataCB *recv_data_callback;
-- TPMBackend *tb;
--} TPMPassthruThreadParams;
--
- struct TPMPassthruState {
- TPMBackend parent;
-
-- TPMBackendThread tbt;
--
-- TPMPassthruThreadParams tpm_thread_params;
--
- char *tpm_dev;
- int tpm_fd;
- bool tpm_executing;
-@@ -214,12 +202,9 @@ static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt,
- selftest_done);
- }
-
--static void tpm_passthrough_worker_thread(gpointer data,
-- gpointer user_data)
-+static void tpm_passthrough_handle_request(TPMBackend *tb, TPMBackendCmd cmd)
- {
-- TPMPassthruThreadParams *thr_parms = user_data;
-- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(thr_parms->tb);
-- TPMBackendCmd cmd = (TPMBackendCmd)data;
-+ TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
- bool selftest_done = false;
-
- DPRINTF("tpm_passthrough: processing command type %d\n", cmd);
-@@ -227,12 +212,12 @@ static void tpm_passthrough_worker_thread(gpointer data,
- switch (cmd) {
- case TPM_BACKEND_CMD_PROCESS_CMD:
- tpm_passthrough_unix_transfer(tpm_pt,
-- thr_parms->tpm_state->locty_data,
-+ tb->tpm_state->locty_data,
- &selftest_done);
-
-- thr_parms->recv_data_callback(thr_parms->tpm_state,
-- thr_parms->tpm_state->locty_number,
-- selftest_done);
-+ tb->recv_data_callback(tb->tpm_state,
-+ tb->tpm_state->locty_number,
-+ selftest_done);
- break;
- case TPM_BACKEND_CMD_INIT:
- case TPM_BACKEND_CMD_END:
-@@ -248,15 +233,6 @@ static void tpm_passthrough_worker_thread(gpointer data,
- */
- static int tpm_passthrough_startup_tpm(TPMBackend *tb)
- {
-- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
--
-- /* terminate a running TPM */
-- tpm_backend_thread_end(&tpm_pt->tbt);
--
-- tpm_backend_thread_create(&tpm_pt->tbt,
-- tpm_passthrough_worker_thread,
-- &tpm_pt->tpm_thread_params);
--
- return 0;
- }
-
-@@ -268,20 +244,11 @@ static void tpm_passthrough_reset(TPMBackend *tb)
-
- tpm_passthrough_cancel_cmd(tb);
-
-- tpm_backend_thread_end(&tpm_pt->tbt);
--
- tpm_pt->had_startup_error = false;
- }
-
--static int tpm_passthrough_init(TPMBackend *tb, TPMState *s,
-- TPMRecvDataCB *recv_data_cb)
-+static int tpm_passthrough_init(TPMBackend *tb)
- {
-- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
--
-- tpm_pt->tpm_thread_params.tpm_state = s;
-- tpm_pt->tpm_thread_params.recv_data_callback = recv_data_cb;
-- tpm_pt->tpm_thread_params.tb = tb;
--
- return 0;
- }
-
-@@ -315,13 +282,6 @@ static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb)
- return sb->size;
- }
-
--static void tpm_passthrough_deliver_request(TPMBackend *tb)
--{
-- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
--
-- tpm_backend_thread_deliver_request(&tpm_pt->tbt);
--}
--
- static void tpm_passthrough_cancel_cmd(TPMBackend *tb)
- {
- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-@@ -483,8 +443,6 @@ static void tpm_passthrough_destroy(TPMBackend *tb)
-
- tpm_passthrough_cancel_cmd(tb);
-
-- tpm_backend_thread_end(&tpm_pt->tbt);
--
- qemu_close(tpm_pt->tpm_fd);
- qemu_close(tpm_pt->cancel_fd);
-
-@@ -520,7 +478,6 @@ static const TPMDriverOps tpm_passthrough_driver = {
- .realloc_buffer = tpm_passthrough_realloc_buffer,
- .reset = tpm_passthrough_reset,
- .had_startup_error = tpm_passthrough_get_startup_error,
-- .deliver_request = tpm_passthrough_deliver_request,
- .cancel_cmd = tpm_passthrough_cancel_cmd,
- .get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag,
- .reset_tpm_established_flag = tpm_passthrough_reset_tpm_established_flag,
-@@ -540,6 +497,7 @@ static void tpm_passthrough_class_init(ObjectClass *klass, void *data)
- TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass);
-
- tbc->ops = &tpm_passthrough_driver;
-+ tbc->handle_request = tpm_passthrough_handle_request;
- }
-
- static const TypeInfo tpm_passthrough_info = {
-diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
-index 3708413035..58308b3687 100644
---- a/include/sysemu/tpm_backend.h
-+++ b/include/sysemu/tpm_backend.h
-@@ -29,22 +29,24 @@
-
- typedef struct TPMBackendClass TPMBackendClass;
- typedef struct TPMBackend TPMBackend;
--
- typedef struct TPMDriverOps TPMDriverOps;
-+typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done);
-
--struct TPMBackendClass {
-- ObjectClass parent_class;
--
-- const TPMDriverOps *ops;
--
-- void (*opened)(TPMBackend *s, Error **errp);
--};
-+typedef enum TPMBackendCmd {
-+ TPM_BACKEND_CMD_INIT = 1,
-+ TPM_BACKEND_CMD_PROCESS_CMD,
-+ TPM_BACKEND_CMD_END,
-+ TPM_BACKEND_CMD_TPM_RESET,
-+} TPMBackendCmd;
-
- struct TPMBackend {
- Object parent;
-
- /*< protected >*/
- bool opened;
-+ TPMState *tpm_state;
-+ GThreadPool *thread_pool;
-+ TPMRecvDataCB *recv_data_callback;
-
- char *id;
- enum TpmModel fe_model;
-@@ -54,7 +56,15 @@ struct TPMBackend {
- QLIST_ENTRY(TPMBackend) list;
- };
-
--typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done);
-+struct TPMBackendClass {
-+ ObjectClass parent_class;
-+
-+ const TPMDriverOps *ops;
-+
-+ void (*opened)(TPMBackend *s, Error **errp);
-+
-+ void (*handle_request)(TPMBackend *s, TPMBackendCmd cmd);
-+};
-
- typedef struct TPMSizedBuffer {
- uint32_t size;
-@@ -71,7 +81,7 @@ struct TPMDriverOps {
- void (*destroy)(TPMBackend *t);
-
- /* initialize the backend */
-- int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb);
-+ int (*init)(TPMBackend *t);
- /* start up the TPM on the backend */
- int (*startup_tpm)(TPMBackend *t);
- /* returns true if nothing will ever answer TPM requests */
-@@ -79,8 +89,6 @@ struct TPMDriverOps {
-
- size_t (*realloc_buffer)(TPMSizedBuffer *sb);
-
-- void (*deliver_request)(TPMBackend *t);
--
- void (*reset)(TPMBackend *t);
-
- void (*cancel_cmd)(TPMBackend *t);
-diff --git a/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h
-deleted file mode 100644
-index 00639dd7de..0000000000
---- a/include/sysemu/tpm_backend_int.h
-+++ /dev/null
-@@ -1,41 +0,0 @@
--/*
-- * common TPM backend driver functions
-- *
-- * Copyright (c) 2012-2013 IBM Corporation
-- * Authors:
-- * Stefan Berger <stefanb@us.ibm.com>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Lesser General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Lesser General Public License for more details.
-- *
-- * You should have received a copy of the GNU Lesser General Public
-- * License along with this library; if not, see <http://www.gnu.org/licenses/>
-- */
--
--#ifndef TPM_BACKEND_INT_H
--#define TPM_BACKEND_INT_H
--
--typedef struct TPMBackendThread {
-- GThreadPool *pool;
--} TPMBackendThread;
--
--void tpm_backend_thread_deliver_request(TPMBackendThread *tbt);
--void tpm_backend_thread_create(TPMBackendThread *tbt,
-- GFunc func, gpointer user_data);
--void tpm_backend_thread_end(TPMBackendThread *tbt);
--
--typedef enum TPMBackendCmd {
-- TPM_BACKEND_CMD_INIT = 1,
-- TPM_BACKEND_CMD_PROCESS_CMD,
-- TPM_BACKEND_CMD_END,
-- TPM_BACKEND_CMD_TPM_RESET,
--} TPMBackendCmd;
--
--#endif /* TPM_BACKEND_INT_H */
---
-2.11.0
-
diff --git a/meta/recipes-devtools/qemu/qemu/0005-tpm-backend-Initialize-and-free-data-members-in-it-s.patch b/meta/recipes-devtools/qemu/qemu/0005-tpm-backend-Initialize-and-free-data-members-in-it-s.patch
deleted file mode 100644
index 91dd542f45..0000000000
--- a/meta/recipes-devtools/qemu/qemu/0005-tpm-backend-Initialize-and-free-data-members-in-it-s.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From 83ef052c60de271a97abb7eb9b5a8aeee52659e6 Mon Sep 17 00:00:00 2001
-From: Amarnath Valluri <amarnath.valluri@intel.com>
-Date: Fri, 31 Mar 2017 10:58:11 +0300
-Subject: [PATCH 05/12] tpm-backend: Initialize and free data members in it's
- own methods
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Initialize and free TPMBackend data members in it's own instance_init() and
-instance_finalize methods.
-
-Took the opportunity to remove unneeded destroy() method from TpmDriverOps
-interface as TPMBackend is a Qemu Object, we can use object_unref() inplace of
-tpm_backend_destroy() to free the backend object, hence removed destroy() from
-TPMDriverOps interface.
-
-Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
-Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
-
-Upstream-Status: Backport [f35fe5cb97bbdaa6a6967f2fefc3fc1f79680601]
----
- backends/tpm.c | 16 ++++++----------
- hw/tpm/tpm_passthrough.c | 31 ++++++++++++-------------------
- include/sysemu/tpm_backend.h | 7 -------
- tpm.c | 2 +-
- 4 files changed, 19 insertions(+), 37 deletions(-)
-
-diff --git a/backends/tpm.c b/backends/tpm.c
-index ce56c3b74d..cf5abf1582 100644
---- a/backends/tpm.c
-+++ b/backends/tpm.c
-@@ -51,15 +51,6 @@ const char *tpm_backend_get_desc(TPMBackend *s)
- return k->ops->desc();
- }
-
--void tpm_backend_destroy(TPMBackend *s)
--{
-- TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
--
-- k->ops->destroy(s);
--
-- tpm_backend_thread_end(s);
--}
--
- int tpm_backend_init(TPMBackend *s, TPMState *state,
- TPMRecvDataCB *datacb)
- {
-@@ -182,17 +173,22 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)
-
- static void tpm_backend_instance_init(Object *obj)
- {
-+ TPMBackend *s = TPM_BACKEND(obj);
-+
- object_property_add_bool(obj, "opened",
- tpm_backend_prop_get_opened,
- tpm_backend_prop_set_opened,
- NULL);
--
-+ s->fe_model = -1;
- }
-
- static void tpm_backend_instance_finalize(Object *obj)
- {
- TPMBackend *s = TPM_BACKEND(obj);
-
-+ g_free(s->id);
-+ g_free(s->path);
-+ g_free(s->cancel_path);
- tpm_backend_thread_end(s);
- }
-
-diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
-index f50d9cffd7..815a72ef9a 100644
---- a/hw/tpm/tpm_passthrough.c
-+++ b/hw/tpm/tpm_passthrough.c
-@@ -417,8 +417,6 @@ static TPMBackend *tpm_passthrough_create(QemuOpts *opts, const char *id)
- TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
- tb->id = g_strdup(id);
-- /* let frontend set the fe_model to proper value */
-- tb->fe_model = -1;
-
- if (tpm_passthrough_handle_device_opts(opts, tb)) {
- goto err_exit;
-@@ -432,26 +430,11 @@ static TPMBackend *tpm_passthrough_create(QemuOpts *opts, const char *id)
- return tb;
-
- err_exit: