qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: QEMU <qemu-devel@nongnu.org>,
	Amarnath Valluri <amarnath.valluri@intel.com>
Subject: Re: [Qemu-devel] [PATCH 00/42] TPM: code cleanup & CRB device
Date: Tue, 10 Oct 2017 14:20:37 -0400	[thread overview]
Message-ID: <431bfbbf-3c6d-972e-bcb5-f8dba675d574@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAJ+F1CLnPZhC1-GtxRAJjySDmOdeu+jc1yq=VqUizgJRFtuTTQ@mail.gmail.com>

On 10/10/2017 08:14 AM, Marc-André Lureau wrote:
> Hi Stefan
>
> On Tue, Oct 10, 2017 at 4:34 AM, Stefan Berger
> <stefanb@linux.vnet.ibm.com> wrote:
>> On 10/09/2017 06:55 PM, Marc-André Lureau wrote:
>>> Hi,
>>>
>>> I accumulated a series of patch doing some TPM code cleanup while
>>> doing review. I removed some dead code, simplified other parts, and
>>> tried to isolate implementation of the backend and frontend by using a
>>> new TPMIf interface. I solved a few issues, and added some FIXME for
>>> what should be tackled.  Finally, I implemented a simple CRB device
>>> (tpm 2.0) that is work in progress for now - it works fine with
>>> passthrough, but swtpm/libtpms with win10 has some issues that need
>>> more investigations.
>>
>> You are using the swtpm with --tpm2, right? And I suppose you are using the
>> tpm2-preview.rev146 branch of libtpms. What are the symptoms?
> Yes, I was using tpm2-preview.rev146.ossl11 branch
>
> Windows complained about malfunctioning TPM 2.0 device, despite doing
> many exchanges. Sadly, I couldn't find many option to make libtpms a
> bit more verbose, as I am not able to parse the hexdump. I haven't
> spent much time investigating yet.

libtpms's TPM 2 code doesn't have a lot of debugging output. The only 
solution for now is to crank up the log level to 20 and have it log into 
a file. It at least shows the exchange of messages.

>
>> Most of this series looks good to me. I'll go over it again and will add my
>> Reviewed-by. It seems to have some build problems, though.
> I fixed the build issue (gcc on centos is a bit old), last version is
> https://github.com/elmarco/qemu/commits/tpm.
>
>> For libtpms + swtpm the biggest challenge is supporting state migration,
>> especially with TPM2. I have that working on the swtpm level in form of test
>> cases and also with the old CUSE TPM support in QEMU + libvirt mgmt. stack
>> with CUSE support. So ideally we would get to that point as well with the
>> QEMU TPM emulator device to make sure suspend/resume, snapshotting, and
>> migration work. libtpms 0.6 should have TPM 2 code and ideally swtpm 0.1
>> would support TPM 2 as well.
> Yes! thanks a lot for working on this, this is indeed essential. How
> close are you from releasing the migration code?
>
> Depending how quickly this series is reviewed & merged, I would like
> to work on cleaning up the threading code next.

I haven't worked on the suspend/resume part. It would have to be a port 
of these 3 patches:
https://github.com/stefanberger/qemu-tpm/commit/9d8c9c3f0df288242d03f78d3b103099c1910574
https://github.com/stefanberger/qemu-tpm/commit/b9ea09d2e26eac92b4a1604a7afa695c4fc2735e
https://github.com/stefanberger/qemu-tpm/commit/27d332dc3b2c6bfd0fcd38e69f5c899651f3a5d8


    Stefan


