[libvirt PATCH v2 00/12] Expose TPM availability in domain capabilities

Daniel P. Berrangé posted 12 patches 2 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211124154416.369770-1-berrange@redhat.com
docs/schemas/domaincaps.rng                   |  10 +
run.in                                        |  22 +-
src/conf/domain_capabilities.c                |  14 ++
src/conf/domain_capabilities.h                |  10 +
src/libvirt_private.syms                      |   2 +-
src/qemu/qemu_capabilities.c                  |  34 +++
src/qemu/qemu_capabilities.h                  |   3 +
src/qemu/qemu_tpm.c                           |   6 -
src/util/virtpm.c                             | 232 ++++++++++--------
src/util/virtpm.h                             |   3 +-
.../domaincapsdata/qemu_2.11.0-q35.x86_64.xml |   9 +
.../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml |   9 +
tests/domaincapsdata/qemu_2.11.0.s390x.xml    |   1 +
tests/domaincapsdata/qemu_2.11.0.x86_64.xml   |   9 +
.../domaincapsdata/qemu_2.12.0-q35.x86_64.xml |  10 +
.../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml |  10 +
.../qemu_2.12.0-virt.aarch64.xml              |   1 +
tests/domaincapsdata/qemu_2.12.0.aarch64.xml  |   1 +
tests/domaincapsdata/qemu_2.12.0.ppc64.xml    |   1 +
tests/domaincapsdata/qemu_2.12.0.s390x.xml    |   1 +
tests/domaincapsdata/qemu_2.12.0.x86_64.xml   |  10 +
.../domaincapsdata/qemu_3.0.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml  |  10 +
tests/domaincapsdata/qemu_3.0.0.ppc64.xml     |   1 +
tests/domaincapsdata/qemu_3.0.0.s390x.xml     |   1 +
tests/domaincapsdata/qemu_3.0.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_3.1.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml  |  10 +
tests/domaincapsdata/qemu_3.1.0.ppc64.xml     |   1 +
tests/domaincapsdata/qemu_3.1.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_4.0.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml  |  10 +
.../qemu_4.0.0-virt.aarch64.xml               |   1 +
tests/domaincapsdata/qemu_4.0.0.aarch64.xml   |   1 +
tests/domaincapsdata/qemu_4.0.0.ppc64.xml     |   1 +
tests/domaincapsdata/qemu_4.0.0.s390x.xml     |   1 +
tests/domaincapsdata/qemu_4.0.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_4.1.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml  |  10 +
tests/domaincapsdata/qemu_4.1.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml  |  10 +
.../qemu_4.2.0-virt.aarch64.xml               |   1 +
tests/domaincapsdata/qemu_4.2.0.aarch64.xml   |   1 +
tests/domaincapsdata/qemu_4.2.0.ppc64.xml     |   6 +
tests/domaincapsdata/qemu_4.2.0.s390x.xml     |   1 +
tests/domaincapsdata/qemu_4.2.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml  |  10 +
.../qemu_5.0.0-virt.aarch64.xml               |   9 +
tests/domaincapsdata/qemu_5.0.0.aarch64.xml   |   9 +
tests/domaincapsdata/qemu_5.0.0.ppc64.xml     |  10 +
tests/domaincapsdata/qemu_5.0.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_5.1.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml  |  10 +
tests/domaincapsdata/qemu_5.1.0.sparc.xml     |   1 +
tests/domaincapsdata/qemu_5.1.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml  |  10 +
.../qemu_5.2.0-virt.aarch64.xml               |   9 +
tests/domaincapsdata/qemu_5.2.0.aarch64.xml   |   9 +
tests/domaincapsdata/qemu_5.2.0.ppc64.xml     |  10 +
tests/domaincapsdata/qemu_5.2.0.s390x.xml     |   1 +
tests/domaincapsdata/qemu_5.2.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml  |  10 +
.../qemu_6.0.0-virt.aarch64.xml               |   9 +
tests/domaincapsdata/qemu_6.0.0.aarch64.xml   |   9 +
tests/domaincapsdata/qemu_6.0.0.s390x.xml     |   1 +
tests/domaincapsdata/qemu_6.0.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml  |  10 +
tests/domaincapsdata/qemu_6.1.0.x86_64.xml    |  10 +
.../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  10 +
.../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  |  10 +
.../qemu_6.2.0-virt.aarch64.xml               |   9 +
tests/domaincapsdata/qemu_6.2.0.aarch64.xml   |   9 +
tests/domaincapsdata/qemu_6.2.0.ppc64.xml     |  10 +
tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  10 +
tests/domaincapstest.c                        |   9 +
80 files changed, 731 insertions(+), 127 deletions(-)
[libvirt PATCH v2 00/12] Expose TPM availability in domain capabilities
Posted by Daniel P. Berrangé 2 years, 4 months ago
If we can report whuether TPM is available, then mgmt apps can enable it
by default for new VMs. This is important because OS like Win11 consider
TPM to be mandatory.

In v2:

  - Avoid triggering reporting of errors when querying caps
  - Only skip reporting of emulator backend when swtpm is
    missing, not entire tpm suppport
  - Lots of refactoring to support point 1.

