xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Emil Condrea <emilcondrea@gmail.com>
To: qemu-devel@nongnu.org
Cc: wei.liu2@citrix.com, stefanb@linux.vnet.ibm.com,
	stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org,
	quan.xu@intel.com, dgdegra@tycho.nsa.gov, eblake@redhat.com,
	emilcondrea@gmail.com
Subject: [PATCH 17/19] Qemu-Xen-vTPM: Move tpm_passthrough_is_selftest() into tpm_util.c
Date: Sun, 10 Jul 2016 14:47:48 +0300	[thread overview]
Message-ID: <1468151270-12984-18-git-send-email-emilcondrea@gmail.com> (raw)
In-Reply-To: <1468151270-12984-1-git-send-email-emilcondrea@gmail.com>

Also rename it to tpm_util_is_selftest().

Signed-off-by: Quan Xu <quan.xu@intel.com>
Signed-off-by: Emil Condrea <emilcondrea@gmail.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 hw/tpm/Makefile.objs     |  2 +-
 hw/tpm/tpm_passthrough.c | 13 +------------
 hw/tpm/tpm_util.c        | 11 +++++++++++
 hw/tpm/tpm_util.h        |  1 +
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs
index b0a821c..16b1447 100644
--- a/hw/tpm/Makefile.objs
+++ b/hw/tpm/Makefile.objs
@@ -1,3 +1,3 @@
-common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o
+common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o tpm_util.o
 common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o tpm_util.o
 common-obj-$(CONFIG_TPM_XENSTUBDOMS) += xen_vtpm_frontend.o
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index e88c0d2..dba408b 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -137,17 +137,6 @@ static void tpm_write_fatal_error_response(uint8_t *out, uint32_t out_len)
     }
 }
 
-static bool tpm_passthrough_is_selftest(const uint8_t *in, uint32_t in_len)
-{
-    struct tpm_req_hdr *hdr = (struct tpm_req_hdr *)in;
-
-    if (in_len >= sizeof(*hdr)) {
-        return (be32_to_cpu(hdr->ordinal) == TPM_ORD_ContinueSelfTest);
-    }
-
-    return false;
-}
-
 static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt,
                                         const uint8_t *in, uint32_t in_len,
                                         uint8_t *out, uint32_t out_len,
@@ -161,7 +150,7 @@ static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt,
     tpm_pt->tpm_executing = true;
     *selftest_done = false;
 
-    is_selftest = tpm_passthrough_is_selftest(in, in_len);
+    is_selftest = tpm_util_is_selftest(in, in_len);
 
     ret = tpm_passthrough_unix_write(tpm_pt->tpm_fd, in, in_len);
     if (ret != in_len) {
diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
index 7b35429..323f4ae 100644
--- a/hw/tpm/tpm_util.c
+++ b/hw/tpm/tpm_util.c
@@ -125,3 +125,14 @@ int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version)
 
     return 1;
 }
+
+bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len)
+{
+    struct tpm_req_hdr *hdr = (struct tpm_req_hdr *)in;
+
+    if (in_len >= sizeof(*hdr)) {
+        return (be32_to_cpu(hdr->ordinal) == TPM_ORD_ContinueSelfTest);
+    }
+
+    return false;
+}
diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h
index e7f354a..b629663 100644
--- a/hw/tpm/tpm_util.h
+++ b/hw/tpm/tpm_util.h
@@ -24,5 +24,6 @@
 #include "sysemu/tpm_backend.h"
 
 int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version);
+bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len);
 
 #endif /* TPM_TPM_UTILS_H */
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-10 11:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1468151270-12984-1-git-send-email-emilcondrea@gmail.com>
2016-07-10 11:47 ` [PATCH 01/19] xen: Create a new file xen_pvdev.c Emil Condrea
2016-07-10 11:47 ` [PATCH 02/19] xen: Create a new file xen_frontend.c Emil Condrea
2016-07-25 13:45   ` Anthony PERARD
2016-07-10 11:47 ` [PATCH 03/19] xen: Move xenstore_update to xen_pvdev.c Emil Condrea
2016-07-10 11:47 ` [PATCH 04/19] xen: Move evtchn functions " Emil Condrea
2016-07-25 13:53   ` Anthony PERARD
     [not found]   ` <20160725135311.GI1835@perard.uk.xensource.com>
2016-07-27 23:16     ` Eric Blake
2016-07-31  9:47     ` Emil Condrea
2016-07-10 11:47 ` [PATCH 05/19] xen: Prepare xendev qtail to be shared with frontends Emil Condrea
2016-07-10 11:47 ` [PATCH 06/19] xen: Rename xen_be_printf to xen_pv_printf Emil Condrea
2016-07-10 11:47 ` [PATCH 07/19] xen: Rename xen_be_unbind_evtchn Emil Condrea
2016-07-25 13:56   ` Anthony PERARD
2016-07-10 11:47 ` [PATCH 08/19] xen: Rename xen_be_send_notify Emil Condrea
2016-07-25 13:58   ` Anthony PERARD
2016-07-10 11:47 ` [PATCH 09/19] xen: Rename xen_be_evtchn_event Emil Condrea
2016-07-10 11:47 ` [PATCH 10/19] xen: Rename xen_be_find_xendev Emil Condrea
2016-07-10 11:47 ` [PATCH 11/19] xen: Rename xen_be_del_xendev Emil Condrea
2016-07-10 11:47 ` [PATCH 12/19] xen: Rename xen_be_frontend_changed Emil Condrea
2016-07-10 11:47 ` [PATCH 13/19] xen: Distinguish between frontend and backend devops Emil Condrea
2016-07-10 11:47 ` [PATCH 14/19] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Emil Condrea
2016-07-10 11:47 ` [PATCH 15/19] Qemu-Xen-vTPM: Xen frontend driver infrastructure Emil Condrea
2016-07-25 16:01   ` Anthony PERARD
2016-08-07 11:39     ` Emil Condrea
     [not found]     ` <CAAULxKKk-UiLFPWn8GH4oDEqQEAowBSgdUHCPGvfX_Ubr_rztg@mail.gmail.com>
2016-08-09 11:40       ` Xuquan (Euler)
2016-07-10 11:47 ` [PATCH 16/19] Qemu-Xen-vTPM: Register Xen stubdom vTPM frontend driver Emil Condrea
2016-07-10 11:47 ` Emil Condrea [this message]
2016-07-10 11:47 ` [PATCH 18/19] Qemu-Xen-vTPM: Qemu vTPM xenstubdoms backend Emil Condrea
2016-07-10 11:47 ` [PATCH 19/19] Qemu-Xen-vTPM: QEMU machine class is initialized before tpm_init() Emil Condrea
2016-07-13  2:55 ` [v9 00/19] QEMU:Xen stubdom vTPM for HVM virtual machine(QEMU Part) Xu, Quan
     [not found] ` <945CA011AD5F084CBEA3E851C0AB28894B8FD7C8@SHSMSX101.ccr.corp.intel.com>
2016-07-14 15:33   ` Stefano Stabellini
2016-07-17  6:56   ` Quan Xu
     [not found] ` <1468151270-12984-2-git-send-email-emilcondrea@gmail.com>
2016-07-25 13:41   ` [Qemu-devel] [PATCH 01/19] xen: Create a new file xen_pvdev.c Anthony PERARD
2016-07-25 14:09 ` [Qemu-devel] [v9 00/19] QEMU:Xen stubdom vTPM for HVM virtual machine(QEMU Part) Anthony PERARD
     [not found] ` <20160725140941.GL1835@perard.uk.xensource.com>
2016-07-31  9:57   ` Emil Condrea
2016-10-04  6:52   ` Emil Condrea

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=1468151270-12984-18-git-send-email-emilcondrea@gmail.com \
    --to=emilcondrea@gmail.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quan.xu@intel.com \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).