From: Amarnath Valluri <amarnath.valluri@intel.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v6 8/8] tpm: Added support for TPM emulator
Date: Wed, 26 Jul 2017 06:49:21 +0300 [thread overview]
Message-ID: <1501040961.8796.11.camel@intel.com> (raw)
In-Reply-To: <5a3a8c55-6306-9055-2aa1-6d1cb1242e93@linux.vnet.ibm.com>
On Tue, 2017-07-25 at 20:18 -0400, Stefan Berger wrote:
> On 07/18/2017 04:49 AM, Amarnath Valluri wrote:
> > diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs
> > index 64cecc3..41f0b7a 100644
> > --- a/hw/tpm/Makefile.objs
> > +++ b/hw/tpm/Makefile.objs
> > @@ -1,2 +1,3 @@
> > common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o
> > common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o tpm_util.o
> > +common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o tpm_util.o
> > diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
> > new file mode 100644
> > index 0000000..c90914c
> > --- /dev/null
> > +++ b/hw/tpm/tpm_emulator.c
> > @@ -0,0 +1,973 @@
> > +/*
> > + * emulator TPM driver
> > + *
> > + * Copyright (c) 2017 Intel Corporation
> > + * Author: Amarnath Valluri <amarnath.valluri@intel.com>
> > + *
> > + * Copyright (c) 2010 - 2013 IBM Corporation
> > + * Authors:
> > + * Stefan Berger <stefanb@us.ibm.com>
> > + *
> > + * Copyright (C) 2011 IAIK, Graz University of Technology
> > + * Author: Andreas Niederl
> > + *
> > + * 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 "qemu/osdep.h"
> > +#include "qemu/error-report.h"
> > +#include "qemu/sockets.h"
> > +#include "io/channel-socket.h"
> > +#include "sysemu/tpm_backend.h"
> > +#include "tpm_int.h"
> > +#include "hw/hw.h"
> > +#include "hw/i386/pc.h"
> > +#include "tpm_util.h"
> > +#include "tpm_ioctl.h"
> > +#include "migration/migration.h"
> > +#include "qapi/error.h"
> > +
> > +#include <fcntl.h>
> > +#include <sys/types.h>
> > +#include <sys/stat.h>
> > +#include <stdio.h>
> > +
> > +#define DEBUG_TPM 0
> > +
> > +#define DPRINT(fmt, ...) do { \
> > + if (DEBUG_TPM) { \
> > + fprintf(stderr, fmt, ## __VA_ARGS__); \
> > + } \
> > +} while (0);
> > +
> > +#define DPRINTF(fmt, ...) DPRINT("tpm-emulator: "fmt"\n", __VA_ARGS__)
> > +
> > +#define TYPE_TPM_EMULATOR "tpm-emulator"
> > +#define TPM_EMULATOR(obj) \
> > + OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR)
> > +
> > +static const TPMDriverOps tpm_emulator_driver;
> > +
> > +/* data structures */
> > +typedef struct TPMEmulator {
> > + TPMBackend parent;
> > +
> > + TPMEmulatorOptions *ops;
> > + QIOChannel *data_ioc;
> > + QIOChannel *ctrl_ioc;
> > + bool op_executing;
> > + bool op_canceled;
> > + bool child_running;
> > + TPMVersion tpm_version;
> > + ptm_cap caps; /* capabilities of the TPM */
> > + uint8_t cur_locty_number; /* last set locality */
> > + QemuMutex state_lock;
> > + Error *migration_blocker;
> > +} TPMEmulator;
> > +
> > +#define TPM_DEFAULT_EMULATOR "swtpm"
> > +#define TPM_DEFAULT_LOGLEVEL 5
> > +#define TPM_EMULATOR_PIDFILE "/tmp/qemu-tpm.pid"
>
> swtpm will write this file and remove it when it terminates. You may run
> into concurrency problems as well. I would extend this name with the pid
> of the QEMU process starting swtpm.
Stefan, there was some issue in my reabasing and sent wrong version of
patchset, but i made all the changes you suggested including the pid
file.
But i did not sent the next version as Marc-André Lureau objected the
the idea of spawning swtpm from Qemu. I started exploring his suggestion
of 'chardev'.
I feel like we are back to square one :).
- Amarnath
next prev parent reply other threads:[~2017-07-26 3:46 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 8:48 [Qemu-devel] [PATCH v6 0/8] Provide support for the software TPM emulator Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 1/8] tpm-backend: Remove unneeded member variable from backend class Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 2/8] tpm-backend: Move thread handling inside TPMBackend Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 3/8] tpm-backend: Initialize and free data members in it's own methods Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 4/8] tpm-backend: Made few interface methods optional Amarnath Valluri
2017-07-18 10:15 ` Marc-André Lureau
2017-07-22 4:32 ` Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 5/8] tmp backend: Add new api to read backend TpmInfo Amarnath Valluri
2017-07-18 10:39 ` Marc-André Lureau
2017-07-18 14:28 ` Eric Blake
2017-07-22 4:30 ` Amarnath Valluri
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 6/8] tpm-backend: Move realloc_buffer() implementation to tpm-tis model Amarnath Valluri
2017-07-18 10:50 ` Marc-André Lureau
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 7/8] tpm-passthrough: move reusable code to utils Amarnath Valluri
2017-07-18 11:17 ` Marc-André Lureau
2017-07-18 8:49 ` [Qemu-devel] [PATCH v6 8/8] tpm: Added support for TPM emulator Amarnath Valluri
2017-07-18 12:08 ` Marc-André Lureau
2017-07-18 13:40 ` Stefan Berger
2017-07-22 4:52 ` Amarnath Valluri
2017-07-18 14:39 ` Stefan Berger
2017-07-20 14:42 ` Valluri, Amarnath
2017-07-18 15:05 ` Stefan Berger
2017-07-26 0:18 ` Stefan Berger
2017-07-26 3:49 ` Amarnath Valluri [this message]
2017-07-26 14:54 ` Dr. David Alan Gilbert
2017-07-18 8:59 ` [Qemu-devel] [PATCH v6 0/8] Provide support for the software " no-reply
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=1501040961.8796.11.camel@intel.com \
--to=amarnath.valluri@intel.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
/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.