qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is TYPE_TPM_TIS_ISA? (Not an ISA Device)


From: Stefan Berger
Subject: Re: What is TYPE_TPM_TIS_ISA? (Not an ISA Device)
Date: Wed, 22 Jul 2020 18:07:58 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]