mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
tpm: replace GThreadPool with AIO threadpool
The TPM backend uses a GThreadPool to handle IO in a seperate thread. However, GThreadPool isn't integrated with Qemu main loops, making it unnecessarily complicated to deal with. Qemu has a AIO threadpool, that is better integrated with loops and various IO functions, provides completion BH by default etc. Remove the only user of GThreadPool from qemu, use AIO threadpool. Note that the backend: - no longer accepts queing multiple requests (unneeded so far) - increase ref to itself when handling a command, for extra safety - tpm_backend_thread_end() is renamed tpm_backend_finish_sync() and will wait for completion of BH (request_completed), which will help migration handling. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
05b71fb207
commit
c4fb8561bc
2 changed files with 37 additions and 27 deletions
|
@ -45,9 +45,8 @@ struct TPMBackend {
|
|||
/*< protected >*/
|
||||
TPMIf *tpmif;
|
||||
bool opened;
|
||||
GThreadPool *thread_pool;
|
||||
bool had_startup_error;
|
||||
QEMUBH *bh;
|
||||
TPMBackendCmd *cmd;
|
||||
|
||||
/* <public> */
|
||||
char *id;
|
||||
|
@ -196,6 +195,15 @@ TPMVersion tpm_backend_get_tpm_version(TPMBackend *s);
|
|||
*/
|
||||
size_t tpm_backend_get_buffer_size(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_finish_sync:
|
||||
* @s: the backend to call into
|
||||
*
|
||||
* Finish the pending command synchronously (this will call aio_poll()
|
||||
* on qemu main AIOContext until it ends)
|
||||
*/
|
||||
void tpm_backend_finish_sync(TPMBackend *s);
|
||||
|
||||
/**
|
||||
* tpm_backend_query_tpm:
|
||||
* @s: the backend
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue