qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] d64072: Revert "tpm: Clean up error reporting


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] d64072: Revert "tpm: Clean up error reporting in tpm_init_...
Date: Sun, 26 Jul 2020 09:31:56 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d64072c0ac6f73413026695bb33a4aa232e69617
      
https://github.com/qemu/qemu/commit/d64072c0ac6f73413026695bb33a4aa232e69617
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-07-24 (Fri, 24 Jul 2020)

  Changed paths:
    M include/sysemu/tpm.h
    M softmmu/vl.c
    M stubs/tpm.c
    M tpm.c

  Log Message:
  -----------
  Revert "tpm: Clean up error reporting in tpm_init_tpmdev()"

This reverts commit d10e05f15d5c3dd5e5cc59c5dfff460d89d48580.

We report some -tpmdev failures, but then continue as if all was fine.
Reproducer:

    $ 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

This is a regression caused by commit d10e05f15d "tpm: Clean up error
reporting in tpm_init_tpmdev()".  It's incomplete: be->create(opts)
continues to use error_report(), and we don't set an error when it
fails.

I figure converting the create() methods to Error would make some
sense, but I'm not sure it's worth the effort right now.  Revert the
broken commit instead, and add a comment to tpm_init_tpmdev().

Straightforward conflict in tpm.c resolved.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>


  Commit: 5a6791c3d4a7719e8d0797afe0e2822a54bda6a2
      
https://github.com/qemu/qemu/commit/5a6791c3d4a7719e8d0797afe0e2822a54bda6a2
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-07-24 (Fri, 24 Jul 2020)

  Changed paths:
    M tpm.c

  Log Message:
  -----------
  tpm: Improve help on TPM types when none are available

Help is a bit awkward when no TPM types are built into QEMU:

    $ qemu-system-x86_64 -tpmdev nonexistent,id=tpm0
    qemu-system-x86_64: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a 
TPM backend type
    Supported TPM types (choose only one):

Improve to

    qemu-system-x86_64: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a 
TPM backend type
    No TPM backend types are available

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>


  Commit: 88f830745721ba8c9e9d2831c01045a6f130c1a6
      
https://github.com/qemu/qemu/commit/88f830745721ba8c9e9d2831c01045a6f130c1a6
  Author: Stefan Berger <stefanb@linux.vnet.ibm.com>
  Date:   2020-07-24 (Fri, 24 Jul 2020)

  Changed paths:
    M backends/tpm/tpm_emulator.c

  Log Message:
  -----------
  tpm_emulator: Report an error if chardev is missing

This patch fixes the odd error reporting when trying to send a file
descriptor to the TPM emulator if one has not passed a valid chardev.

$ x86_64-softmmu/qemu-system-x86_64 -tpmdev emulator,id=tpm0
qemu-system-x86_64: -tpmdev emulator,id=tpm0: tpm-emulator: Failed to send 
CMD_SET_DATAFD: Success
qemu-system-x86_64: -tpmdev emulator,id=tpm0: tpm-emulator: Could not cleanly 
shutdown the TPM: Success

This is the new error report:

$ x86_64-softmmu/qemu-system-x86_64 -tpmdev emulator,id=tpm0
qemu-system-x86_64: -tpmdev emulator,id=tpm0: tpm-emulator: parameter 'chardev' 
is missing

This change does not hide the display of supported TPM types if a non-existent 
type is passed:

$ x86_64-softmmu/qemu-system-x86_64 -tpmdev nonexistent,id=tpm0
qemu-system-x86_64: -tpmdev nonexistent,id=tpm0: Parameter 'type' expects a TPM 
backend type
Supported TPM types (choose only one):
 passthrough   Passthrough TPM backend driver
    emulator   TPM emulator backend driver

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>


  Commit: 57cdde4a74dd0d68df9e32657773484a5484a027
      
https://github.com/qemu/qemu/commit/57cdde4a74dd0d68df9e32657773484a5484a027
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-07-25 (Sat, 25 Jul 2020)

  Changed paths:
    M backends/tpm/tpm_emulator.c
    M include/sysemu/tpm.h
    M softmmu/vl.c
    M stubs/tpm.c
    M tpm.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/stefanberger/tags/pull-tpm-2020-07-24-1' into staging

Merge tpm 2020/07/24 v1

# gpg: Signature made Sat 25 Jul 2020 01:13:22 BST
# gpg:                using RSA key B818B9CADF9089C2D5CEC66B75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>" 
[unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2020-07-24-1:
  tpm_emulator: Report an error if chardev is missing
  tpm: Improve help on TPM types when none are available
  Revert "tpm: Clean up error reporting in tpm_init_tpmdev()"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/b0ce3f021e01...57cdde4a74dd



reply via email to

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