All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: jejb@linux.ibm.com, "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH 2/2] tpm: add backend for mssim
Date: Fri, 16 Dec 2022 09:01:24 -0500	[thread overview]
Message-ID: <60d8abdc-50db-53dd-4321-cdc765d15a1a@linux.ibm.com> (raw)
In-Reply-To: <158a33b6850db9ef18b240834e06665d7f9e4825.camel@linux.ibm.com>



On 12/16/22 08:53, James Bottomley wrote:
> On Fri, 2022-12-16 at 08:32 -0500, Stefan Berger wrote:
>> On 12/16/22 07:54, Daniel P. Berrangé wrote:
>>> On Fri, Dec 16, 2022 at 07:28:59AM -0500, Stefan Berger wrote:
> [...]
>>>> Nevertheless it needs documentation and has to handle migration
>>>> scenarios either via a blocker or it has to handle them all
>>>> correctly. Since it's supposed to be a TPM running remote you
>>>> had asked for TLS support iirc.
>>>
>>> If the mssim implmentation doesn't provide TLS itself, then I don't
>>> consider that a blocker on the QEMU side, merely a nice-to-have.
>>>
>>> With swtpm the control channel is being used to load and store
>>> state during the migration dance. This makes the use of an external
>>> process largely transparent to the user, since QEMU handles all the
>>> state save/load as part of its migration data stream.
>>>
>>> With mssim there is state save/load co-ordination with QEMU.
>>> Instead whomever/whatever is managing the mssim instance, is
>>> responsible for ensuring it is running with the correct state at
>>> the time QEMU does a vmstate load. If doing a live migration this
>>> co-ordination is trivial if you just use the same mssim instance
>>> for both src/dst to connect to.
>>>
>>> If doing save/store to disk, the user needs to be able to save the
>>> mssim state and load it again later. If doing snapshots and
>>> reverting to old
>>
>> There is no way for storing and loading the *volatile state* of the
>> mssim device.
> 
> Well, yes there is, it saves internal TPM state to an NVChip file:
> 
> https://github.com/microsoft/ms-tpm-20-ref/blob/main/TPMCmd/Platform/src/NVMem.c
> 
> However, if I were running this as a service, I'd condition saving and
> restoring state on a connection protocol, which would mean QEMU
> wouldn't have to worry about it.  The simplest approach, of course, is
> just to keep the service running even when the VM is suspended so the
> state is kept internally.
> 
>>> snapshots, then again whomever manages mssim needs to be keeping
>>> saved TPM state corresponding to each QEMU snapshot saved, and
>>> picking the right one when restoring to old snapshots.
>>
>> This doesn't work.
> 
> I already told you I tested this and it does work.  I'll actually add
> the migration state check to the power on/off path because I need that
> for testing S3 anyway.


Please document how this needs to be done.
> 
>> Either way, if it's possible it can be documented and shown how this
>> works.
> 
> I could do a blog post, but I really don't think you want this in
> official documentation because that creates support expectations.

We have documentation for passthrough and tpm_emulator. If you don't want to add documentation for it to QEMU then please add the driver in as 'unsupported'.

diff --git a/MAINTAINERS b/MAINTAINERS
index 1729c0901c..32fa2eb282 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3017,6 +3017,7 @@ F: include/hw/acpi/tpm.h
  F: include/sysemu/tpm*
  F: qapi/tpm.json
  F: backends/tpm/
+X: backends/tpm/tpm_mssim.*
  F: tests/qtest/*tpm*
  T: git https://github.com/stefanberger/qemu-tpm.git tpm-next

    Stefan



  reply	other threads:[~2022-12-16 14:01 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
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 [this message]
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=60d8abdc-50db-53dd-4321-cdc765d15a1a@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=qemu-devel@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 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.