qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Eric Auger" <eric.auger@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: What is TYPE_TPM_TIS_ISA? (Not an ISA Device)
Date: Wed, 22 Jul 2020 18:07:58 -0400	[thread overview]
Message-ID: <e4ad751f-8418-bdd4-6c81-600e68f5c92e@linux.ibm.com> (raw)
In-Reply-To: <87pn8o14cj.fsf@dusky.pond.sub.org>

On 7/22/20 1:55 AM, Markus Armbruster wrote:
> pm socket --tpmstate dir=tpm --ctrl type=unixio,path=tpm/swtpm-soc
> running in another terminal.
>
>>> 3/ no machine plug it using isa_register_ioport()
>>>     (it is not registered to the ISA memory space)
>> There's no requirement for an ISA device to have IO ports...
>>
>> thanks
>> -- PMM
> Thread hijack!  Since I didn't have swtpm installed, I tried to take a
> shortcut:
>
>      $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -chardev null,id=tpm0 -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
>      qemu-system-x86_64: -tpmdev emulator,id=tpm0,chardev=chrtpm: tpm-emulator: tpm chardev 'chrtpm' not found.
>      qemu-system-x86_64: -tpmdev emulator,id=tpm0,chardev=chrtpm: tpm-emulator: Could not cleanly shutdown the TPM: No such file or directory
>      QEMU 5.0.90 monitor - type 'help' for more information
>      (qemu) qemu-system-x86_64: -device tpm-tis,tpmdev=tpm0: Property 'tpm-tis.tpmdev' can't find value 'tpm0'
>      $ echo $?
>      1
>
> That a null chardev doesn't work is fine.  But the error handling looks
> broken: QEMU diagnoses and reports the problem, then continues.  The
> final error message indicates that it continued without creating the
> backend "tpm0".  That's wrong.


This issue can be solve via the following change that then displays this 
error:

$ x86_64-softmmu/qemu-system-x86_64 -nodefaults -S -display none 
-monitor stdio -chardev null,id=tpm0 -tpmdev 
emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
qemu-system-x86_64: -tpmdev emulator,id=tpm0,chardev=chrtpm: 
tpm-emulator: tpm chardev 'chrtpm' not found.
qemu-system-x86_64: -tpmdev emulator,id=tpm0,chardev=chrtpm: 
tpm-emulator: Could not cleanly shutdown the TPM: No such file or directory


diff --git a/tpm.c b/tpm.c
index 358566cb10..857a861e69 100644
--- a/tpm.c
+++ b/tpm.c
@@ -170,8 +170,10 @@ void tpm_cleanup(void)
   */
  void tpm_init(void)
  {
-    qemu_opts_foreach(qemu_find_opts("tpmdev"),
-                      tpm_init_tpmdev, NULL, &error_fatal);
+    if (qemu_opts_foreach(qemu_find_opts("tpmdev"),
+                          tpm_init_tpmdev, NULL, &error_fatal)) {
+        exit(1);
+    }
  }

  /*

We had something like this before this patch here was applied: 
https://github.com/qemu/qemu/commit/d10e05f15d5c3dd5e5cc59c5dfff460d89d48580#diff-0ec5df49c6751cb2dc9fa18ed5cf9f0e


Do we now want to partially revert this patch or call the exit(1) as 
shown here?


    Stefan



  reply	other threads:[~2020-07-22 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 16:02 What is TYPE_TPM_TIS_ISA? (Not an ISA Device) Philippe Mathieu-Daudé
2020-07-21 16:38 ` Stefan Berger
2020-07-21 16:40 ` Peter Maydell
2020-07-22  5:55   ` Markus Armbruster
2020-07-22 22:07     ` Stefan Berger [this message]
2020-07-23  9:10       ` Markus Armbruster

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=e4ad751f-8418-bdd4-6c81-600e68f5c92e@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=philmd@redhat.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).