>
>
> thanks
>
>>     Regards,
>>         Stefan
>>
>>
>>> seabios CRB support is required for TPM 2.0 & emulation
>>> (https://mail.coreboot.org/pipermail/seabios/2017-October/011839.html)
>>>
>>> Comments/review welcome!
>>>
>>> Based-on: <1507222112-20315-1-git-send-email-stefanb@linux.vnet.ibm.com>
>>>
>>> Marc-André Lureau (42):
>>>     tpm-tis: remove unused hw_access argument
>>>     tpm-tis: remove RAISE_STS_IRQ
>>>     tpm: make tpm_get_backend_driver() static
>>>     tpm: lookup tpm backend class in tpm_driver_find_by_type()
>>>     tpm: replace tpm_get_backend_driver() to drop be_drivers
>>>     tpm: remove tpm_register_driver()
>>>     tpm: move TPMSizedBuffer to tpm_tis.h
>>>     tpm: remove TPMDriverOps
>>>     tpm: remove init() class method
>>>     tpm: remove configure_tpm() hop
>>>     tpm: remove unused TPMBackendCmd
>>>     tpm: remove needless cast
>>>     tpm: remove locty argument from receive_cb
>>>     tpm: add TPMBackendCmd to hold the request state
>>>     tpm-emulator: fix error handling
>>>     tpm: remove locty_data from TPMState
>>>     tpm-tis: move TPMState to TIS header
>>>     tpm-tis: remove tpm_tis.h header
>>>     tpm-tis: fold TPMTISEmuState in TPMState
>>>     tpm: add a QOM TPM interface
>>>     tpm: move recv_data_callback to TPM interface
>>>     tpm-backend: store TPMIf interface, improve backend_init()
>>>     tpm-tis: no longer expose TPMState
>>>     tpm-be: call request_completed() out of thread
>>>     tpm-be: report error instead of front-end
>>>     tpm-be: ask model to the TPM interface
>>>     tpm: remove unused opened code
>>>     tpm-passthrough: don't save guessed cancel_path in options
>>>     tpm-be: update optional function pointers
>>>     tpm-passthrough: pass TPMPassthruState to handle_device_opts
>>>     tpm-backend: move set 'id' to common code
>>>     tpm-passthrough: make it safer to destroy after creation
>>>     tpm-passthrough: remove error cleanup from handle_device_opts
>>>     tpm-passthrough: workaround a possible race
>>>     tpm-tis: simplify header inclusion
>>>     tpm: rename qemu_find_tpm() -> qemu_find_tpm_be()
>>>     tpm: lookup the the TPM interface instead of TIS device
>>>     tpm: add TPM interface to lookup TPM version
>>>     tpm: add tpm_cmd_get_size() to tpm_util
>>>     acpi: change TPM TIS data conditions
>>>     tpm-emulator: add a FIXME comment about blocking cancel
>>>     WIP: add TPM CRB device
>>>
>>>    qapi/tpm.json                      |   7 +-
>>>    hw/tpm/tpm_int.h                   |  25 +-
>>>    hw/tpm/tpm_tis.h                   |  70 ------
>>>    hw/tpm/tpm_util.h                  |   8 +-
>>>    include/hw/acpi/tpm.h              |  65 +++++
>>>    include/sysemu/tpm.h               |  59 +++--
>>>    include/sysemu/tpm_backend.h       |  70 ++----
>>>    backends/tpm.c                     | 121 ++++-----
>>>    hw/i386/acpi-build.c               |  33 ++-
>>>    hw/tpm/tpm_crb.c                   | 320 ++++++++++++++++++++++++
>>>    hw/tpm/tpm_emulator.c              |  95 +++----
>>>    hw/tpm/tpm_passthrough.c           | 114 +++------
>>>    hw/tpm/tpm_tis.c                   | 499
>>> +++++++++++++++++++------------------
>>>    hw/tpm/tpm_util.c                  |   1 +
>>>    tpm.c                              |  63 ++---
>>>    default-configs/i386-softmmu.mak   |   1 +
>>>    default-configs/x86_64-softmmu.mak |   1 +
>>>    hw/tpm/Makefile.objs               |   1 +
>>>    scripts/checkpatch.pl              |   1 -
>>>    19 files changed, 899 insertions(+), 655 deletions(-)
>>>    delete mode 100644 hw/tpm/tpm_tis.h
>>>    create mode 100644 hw/tpm/tpm_crb.c
>>>
>>
>
>

  reply	other threads:[~2017-10-10 18:20 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 22:55 [Qemu-devel] [PATCH 00/42] TPM: code cleanup & CRB device Marc-André Lureau
2017-10-09 22:55 ` [Qemu-devel] [PATCH 01/42] tpm-tis: remove unused hw_access argument Marc-André Lureau
2017-10-10  2:34   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 02/42] tpm-tis: remove RAISE_STS_IRQ Marc-André Lureau
2017-10-10  2:36   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 03/42] tpm: make tpm_get_backend_driver() static Marc-André Lureau
2017-10-10  2:36   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 04/42] tpm: lookup tpm backend class in tpm_driver_find_by_type() Marc-André Lureau
2017-10-10  2:38   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 05/42] tpm: replace tpm_get_backend_driver() to drop be_drivers Marc-André Lureau
2017-10-10  2:40   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 06/42] tpm: remove tpm_register_driver() Marc-André Lureau
2017-10-10  2:41   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 07/42] tpm: move TPMSizedBuffer to tpm_tis.h Marc-André Lureau
2017-10-10  2:41   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 08/42] tpm: remove TPMDriverOps Marc-André Lureau
2017-10-10  7:12   ` Valluri, Amarnath
2017-10-10  7:29     ` Valluri, Amarnath
2017-10-19 14:43   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 09/42] tpm: remove init() class method Marc-André Lureau
2017-10-10 15:30   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 10/42] tpm: remove configure_tpm() hop Marc-André Lureau
2017-10-10 15:31   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 11/42] tpm: remove unused TPMBackendCmd Marc-André Lureau
2017-10-19 14:39   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 12/42] tpm: remove needless cast Marc-André Lureau
2017-10-10 15:31   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 13/42] tpm: remove locty argument from receive_cb Marc-André Lureau
2017-10-10 15:32   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 14/42] tpm: add TPMBackendCmd to hold the request state Marc-André Lureau
2017-10-10 15:38   ` Stefan Berger
2017-10-10 16:16     ` Marc-André Lureau
2017-10-11  1:27       ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 15/42] tpm-emulator: fix error handling Marc-André Lureau
2017-10-10 15:39   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 16/42] tpm: remove locty_data from TPMState Marc-André Lureau
2017-10-10 15:42   ` Stefan Berger
2017-10-09 22:55 ` [Qemu-devel] [PATCH 17/42] tpm-tis: move TPMState to TIS header Marc-André Lureau
2017-10-10 15:45   ` Stefan Berger
2017-10-10 16:01     ` Marc-André Lureau
2017-10-09 22:55 ` [Qemu-devel] [PATCH 18/42] tpm-tis: remove tpm_tis.h header Marc-André Lureau
2017-10-10 18:03   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 19/42] tpm-tis: fold TPMTISEmuState in TPMState Marc-André Lureau
2017-10-10 18:07   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 20/42] tpm: add a QOM TPM interface Marc-André Lureau
2017-10-10 18:09   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 21/42] tpm: move recv_data_callback to " Marc-André Lureau
2017-10-10 20:17   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 22/42] tpm-backend: store TPMIf interface, improve backend_init() Marc-André Lureau
2017-10-10  8:18   ` Valluri, Amarnath
2017-10-10 11:02     ` Marc-André Lureau
2017-10-09 22:56 ` [Qemu-devel] [PATCH 23/42] tpm-tis: no longer expose TPMState Marc-André Lureau
2017-10-10 20:17   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 24/42] tpm-be: call request_completed() out of thread Marc-André Lureau
2017-10-19 14:35   ` Stefan Berger
2017-10-19 22:02   ` Stefan Berger
2017-10-19 23:21     ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 25/42] tpm-be: report error instead of front-end Marc-André Lureau
2017-10-10 20:20   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 26/42] tpm-be: ask model to the TPM interface Marc-André Lureau
2017-10-10 20:22   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 27/42] tpm: remove unused opened code Marc-André Lureau
2017-10-10 20:50   ` Stefan Berger
2017-10-10 22:27     ` Marc-André Lureau
2017-10-11  1:30       ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 28/42] tpm-passthrough: don't save guessed cancel_path in options Marc-André Lureau
2017-10-10 20:26   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 29/42] tpm-be: update optional function pointers Marc-André Lureau
2017-10-10 20:28   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 30/42] tpm-passthrough: pass TPMPassthruState to handle_device_opts Marc-André Lureau
2017-10-10 20:29   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 31/42] tpm-backend: move set 'id' to common code Marc-André Lureau
2017-10-10  8:15   ` Valluri, Amarnath
2017-10-10 10:47     ` Marc-André Lureau
2017-10-10 11:39       ` Valluri, Amarnath
2017-10-10 20:31   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 32/42] tpm-passthrough: make it safer to destroy after creation Marc-André Lureau
2017-10-10 18:13   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 33/42] tpm-passthrough: remove error cleanup from handle_device_opts Marc-André Lureau
2017-10-10 20:34   ` Stefan Berger
2017-10-10 22:19     ` Marc-André Lureau
2017-10-11  1:28       ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 34/42] tpm-passthrough: workaround a possible race Marc-André Lureau
2017-10-10 20:37   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 35/42] tpm-tis: simplify header inclusion Marc-André Lureau
2017-10-10 20:38   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 36/42] tpm: rename qemu_find_tpm() -> qemu_find_tpm_be() Marc-André Lureau
2017-10-10 20:38   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 37/42] tpm: lookup the the TPM interface instead of TIS device Marc-André Lureau
2017-10-10 20:21   ` Eduardo Habkost
2017-10-10 20:47     ` Stefan Berger
2017-10-10 22:31       ` Marc-André Lureau
2017-10-10 20:42   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 38/42] tpm: add TPM interface to lookup TPM version Marc-André Lureau
2017-10-10 20:43   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 39/42] tpm: add tpm_cmd_get_size() to tpm_util Marc-André Lureau
2017-10-10 18:23   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 40/42] acpi: change TPM TIS data conditions Marc-André Lureau
2017-10-10 18:22   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 41/42] tpm-emulator: add a FIXME comment about blocking cancel Marc-André Lureau
2017-10-10 18:21   ` Stefan Berger
2017-10-09 22:56 ` [Qemu-devel] [PATCH 42/42] WIP: add TPM CRB device Marc-André Lureau
2017-10-10 18:28   ` Stefan Berger
2017-10-10 20:19     ` Eduardo Habkost
2017-10-20 15:31   ` Stefan Berger
2017-11-06 17:49   ` Stefan Berger
2017-10-09 23:32 ` [Qemu-devel] [PATCH 00/42] TPM: code cleanup & " no-reply
2017-10-10  2:34 ` Stefan Berger
2017-10-10 12:14   ` Marc-André Lureau
2017-10-10 18:20     ` Stefan Berger [this message]
2017-10-19 14:26 ` Stefan Berger
2017-10-19 14:33   ` Marc-André Lureau
2017-10-19 14:44     ` Stefan Berger
2017-10-19 16:50       ` Stefan Berger
2017-10-19 17:00         ` Marc-André Lureau
2017-10-19 23:55           ` 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=431bfbbf-3c6d-972e-bcb5-f8dba675d574@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=amarnath.valluri@intel.com \
    --cc=marcandre.lureau@gmail.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 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).