Daniel P. Berrangé (12):
  util: use consistent naming for swtpm global variables
  util: rename typedef for parsing swtpm capabilities
  util: refactor TPM helper methods to reduce duplicationm
  util: replace TPM global variables with a struct array
  util: don't export virTPMEmulatorInit method
  util: ensure all TPM global vars access is protected by lock
  util: pull TPM capabilities probing out of main init method
  util: add a method for checking if swtpm is available
  conf: add TPM devices to domain capabilities
  qemu: fill in domain capabilities for TPMs
  qemu: mock swtpm initialization in tests
  run: detect daemons when run via wrapper commands

 docs/schemas/domaincaps.rng                   |  10 +
 run.in                                        |  22 +-
 src/conf/domain_capabilities.c                |  14 ++
 src/conf/domain_capabilities.h                |  10 +
 src/libvirt_private.syms                      |   2 +-
 src/qemu/qemu_capabilities.c                  |  34 +++
 src/qemu/qemu_capabilities.h                  |   3 +
 src/qemu/qemu_tpm.c                           |   6 -
 src/util/virtpm.c                             | 232 ++++++++++--------
 src/util/virtpm.h                             |   3 +-
 .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml |   9 +
 .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml |   9 +
 tests/domaincapsdata/qemu_2.11.0.s390x.xml    |   1 +
 tests/domaincapsdata/qemu_2.11.0.x86_64.xml   |   9 +
 .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml |  10 +
 .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml |  10 +
 .../qemu_2.12.0-virt.aarch64.xml              |   1 +
 tests/domaincapsdata/qemu_2.12.0.aarch64.xml  |   1 +
 tests/domaincapsdata/qemu_2.12.0.ppc64.xml    |   1 +
 tests/domaincapsdata/qemu_2.12.0.s390x.xml    |   1 +
 tests/domaincapsdata/qemu_2.12.0.x86_64.xml   |  10 +
 .../domaincapsdata/qemu_3.0.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml  |  10 +
 tests/domaincapsdata/qemu_3.0.0.ppc64.xml     |   1 +
 tests/domaincapsdata/qemu_3.0.0.s390x.xml     |   1 +
 tests/domaincapsdata/qemu_3.0.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_3.1.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml  |  10 +
 tests/domaincapsdata/qemu_3.1.0.ppc64.xml     |   1 +
 tests/domaincapsdata/qemu_3.1.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_4.0.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml  |  10 +
 .../qemu_4.0.0-virt.aarch64.xml               |   1 +
 tests/domaincapsdata/qemu_4.0.0.aarch64.xml   |   1 +
 tests/domaincapsdata/qemu_4.0.0.ppc64.xml     |   1 +
 tests/domaincapsdata/qemu_4.0.0.s390x.xml     |   1 +
 tests/domaincapsdata/qemu_4.0.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_4.1.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml  |  10 +
 tests/domaincapsdata/qemu_4.1.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml  |  10 +
 .../qemu_4.2.0-virt.aarch64.xml               |   1 +
 tests/domaincapsdata/qemu_4.2.0.aarch64.xml   |   1 +
 tests/domaincapsdata/qemu_4.2.0.ppc64.xml     |   6 +
 tests/domaincapsdata/qemu_4.2.0.s390x.xml     |   1 +
 tests/domaincapsdata/qemu_4.2.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml  |  10 +
 .../qemu_5.0.0-virt.aarch64.xml               |   9 +
 tests/domaincapsdata/qemu_5.0.0.aarch64.xml   |   9 +
 tests/domaincapsdata/qemu_5.0.0.ppc64.xml     |  10 +
 tests/domaincapsdata/qemu_5.0.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml  |  10 +
 tests/domaincapsdata/qemu_5.1.0.sparc.xml     |   1 +
 tests/domaincapsdata/qemu_5.1.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml  |  10 +
 .../qemu_5.2.0-virt.aarch64.xml               |   9 +
 tests/domaincapsdata/qemu_5.2.0.aarch64.xml   |   9 +
 tests/domaincapsdata/qemu_5.2.0.ppc64.xml     |  10 +
 tests/domaincapsdata/qemu_5.2.0.s390x.xml     |   1 +
 tests/domaincapsdata/qemu_5.2.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml  |  10 +
 .../qemu_6.0.0-virt.aarch64.xml               |   9 +
 tests/domaincapsdata/qemu_6.0.0.aarch64.xml   |   9 +
 tests/domaincapsdata/qemu_6.0.0.s390x.xml     |   1 +
 tests/domaincapsdata/qemu_6.0.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml  |  10 +
 tests/domaincapsdata/qemu_6.1.0.x86_64.xml    |  10 +
 .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml  |  10 +
 .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml  |  10 +
 .../qemu_6.2.0-virt.aarch64.xml               |   9 +
 tests/domaincapsdata/qemu_6.2.0.aarch64.xml   |   9 +
 tests/domaincapsdata/qemu_6.2.0.ppc64.xml     |  10 +
 tests/domaincapsdata/qemu_6.2.0.x86_64.xml    |  10 +
 tests/domaincapstest.c                        |   9 +
 80 files changed, 731 insertions(+), 127 deletions(-)

-- 
2.33.1