From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: Quan Xu <quan.xu@intel.com>,
stefano.stabellini@eu.citrix.com, eblake@redhat.com
Cc: dgdegra@tycho.nsa.gov, wei.liu2@citrix.com,
qemu-devel@nongnu.org, xen-devel@lists.xen.org
Subject: Re: [Qemu-devel] [PATCH v6 4/6] Qemu-Xen-vTPM: Move tpm_passthrough_is_selftest() into tpm_util.c
Date: Mon, 04 May 2015 11:25:52 -0400 [thread overview]
Message-ID: <55478F80.4020604@linux.vnet.ibm.com> (raw)
In-Reply-To: <1430724181-476-5-git-send-email-quan.xu@intel.com>
On 05/04/2015 03:22 AM, Quan Xu wrote:
> and rename it to tpm_util_is_selftest().
>
> Signed-off-by: Quan Xu <quan.xu@intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Thanks,
Stefan
>
> --Changes in v6:
> -Remove the redundant copy right.
> -Reduce the includes to its minimum.
> ---
> hw/tpm/Makefile.objs | 2 +-
> hw/tpm/tpm_passthrough.c | 13 +------------
> hw/tpm/tpm_util.c | 39 +++++++++++++++++++++++++++++++++++++++
> include/sysemu/tpm_backend_int.h | 1 +
> 4 files changed, 42 insertions(+), 13 deletions(-)
> create mode 100644 hw/tpm/tpm_util.c
>
> diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs
> index 57919fa..e8fca65 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
> common-obj-$(CONFIG_TPM_XENSTUBDOMS) += xen_vtpm_frontend.o
> diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
> index 2a45071..ff08e15 100644
> --- a/hw/tpm/tpm_passthrough.c
> +++ b/hw/tpm/tpm_passthrough.c
> @@ -112,17 +112,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,
> @@ -136,7 +125,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
> new file mode 100644
> index 0000000..73be8c5
> --- /dev/null
> +++ b/hw/tpm/tpm_util.c
> @@ -0,0 +1,39 @@
> +/*
> + * TPM util functions
> + *
> + * * Copyright (c) 2015 Intel Corporation
> + * Authors:
> + * Quan Xu <quan.xu@intel.com>
> + *
> + * Copyright (c) 2010 - 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/>
> + */
> +
> +#include "sysemu/tpm_backend.h"
> +#include "tpm_int.h"
> +#include "sysemu/tpm_backend_int.h"
> +
> +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/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h
> index 05d94d0..e18acab 100644
> --- a/include/sysemu/tpm_backend_int.h
> +++ b/include/sysemu/tpm_backend_int.h
> @@ -34,6 +34,7 @@ void tpm_backend_thread_create(TPMBackendThread *tbt,
> void tpm_backend_thread_end(TPMBackendThread *tbt);
> void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt,
> GFunc func, gpointer user_data);
> +bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len);
>
> typedef enum TPMBackendCmd {
> TPM_BACKEND_CMD_INIT = 1,
next prev parent reply other threads:[~2015-05-04 15:26 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 7:22 [Qemu-devel] [PATCH v6 0/6] QEMU:Xen stubdom vTPM for HVM virtual machine(QEMU Part) Quan Xu
2015-05-04 7:22 ` [Qemu-devel] [PATCH v6 1/6] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
2015-05-05 14:28 ` Eric Blake
2015-05-05 14:28 ` [Qemu-devel] " Eric Blake
2015-05-06 2:02 ` Xu, Quan
2015-05-06 2:02 ` Xu, Quan
2015-05-04 7:22 ` Quan Xu
2015-05-04 7:22 ` [Qemu-devel] [PATCH v6 2/6] Qemu-Xen-vTPM: Xen frontend driver infrastructure Quan Xu
2015-05-04 7:22 ` Quan Xu
2015-05-07 17:25 ` [Qemu-devel] " Stefano Stabellini
2015-05-12 1:28 ` [Qemu-devel] [Xen-devel] " Xu, Quan
2015-05-12 14:12 ` Stefano Stabellini
2015-05-12 14:12 ` Stefano Stabellini
2015-05-12 1:28 ` Xu, Quan
2015-05-07 17:25 ` Stefano Stabellini
2015-05-08 9:52 ` [Qemu-devel] " Stefano Stabellini
2015-05-08 9:52 ` Stefano Stabellini
2015-05-04 7:22 ` [Qemu-devel] [PATCH v6 3/6] " Quan Xu
2015-05-04 7:22 ` Quan Xu
2015-05-04 12:57 ` Xu, Quan
2015-05-04 12:57 ` [Qemu-devel] " Xu, Quan
2015-05-04 15:36 ` Stefan Berger
2015-05-05 2:41 ` Xu, Quan
2015-05-05 10:23 ` Stefan Berger
2015-05-05 2:41 ` Xu, Quan
2015-05-11 12:56 ` [Qemu-devel] " Xu, Quan
2015-05-11 12:56 ` Xu, Quan
2015-05-11 14:49 ` Stefan Berger
2015-05-11 14:49 ` [Qemu-devel] " Stefan Berger
2015-05-11 14:51 ` Xu, Quan
2015-05-11 14:51 ` Xu, Quan
2015-05-04 15:36 ` Stefan Berger
2015-05-08 9:52 ` [Qemu-devel] " Stefano Stabellini
2015-05-08 9:52 ` Stefano Stabellini
2015-05-04 7:22 ` [PATCH v6 4/6] Qemu-Xen-vTPM: Move tpm_passthrough_is_selftest() into tpm_util.c Quan Xu
2015-05-04 7:22 ` [Qemu-devel] " Quan Xu
2015-05-04 15:25 ` Stefan Berger [this message]
2015-05-05 2:33 ` Xu, Quan
2015-05-05 2:33 ` Xu, Quan
2015-05-04 15:25 ` Stefan Berger
2015-05-04 7:23 ` [PATCH v6 5/6] Qemu-Xen-vTPM: Qemu vTPM xenstubdoms backen Quan Xu
2015-05-04 7:23 ` [Qemu-devel] " Quan Xu
2015-05-04 15:30 ` Stefan Berger
2015-05-04 15:30 ` [Qemu-devel] " Stefan Berger
2015-05-05 2:34 ` Xu, Quan
2015-05-05 2:34 ` Xu, Quan
2015-05-04 7:23 ` [Qemu-devel] [PATCH v6 6/6] Qemu-Xen-vTPM: QEMU machine class is initialized before tpm_init() Quan Xu
2015-05-04 7:23 ` Quan Xu
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=55478F80.4020604@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quan.xu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.