qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <jejb@linux.ibm.com>
To: Stefan Berger <stefanb@linux.ibm.com>, qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH 2/2] tpm: add backend for mssim
Date: Thu, 15 Dec 2022 14:40:07 -0500	[thread overview]
Message-ID: <77bc5a11fcb7b06deba1c54b1ef2de28e0c53fb1.camel@linux.ibm.com> (raw)
In-Reply-To: <e77a3a76-c874-d279-52bf-18a4e3a36ba2@linux.ibm.com>

On Thu, 2022-12-15 at 14:35 -0500, Stefan Berger wrote:
> 
> 
> On 12/15/22 14:22, James Bottomley wrote:
> > On Thu, 2022-12-15 at 13:46 -0500, Stefan Berger wrote:
> > > 
> > > 
> > > On 12/15/22 13:01, James Bottomley wrote:
> > > > From: James Bottomley <James.Bottomley@HansenPartnership.com>
> > > > 
> > > > The Microsoft Simulator (mssim) is the reference emulation
> > > > platform
> > > > for the TCG TPM 2.0 specification.
> > > > 
> > > > https://github.com/Microsoft/ms-tpm-20-ref.git
> > > > 
> > > > It exports a fairly simple network socket baset protocol on two
> > > > sockets, one for command (default 2321) and one for control
> > > > (default
> > > > 2322).  This patch adds a simple backend that can speak the
> > > > mssim
> > > > protocol over the network.  It also allows the host, and two
> > > > ports
> > > > to
> > > > be specified on the qemu command line.  The benefits are
> > > > twofold:
> > > > firstly it gives us a backend that actually speaks a standard
> > > > TPM
> > > > emulation protocol instead of the linux specific TPM driver
> > > > format
> > > > of
> > > > the current emulated TPM backend and secondly, using the
> > > > microsoft
> > > > protocol, the end point of the emulator can be anywhere on the
> > > > network, facilitating the cloud use case where a central TPM
> > > > service
> > > > can be used over a control network.
> > > > 
> > > > The implementation does basic control commands like power
> > > > off/on,
> > > > but
> > > > doesn't implement cancellation or startup.  The former because
> > > > cancellation is pretty much useless on a fast operating TPM
> > > > emulator
> > > > and the latter because this emulator is designed to be used
> > > > with
> > > > OVMF
> > > > which itself does TPM startup and I wanted to validate that.
> > > > 
> > > > To run this, simply download an emulator based on the MS
> > > > specification
> > > > (package ibmswtpm2 on openSUSE) and run it, then add these two
> > > > lines
> > > > to the qemu command and it will use the emulator.
> > > > 
> > > >       -tpmdev mssim,id=tpm0 \
> > > >       -device tpm-crb,tpmdev=tpm0 \
> > > > 
> > > > to use a remote emulator replace the first line with
> > > > 
> > > >       -tpmdev
> > > > "{'type':'mssim','id':'tpm0','command':{'type':inet,'host':'rem
> > > > ote'
> > > > ,'port':'2321'}}"
> > > > 
> > > > tpm-tis also works as the backend.
> > > 
> > > Since this device does not properly support migration you have to
> > > register a migration blocker.
> > 
> > Actually it seems to support migration just fine.  Currently the
> > PCR's
> > get zero'd which is my fault for doing a TPM power off/on, but
> > switching that based on state should be an easy fix.
> 
> How do you handle virsh save  -> host reboot -> virsh restore?

I didn't.  I just pulled out the TPM power state changes and followed
the guide here using the migrate "exec:gzip -c > STATEFILE.gz" recipe:

https://www.linux-kvm.org/page/Migration

and verified the TPM pcrs and the null name were unchanged.

> You should also add a description to docs/specs/tpm.rst.

Description of what?  It functions exactly like passthrough on
migration.  Since the TPM state is retained in the server a
reconnection just brings everything back to where it was.

James



  reply	other threads:[~2022-12-15 19:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 18:01 [PATCH 0/2] tpm: add mssim backend James Bottomley
2022-12-15 18:01 ` [PATCH 1/2] tpm: convert tpmdev options processing to new visitor format James Bottomley
2022-12-15 18:01 ` [PATCH 2/2] tpm: add backend for mssim James Bottomley
2022-12-15 18:46   ` Stefan Berger
2022-12-15 19:22     ` James Bottomley
2022-12-15 19:35       ` Stefan Berger
2022-12-15 19:40         ` James Bottomley [this message]
2022-12-15 19:57           ` Stefan Berger
2022-12-15 20:07             ` James Bottomley
2022-12-15 20:22               ` Stefan Berger
2022-12-15 20:30                 ` James Bottomley
2022-12-15 20:53                   ` Stefan Berger
2022-12-16 10:27                     ` Daniel P. Berrangé
2022-12-16 12:28                       ` Stefan Berger
2022-12-16 12:54                         ` Daniel P. Berrangé
2022-12-16 13:32                           ` Stefan Berger
2022-12-16 13:53                             ` James Bottomley
2022-12-16 14:01                               ` Stefan Berger
2022-12-19 11:49                               ` Stefan Berger
2022-12-19 13:02                                 ` James Bottomley
2022-12-19 14:01                                   ` Stefan Berger
2022-12-16 14:29                             ` Daniel P. Berrangé
2022-12-16 14:55                               ` Stefan Berger
2022-12-16 15:48                                 ` James Bottomley
2022-12-16 16:08                                   ` Stefan Berger
2022-12-16 16:13                                     ` James Bottomley
2022-12-16 16:21                                       ` Stefan Berger
2023-01-09 16:59                               ` Dr. David Alan Gilbert
2023-01-09 17:43                                 ` James Bottomley
2023-01-09 17:52                                   ` Dr. David Alan Gilbert
2023-01-09 17:55                                     ` James Bottomley
2023-01-09 18:34                                       ` Stefan Berger
2023-01-09 18:51                                         ` James Bottomley
2023-01-09 18:54                                           ` Dr. David Alan Gilbert
2023-01-09 18:59                                             ` James Bottomley
2023-01-09 19:01                                           ` Stefan Berger
2023-01-09 21:06                                             ` Stefan Berger
2023-01-10 14:14                                               ` James Bottomley
2023-01-10 14:47                                                 ` Stefan Berger
2023-01-10 14:55                                                   ` James Bottomley
2023-01-10 15:00                                                     ` Stefan Berger

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=77bc5a11fcb7b06deba1c54b1ef2de28e0c53fb1.camel@linux.ibm.com \
    --to=jejb@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.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 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).