qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-ppc@nongnu.org
Cc: marcandre.lureau@redhat.com,
	Stefan Berger <stefanb@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, david@gibson.dropbear.id.au
Subject: [PACTH v3 2/5] tpm: Return bool from tpm_backend_finish_sync
Date: Wed, 11 Dec 2019 11:20:47 -0500	[thread overview]
Message-ID: <20191211162050.970199-3-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20191211162050.970199-1-stefanb@linux.vnet.ibm.com>

Return true in case we had to wait for an outstanding response
to come back, false otherwise.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 backends/tpm.c               | 6 +++++-
 include/sysemu/tpm_backend.h | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/backends/tpm.c b/backends/tpm.c
index 375587e743..1f75883d8a 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -49,11 +49,15 @@ static int tpm_backend_worker_thread(gpointer data)
     return 0;
 }
 
-void tpm_backend_finish_sync(TPMBackend *s)
+bool tpm_backend_finish_sync(TPMBackend *s)
 {
+    bool ret = s->cmd != NULL;
+
     while (s->cmd) {
         aio_poll(qemu_get_aio_context(), true);
     }
+
+    return ret;
 }
 
 enum TpmType tpm_backend_get_type(TPMBackend *s)
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 9e7451fb52..c35fe85c62 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -200,8 +200,10 @@ size_t tpm_backend_get_buffer_size(TPMBackend *s);
  *
  * Finish the pending command synchronously (this will call aio_poll()
  * on qemu main AIOContext until it ends)
+ *
+ * Returns true in case there was a pending command, false otherwise.
  */
-void tpm_backend_finish_sync(TPMBackend *s);
+bool tpm_backend_finish_sync(TPMBackend *s);
 
 /**
  * tpm_backend_query_tpm:
-- 
2.21.0



  parent reply	other threads:[~2019-12-11 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 16:20 [PACTH v3 0/5] Add vTPM emulator supportfor ppc64 platform Stefan Berger
2019-12-11 16:20 ` [PACTH v3 1/5] tpm_spapr: Support TPM for ppc64 using CRQ based interface Stefan Berger
2019-12-12 11:05   ` Marc-André Lureau
2019-12-12 12:59     ` Stefan Berger
2019-12-11 16:20 ` Stefan Berger [this message]
2019-12-11 16:20 ` [PACTH v3 3/5] tpm_spapr: Support suspend and resume Stefan Berger
2019-12-12 11:00   ` Marc-André Lureau
2019-12-12 13:22     ` Stefan Berger
2019-12-12 17:12       ` Stefan Berger
2019-12-11 16:20 ` [PACTH v3 4/5] hw/ppc/Kconfig: Enable TPMDEV as part of PSERIES config Stefan Berger
2019-12-11 16:20 ` [PACTH v3 5/5] docs: tpm: Add example command line for ppc64 and tpm-spapr Stefan Berger
2019-12-12 11:11   ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191211162050.970199-3-stefanb@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).