diff options
author | Alistair Francis <alistair.francis@xilinx.com> | 2018-01-17 13:39:06 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-01-18 12:50:37 +0000 |
commit | a69425e49a44a7f9a2f045506d92b9c41e667257 (patch) | |
tree | 30b172adcf4852d98ffd204c81051afccc9bd997 /meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch | |
parent | f4fb8ecb8a0552cb637335ce56499e9df3998933 (diff) | |
download | poky-a69425e49a44a7f9a2f045506d92b9c41e667257.tar.gz |
qemu: Bump to version 2.11.0
Use the latest QEMU release 2.11. Remove all patches that are no longer
required as they have been merged into the 2.11 releaese. One patch had
to be updated to apply to the 2.11 tree.
This also applies a linux user patch to avoid webkitgtk build hangs.
(From OE-Core rev: d6d0d99569e0d8b62a61e27d389e7939af45bab9)
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/0004-tpm-backend-Move-thread-handling-inside-TPMBackend.patch | 417 |
1 files changed, 0 insertions, 417 deletions
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 @@ | |||
1 | From 5767322022d54ceb5a2ed6c650f667a4d24aa150 Mon Sep 17 00:00:00 2001 | ||
2 | From: Amarnath Valluri <amarnath.valluri@intel.com> | ||
3 | Date: Thu, 30 Mar 2017 16:20:25 +0300 | ||
4 | Subject: [PATCH 04/12] tpm-backend: Move thread handling inside TPMBackend | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Move thread handling inside TPMBackend, this way backend implementations need | ||
10 | not to maintain their own thread life cycle, instead they needs to implement | ||
11 | 'handle_request()' class method that always been called from a thread. | ||
12 | |||
13 | This change made tpm_backend_int.h kind of useless, hence removed it. | ||
14 | |||
15 | Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> | ||
16 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
17 | Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> | ||
18 | |||
19 | Upstream-Status: Backport [b19a5eea5a26e9bd83a48c742172d2a6aa8c4180] | ||
20 | --- | ||
21 | backends/tpm.c | 62 +++++++++++++++++++++++++--------------- | ||
22 | hw/tpm/tpm_passthrough.c | 58 ++++++------------------------------- | ||
23 | include/sysemu/tpm_backend.h | 32 +++++++++++++-------- | ||
24 | include/sysemu/tpm_backend_int.h | 41 -------------------------- | ||
25 | 4 files changed, 67 insertions(+), 126 deletions(-) | ||
26 | delete mode 100644 include/sysemu/tpm_backend_int.h | ||
27 | |||
28 | diff --git a/backends/tpm.c b/backends/tpm.c | ||
29 | index 536f262bb7..ce56c3b74d 100644 | ||
30 | --- a/backends/tpm.c | ||
31 | +++ b/backends/tpm.c | ||
32 | @@ -18,7 +18,24 @@ | ||
33 | #include "qapi/qmp/qerror.h" | ||
34 | #include "sysemu/tpm.h" | ||
35 | #include "qemu/thread.h" | ||
36 | -#include "sysemu/tpm_backend_int.h" | ||
37 | + | ||
38 | +static void tpm_backend_worker_thread(gpointer data, gpointer user_data) | ||
39 | +{ | ||
40 | + TPMBackend *s = TPM_BACKEND(user_data); | ||
41 | + TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
42 | + | ||
43 | + assert(k->handle_request != NULL); | ||
44 | + k->handle_request(s, (TPMBackendCmd)data); | ||
45 | +} | ||
46 | + | ||
47 | +static void tpm_backend_thread_end(TPMBackend *s) | ||
48 | +{ | ||
49 | + if (s->thread_pool) { | ||
50 | + g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_END, NULL); | ||
51 | + g_thread_pool_free(s->thread_pool, FALSE, TRUE); | ||
52 | + s->thread_pool = NULL; | ||
53 | + } | ||
54 | +} | ||
55 | |||
56 | enum TpmType tpm_backend_get_type(TPMBackend *s) | ||
57 | { | ||
58 | @@ -39,6 +56,8 @@ void tpm_backend_destroy(TPMBackend *s) | ||
59 | TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
60 | |||
61 | k->ops->destroy(s); | ||
62 | + | ||
63 | + tpm_backend_thread_end(s); | ||
64 | } | ||
65 | |||
66 | int tpm_backend_init(TPMBackend *s, TPMState *state, | ||
67 | @@ -46,13 +65,23 @@ int tpm_backend_init(TPMBackend *s, TPMState *state, | ||
68 | { | ||
69 | TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
70 | |||
71 | - return k->ops->init(s, state, datacb); | ||
72 | + s->tpm_state = state; | ||
73 | + s->recv_data_callback = datacb; | ||
74 | + | ||
75 | + return k->ops->init(s); | ||
76 | } | ||
77 | |||
78 | int tpm_backend_startup_tpm(TPMBackend *s) | ||
79 | { | ||
80 | TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
81 | |||
82 | + /* terminate a running TPM */ | ||
83 | + tpm_backend_thread_end(s); | ||
84 | + | ||
85 | + s->thread_pool = g_thread_pool_new(tpm_backend_worker_thread, s, 1, TRUE, | ||
86 | + NULL); | ||
87 | + g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL); | ||
88 | + | ||
89 | return k->ops->startup_tpm(s); | ||
90 | } | ||
91 | |||
92 | @@ -72,9 +101,8 @@ size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb) | ||
93 | |||
94 | void tpm_backend_deliver_request(TPMBackend *s) | ||
95 | { | ||
96 | - TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
97 | - | ||
98 | - k->ops->deliver_request(s); | ||
99 | + g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD, | ||
100 | + NULL); | ||
101 | } | ||
102 | |||
103 | void tpm_backend_reset(TPMBackend *s) | ||
104 | @@ -82,6 +110,8 @@ void tpm_backend_reset(TPMBackend *s) | ||
105 | TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s); | ||
106 | |||
107 | k->ops->reset(s); | ||
108 | + | ||
109 | + tpm_backend_thread_end(s); | ||
110 | } | ||
111 | |||
112 | void tpm_backend_cancel_cmd(TPMBackend *s) | ||
113 | @@ -156,29 +186,14 @@ static void tpm_backend_instance_init(Object *obj) | ||
114 | tpm_backend_prop_get_opened, | ||
115 | tpm_backend_prop_set_opened, | ||
116 | NULL); | ||
117 | -} | ||
118 | |||
119 | -void tpm_backend_thread_deliver_request(TPMBackendThread *tbt) | ||
120 | -{ | ||
121 | - g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD, NULL); | ||
122 | } | ||
123 | |||
124 | -void tpm_backend_thread_create(TPMBackendThread *tbt, | ||
125 | - GFunc func, gpointer user_data) | ||
126 | +static void tpm_backend_instance_finalize(Object *obj) | ||
127 | { | ||
128 | - if (!tbt->pool) { | ||
129 | - tbt->pool = g_thread_pool_new(func, user_data, 1, TRUE, NULL); | ||
130 | - g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL); | ||
131 | - } | ||
132 | -} | ||
133 | + TPMBackend *s = TPM_BACKEND(obj); | ||
134 | |||
135 | -void tpm_backend_thread_end(TPMBackendThread *tbt) | ||
136 | -{ | ||
137 | - if (tbt->pool) { | ||
138 | - g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_END, NULL); | ||
139 | - g_thread_pool_free(tbt->pool, FALSE, TRUE); | ||
140 | - tbt->pool = NULL; | ||
141 | - } | ||
142 | + tpm_backend_thread_end(s); | ||
143 | } | ||
144 | |||
145 | static const TypeInfo tpm_backend_info = { | ||
146 | @@ -186,6 +201,7 @@ static const TypeInfo tpm_backend_info = { | ||
147 | .parent = TYPE_OBJECT, | ||
148 | .instance_size = sizeof(TPMBackend), | ||
149 | .instance_init = tpm_backend_instance_init, | ||
150 | + .instance_finalize = tpm_backend_instance_finalize, | ||
151 | .class_size = sizeof(TPMBackendClass), | ||
152 | .abstract = true, | ||
153 | }; | ||
154 | diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c | ||
155 | index a0baf5f080..f50d9cffd7 100644 | ||
156 | --- a/hw/tpm/tpm_passthrough.c | ||
157 | +++ b/hw/tpm/tpm_passthrough.c | ||
158 | @@ -30,7 +30,6 @@ | ||
159 | #include "tpm_int.h" | ||
160 | #include "hw/hw.h" | ||
161 | #include "hw/i386/pc.h" | ||
162 | -#include "sysemu/tpm_backend_int.h" | ||
163 | #include "tpm_tis.h" | ||
164 | #include "tpm_util.h" | ||
165 | |||
166 | @@ -47,20 +46,9 @@ | ||
167 | OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH) | ||
168 | |||
169 | /* data structures */ | ||
170 | -typedef struct TPMPassthruThreadParams { | ||
171 | - TPMState *tpm_state; | ||
172 | - | ||
173 | - TPMRecvDataCB *recv_data_callback; | ||
174 | - TPMBackend *tb; | ||
175 | -} TPMPassthruThreadParams; | ||
176 | - | ||
177 | struct TPMPassthruState { | ||
178 | TPMBackend parent; | ||
179 | |||
180 | - TPMBackendThread tbt; | ||
181 | - | ||
182 | - TPMPassthruThreadParams tpm_thread_params; | ||
183 | - | ||
184 | char *tpm_dev; | ||
185 | int tpm_fd; | ||
186 | bool tpm_executing; | ||
187 | @@ -214,12 +202,9 @@ static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt, | ||
188 | selftest_done); | ||
189 | } | ||
190 | |||
191 | -static void tpm_passthrough_worker_thread(gpointer data, | ||
192 | - gpointer user_data) | ||
193 | +static void tpm_passthrough_handle_request(TPMBackend *tb, TPMBackendCmd cmd) | ||
194 | { | ||
195 | - TPMPassthruThreadParams *thr_parms = user_data; | ||
196 | - TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(thr_parms->tb); | ||
197 | - TPMBackendCmd cmd = (TPMBackendCmd)data; | ||
198 | + TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); | ||
199 | bool selftest_done = false; | ||
200 | |||
201 | DPRINTF("tpm_passthrough: processing command type %d\n", cmd); | ||
202 | @@ -227,12 +212,12 @@ static void tpm_passthrough_worker_thread(gpointer data, | ||
203 | switch (cmd) { | ||
204 | case TPM_BACKEND_CMD_PROCESS_CMD: | ||
205 | tpm_passthrough_unix_transfer(tpm_pt, | ||
206 | - thr_parms->tpm_state->locty_data, | ||
207 | + tb->tpm_state->locty_data, | ||
208 | &selftest_done); | ||
209 | |||
210 | - thr_parms->recv_data_callback(thr_parms->tpm_state, | ||
211 | - thr_parms->tpm_state->locty_number, | ||
212 | - selftest_done); | ||
213 | + tb->recv_data_callback(tb->tpm_state, | ||
214 | + tb->tpm_state->locty_number, | ||
215 | + selftest_done); | ||
216 | break; | ||
217 | case TPM_BACKEND_CMD_INIT: | ||
218 | case TPM_BACKEND_CMD_END: | ||
219 | @@ -248,15 +233,6 @@ static void tpm_passthrough_worker_thread(gpointer data, | ||
220 | */ | ||
221 | static int tpm_passthrough_startup_tpm(TPMBackend *tb) | ||
222 | { | ||
223 | - TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); | ||
224 | - | ||
225 | - /* terminate a running TPM */ | ||
226 | - tpm_backend_thread_end(&tpm_pt->tbt); | ||
227 | - | ||
228 | - tpm_backend_thread_create(&tpm_pt->tbt, | ||
229 | - tpm_passthrough_worker_thread, | ||
230 | - &tpm_pt->tpm_thread_params); | ||
231 | - | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | @@ -268,20 +244,11 @@ static void tpm_passthrough_reset(TPMBackend *tb) | ||
236 | |||
237 | tpm_passthrough_cancel_cmd(tb); | ||
238 | |||
239 | - tpm_backend_thread_end(&tpm_pt->tbt); | ||
240 | - | ||
241 | tpm_pt->had_startup_error = false; | ||
242 | } | ||
243 | |||
244 | -static int tpm_passthrough_init(TPMBackend *tb, TPMState *s, | ||
245 | - TPMRecvDataCB *recv_data_cb) | ||
246 | +static int tpm_passthrough_init(TPMBackend *tb) | ||
247 | { | ||
248 | - TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); | ||
249 | - | ||
250 | - tpm_pt->tpm_thread_params.tpm_state = s; | ||
251 | - tpm_pt->tpm_thread_params.recv_data_callback = recv_data_cb; | ||
252 | - tpm_pt->tpm_thread_params.tb = tb; | ||
253 | - | ||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | @@ -315,13 +282,6 @@ static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb) | ||
258 | return sb->size; | ||
259 | } | ||
260 | |||
261 | -static void tpm_passthrough_deliver_request(TPMBackend *tb) | ||
262 | -{ | ||
263 | - TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); | ||
264 | - | ||
265 | - tpm_backend_thread_deliver_request(&tpm_pt->tbt); | ||
266 | -} | ||
267 | - | ||
268 | static void tpm_passthrough_cancel_cmd(TPMBackend *tb) | ||
269 | { | ||
270 | TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb); | ||
271 | @@ -483,8 +443,6 @@ static void tpm_passthrough_destroy(TPMBackend *tb) | ||
272 | |||
273 | tpm_passthrough_cancel_cmd(tb); | ||
274 | |||
275 | - tpm_backend_thread_end(&tpm_pt->tbt); | ||
276 | - | ||
277 | qemu_close(tpm_pt->tpm_fd); | ||
278 | qemu_close(tpm_pt->cancel_fd); | ||
279 | |||
280 | @@ -520,7 +478,6 @@ static const TPMDriverOps tpm_passthrough_driver = { | ||
281 | .realloc_buffer = tpm_passthrough_realloc_buffer, | ||
282 | .reset = tpm_passthrough_reset, | ||
283 | .had_startup_error = tpm_passthrough_get_startup_error, | ||
284 | - .deliver_request = tpm_passthrough_deliver_request, | ||
285 | .cancel_cmd = tpm_passthrough_cancel_cmd, | ||
286 | .get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag, | ||
287 | .reset_tpm_established_flag = tpm_passthrough_reset_tpm_established_flag, | ||
288 | @@ -540,6 +497,7 @@ static void tpm_passthrough_class_init(ObjectClass *klass, void *data) | ||
289 | TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass); | ||
290 | |||
291 | tbc->ops = &tpm_passthrough_driver; | ||
292 | + tbc->handle_request = tpm_passthrough_handle_request; | ||
293 | } | ||
294 | |||
295 | static const TypeInfo tpm_passthrough_info = { | ||
296 | diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h | ||
297 | index 3708413035..58308b3687 100644 | ||
298 | --- a/include/sysemu/tpm_backend.h | ||
299 | +++ b/include/sysemu/tpm_backend.h | ||
300 | @@ -29,22 +29,24 @@ | ||
301 | |||
302 | typedef struct TPMBackendClass TPMBackendClass; | ||
303 | typedef struct TPMBackend TPMBackend; | ||
304 | - | ||
305 | typedef struct TPMDriverOps TPMDriverOps; | ||
306 | +typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done); | ||
307 | |||
308 | -struct TPMBackendClass { | ||
309 | - ObjectClass parent_class; | ||
310 | - | ||
311 | - const TPMDriverOps *ops; | ||
312 | - | ||
313 | - void (*opened)(TPMBackend *s, Error **errp); | ||
314 | -}; | ||
315 | +typedef enum TPMBackendCmd { | ||
316 | + TPM_BACKEND_CMD_INIT = 1, | ||
317 | + TPM_BACKEND_CMD_PROCESS_CMD, | ||
318 | + TPM_BACKEND_CMD_END, | ||
319 | + TPM_BACKEND_CMD_TPM_RESET, | ||
320 | +} TPMBackendCmd; | ||
321 | |||
322 | struct TPMBackend { | ||
323 | Object parent; | ||
324 | |||
325 | /*< protected >*/ | ||
326 | bool opened; | ||
327 | + TPMState *tpm_state; | ||
328 | + GThreadPool *thread_pool; | ||
329 | + TPMRecvDataCB *recv_data_callback; | ||
330 | |||
331 | char *id; | ||
332 | enum TpmModel fe_model; | ||
333 | @@ -54,7 +56,15 @@ struct TPMBackend { | ||
334 | QLIST_ENTRY(TPMBackend) list; | ||
335 | }; | ||
336 | |||
337 | -typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done); | ||
338 | +struct TPMBackendClass { | ||
339 | + ObjectClass parent_class; | ||
340 | + | ||
341 | + const TPMDriverOps *ops; | ||
342 | + | ||
343 | + void (*opened)(TPMBackend *s, Error **errp); | ||
344 | + | ||
345 | + void (*handle_request)(TPMBackend *s, TPMBackendCmd cmd); | ||
346 | +}; | ||
347 | |||
348 | typedef struct TPMSizedBuffer { | ||
349 | uint32_t size; | ||
350 | @@ -71,7 +81,7 @@ struct TPMDriverOps { | ||
351 | void (*destroy)(TPMBackend *t); | ||
352 | |||
353 | /* initialize the backend */ | ||
354 | - int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb); | ||
355 | + int (*init)(TPMBackend *t); | ||
356 | /* start up the TPM on the backend */ | ||
357 | int (*startup_tpm)(TPMBackend *t); | ||
358 | /* returns true if nothing will ever answer TPM requests */ | ||
359 | @@ -79,8 +89,6 @@ struct TPMDriverOps { | ||
360 | |||
361 | size_t (*realloc_buffer)(TPMSizedBuffer *sb); | ||
362 | |||
363 | - void (*deliver_request)(TPMBackend *t); | ||
364 | - | ||
365 | void (*reset)(TPMBackend *t); | ||
366 | |||
367 | void (*cancel_cmd)(TPMBackend *t); | ||
368 | diff --git a/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h | ||
369 | deleted file mode 100644 | ||
370 | index 00639dd7de..0000000000 | ||
371 | --- a/include/sysemu/tpm_backend_int.h | ||
372 | +++ /dev/null | ||
373 | @@ -1,41 +0,0 @@ | ||
374 | -/* | ||
375 | - * common TPM backend driver functions | ||
376 | - * | ||
377 | - * Copyright (c) 2012-2013 IBM Corporation | ||
378 | - * Authors: | ||
379 | - * Stefan Berger <stefanb@us.ibm.com> | ||
380 | - * | ||
381 | - * This library is free software; you can redistribute it and/or | ||
382 | - * modify it under the terms of the GNU Lesser General Public | ||
383 | - * License as published by the Free Software Foundation; either | ||
384 | - * version 2 of the License, or (at your option) any later version. | ||
385 | - * | ||
386 | - * This library is distributed in the hope that it will be useful, | ||
387 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
388 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
389 | - * Lesser General Public License for more details. | ||
390 | - * | ||
391 | - * You should have received a copy of the GNU Lesser General Public | ||
392 | - * License along with this library; if not, see <http://www.gnu.org/licenses/> | ||
393 | - */ | ||
394 | - | ||
395 | -#ifndef TPM_BACKEND_INT_H | ||
396 | -#define TPM_BACKEND_INT_H | ||
397 | - | ||
398 | -typedef struct TPMBackendThread { | ||
399 | - GThreadPool *pool; | ||
400 | -} TPMBackendThread; | ||
401 | - | ||
402 | -void tpm_backend_thread_deliver_request(TPMBackendThread *tbt); | ||
403 | -void tpm_backend_thread_create(TPMBackendThread *tbt, | ||
404 | - GFunc func, gpointer user_data); | ||
405 | -void tpm_backend_thread_end(TPMBackendThread *tbt); | ||
406 | - | ||
407 | -typedef enum TPMBackendCmd { | ||
408 | - TPM_BACKEND_CMD_INIT = 1, | ||
409 | - TPM_BACKEND_CMD_PROCESS_CMD, | ||
410 | - TPM_BACKEND_CMD_END, | ||
411 | - TPM_BACKEND_CMD_TPM_RESET, | ||
412 | -} TPMBackendCmd; | ||
413 | - | ||
414 | -#endif /* TPM_BACKEND_INT_H */ | ||
415 | -- | ||
416 | 2.11.0 | ||
417 | |||