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

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

Use a '_path' suffix on all vars which are paths. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 2c0dd707b0..d5d80aa9dc 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -100,11 +100,11 @@ static char *swtpm_path; static struct stat swtpm_stat; static virBitmap *swtpm_caps; -static char *swtpm_setup; +static char *swtpm_setup_path; static struct stat swtpm_setup_stat; static virBitmap *swtpm_setup_caps; -static char *swtpm_ioctl; +static char *swtpm_ioctl_path; static struct stat swtpm_ioctl_stat; typedef int (*TypeFromStringFn)(const char *); @@ -129,11 +129,11 @@ virTPMGetSwtpmSetup(void) { char *s; - if (!swtpm_setup && virTPMEmulatorInit() < 0) + if (!swtpm_setup_path && virTPMEmulatorInit() < 0) return NULL; virMutexLock(&swtpm_tools_lock); - s = g_strdup(swtpm_setup); + s = g_strdup(swtpm_setup_path); virMutexUnlock(&swtpm_tools_lock); return s; @@ -144,11 +144,11 @@ virTPMGetSwtpmIoctl(void) { char *s; - if (!swtpm_ioctl && virTPMEmulatorInit() < 0) + if (!swtpm_ioctl_path && virTPMEmulatorInit() < 0) return NULL; virMutexLock(&swtpm_tools_lock); - s = g_strdup(swtpm_ioctl); + s = g_strdup(swtpm_ioctl_path); virMutexUnlock(&swtpm_tools_lock); return s; @@ -275,14 +275,14 @@ virTPMEmulatorInit(void) }, { .name = "swtpm_setup", - .path = &swtpm_setup, + .path = &swtpm_setup_path, .stat = &swtpm_setup_stat, .caps = &swtpm_setup_caps, .typeFromStringFn = virTPMSwtpmSetupFeatureTypeFromString, }, { .name = "swtpm_ioctl", - .path = &swtpm_ioctl, + .path = &swtpm_ioctl_path, .stat = &swtpm_ioctl_stat, } }; -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
Use a '_path' suffix on all vars which are paths.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Best practice is to have all types use a naming convention based on the filename. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index d5d80aa9dc..1a34f8ce56 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -107,7 +107,7 @@ static virBitmap *swtpm_setup_caps; static char *swtpm_ioctl_path; static struct stat swtpm_ioctl_stat; -typedef int (*TypeFromStringFn)(const char *); +typedef int (*virTPMBinaryCapsParse)(const char *); char * virTPMGetSwtpm(void) @@ -171,7 +171,7 @@ virTPMGetSwtpmIoctl(void) */ static virBitmap * virTPMExecGetCaps(virCommand *cmd, - TypeFromStringFn typeFromStringFn) + virTPMBinaryCapsParse capsParse) { int exitstatus; virBitmap *bitmap; @@ -214,7 +214,7 @@ virTPMExecGetCaps(virCommand *cmd, str = virJSONValueGetString(item); if (!str) goto error_bad_json; - typ = typeFromStringFn(str); + typ = capsParse(str); if (typ < 0) continue; @@ -231,8 +231,8 @@ virTPMExecGetCaps(virCommand *cmd, } static virBitmap * -virTPMGetCaps(TypeFromStringFn typeFromStringFn, - const char *exec, const char *param1) +virTPMGetCaps(virTPMBinaryCapsParse capsParse, + const char *exec, const char *param1) { g_autoptr(virCommand) cmd = NULL; @@ -244,7 +244,7 @@ virTPMGetCaps(TypeFromStringFn typeFromStringFn, virCommandAddArg(cmd, "--print-capabilities"); virCommandClearCaps(cmd); - return virTPMExecGetCaps(cmd, typeFromStringFn); + return virTPMExecGetCaps(cmd, capsParse); } /* @@ -263,7 +263,7 @@ virTPMEmulatorInit(void) struct stat *stat; const char *parm; virBitmap **caps; - TypeFromStringFn typeFromStringFn; + virTPMBinaryCapsParse capsParse; } prgs[] = { { .name = "swtpm", @@ -271,14 +271,14 @@ virTPMEmulatorInit(void) .stat = &swtpm_stat, .parm = "socket", .caps = &swtpm_caps, - .typeFromStringFn = virTPMSwtpmFeatureTypeFromString, + .capsParse = virTPMSwtpmFeatureTypeFromString, }, { .name = "swtpm_setup", .path = &swtpm_setup_path, .stat = &swtpm_setup_stat, .caps = &swtpm_setup_caps, - .typeFromStringFn = virTPMSwtpmSetupFeatureTypeFromString, + .capsParse = virTPMSwtpmSetupFeatureTypeFromString, }, { .name = "swtpm_ioctl", @@ -329,7 +329,7 @@ virTPMEmulatorInit(void) *prgs[i].path = g_steal_pointer(&path); if (prgs[i].caps) { - *prgs[i].caps = virTPMGetCaps(prgs[i].typeFromStringFn, + *prgs[i].caps = virTPMGetCaps(prgs[i].capsParse, *prgs[i].path, prgs[i].parm); if (!*prgs[i].caps) goto cleanup; -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
Best practice is to have all types use a naming convention based on the filename.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The TPM helper methods for querying the binary path and capabilities have the same patterns across all swtpm binaries. This code duplication can be reduced by introducing helper methods. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 53 ++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 1a34f8ce56..cc9173cecd 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -109,49 +109,37 @@ static struct stat swtpm_ioctl_stat; typedef int (*virTPMBinaryCapsParse)(const char *); -char * -virTPMGetSwtpm(void) +static char * +virTPMBinaryGetPath(char **path_var) { char *s; - if (!swtpm_path && virTPMEmulatorInit() < 0) + if (!*path_var && virTPMEmulatorInit() < 0) return NULL; virMutexLock(&swtpm_tools_lock); - s = g_strdup(swtpm_path); + s = g_strdup(*path_var); virMutexUnlock(&swtpm_tools_lock); return s; } char * -virTPMGetSwtpmSetup(void) +virTPMGetSwtpm(void) { - char *s; - - if (!swtpm_setup_path && virTPMEmulatorInit() < 0) - return NULL; - - virMutexLock(&swtpm_tools_lock); - s = g_strdup(swtpm_setup_path); - virMutexUnlock(&swtpm_tools_lock); + return virTPMBinaryGetPath(&swtpm_path); +} - return s; +char * +virTPMGetSwtpmSetup(void) +{ + return virTPMBinaryGetPath(&swtpm_setup_path); } char * virTPMGetSwtpmIoctl(void) { - char *s; - - if (!swtpm_ioctl_path && virTPMEmulatorInit() < 0) - return NULL; - - virMutexLock(&swtpm_tools_lock); - s = g_strdup(swtpm_ioctl_path); - virMutexUnlock(&swtpm_tools_lock); - - return s; + return virTPMBinaryGetPath(&swtpm_ioctl_path); } /* virTPMExecGetCaps @@ -345,18 +333,23 @@ virTPMEmulatorInit(void) return ret; } -bool -virTPMSwtpmCapsGet(unsigned int cap) +static bool +virTPMBinaryGetCaps(virBitmap **caps_var, + unsigned int cap) { if (virTPMEmulatorInit() < 0) return false; - return virBitmapIsBitSet(swtpm_caps, cap); + return virBitmapIsBitSet(*caps_var, cap); +} + +bool +virTPMSwtpmCapsGet(unsigned int cap) +{ + return virTPMBinaryGetCaps(&swtpm_caps, cap); } bool virTPMSwtpmSetupCapsGet(unsigned int cap) { - if (virTPMEmulatorInit() < 0) - return false; - return virBitmapIsBitSet(swtpm_setup_caps, cap); + return virTPMBinaryGetCaps(&swtpm_setup_caps, cap); } -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The TPM helper methods for querying the binary path and capabilities have the same patterns across all swtpm binaries. This code duplication can be reduced by introducing helper methods.
s/duplicationm/duplication/ in the commit summary
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 53 ++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 30 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The virTPMEmulatorInit function defines a struct that gets filled with pointers to global variables. It will be simpler to just use the struct for the global variables directly. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 121 ++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 63 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index cc9173cecd..2539ea9275 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -96,29 +96,52 @@ virTPMCreateCancelPath(const char *devpath) * capabilities bitmap */ static virMutex swtpm_tools_lock = VIR_MUTEX_INITIALIZER; -static char *swtpm_path; -static struct stat swtpm_stat; -static virBitmap *swtpm_caps; - -static char *swtpm_setup_path; -static struct stat swtpm_setup_stat; -static virBitmap *swtpm_setup_caps; - -static char *swtpm_ioctl_path; -static struct stat swtpm_ioctl_stat; typedef int (*virTPMBinaryCapsParse)(const char *); +typedef enum _virTPMBinary { + VIR_TPM_BINARY_SWTPM, + VIR_TPM_BINARY_SWTPM_SETUP, + VIR_TPM_BINARY_SWTPM_IOCTL, + + VIR_TPM_BINARY_LAST +} virTPMBinary; + +VIR_ENUM_DECL(virTPMBinary); +VIR_ENUM_IMPL(virTPMBinary, + VIR_TPM_BINARY_LAST, + "swtpm", "swtpm_setup", "swtpm_ioctl"); + +typedef struct _virTPMBinaryInfo { + char *path; + struct stat stat; + const char *parm; + virBitmap *caps; + virTPMBinaryCapsParse capsParse; +} virTPMBinaryInfo; + +static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LAST] = { + [VIR_TPM_BINARY_SWTPM] = { + .parm = "socket", + .capsParse = virTPMSwtpmFeatureTypeFromString, + }, + [VIR_TPM_BINARY_SWTPM_SETUP] = { + .capsParse = virTPMSwtpmSetupFeatureTypeFromString, + }, + [VIR_TPM_BINARY_SWTPM_IOCTL] = { + }, +}; + static char * -virTPMBinaryGetPath(char **path_var) +virTPMBinaryGetPath(virTPMBinary binary) { char *s; - if (!*path_var && virTPMEmulatorInit() < 0) + if (!swtpmBinaries[binary].path && virTPMEmulatorInit() < 0) return NULL; virMutexLock(&swtpm_tools_lock); - s = g_strdup(*path_var); + s = g_strdup(swtpmBinaries[binary].path); virMutexUnlock(&swtpm_tools_lock); return s; @@ -127,19 +150,19 @@ virTPMBinaryGetPath(char **path_var) char * virTPMGetSwtpm(void) { - return virTPMBinaryGetPath(&swtpm_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM); } char * virTPMGetSwtpmSetup(void) { - return virTPMBinaryGetPath(&swtpm_setup_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_SETUP); } char * virTPMGetSwtpmIoctl(void) { - return virTPMBinaryGetPath(&swtpm_ioctl_path); + return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_IOCTL); } /* virTPMExecGetCaps @@ -245,62 +268,33 @@ int virTPMEmulatorInit(void) { int ret = -1; - static const struct { - const char *name; - char **path; - struct stat *stat; - const char *parm; - virBitmap **caps; - virTPMBinaryCapsParse capsParse; - } prgs[] = { - { - .name = "swtpm", - .path = &swtpm_path, - .stat = &swtpm_stat, - .parm = "socket", - .caps = &swtpm_caps, - .capsParse = virTPMSwtpmFeatureTypeFromString, - }, - { - .name = "swtpm_setup", - .path = &swtpm_setup_path, - .stat = &swtpm_setup_stat, - .caps = &swtpm_setup_caps, - .capsParse = virTPMSwtpmSetupFeatureTypeFromString, - }, - { - .name = "swtpm_ioctl", - .path = &swtpm_ioctl_path, - .stat = &swtpm_ioctl_stat, - } - }; size_t i; virMutexLock(&swtpm_tools_lock); - for (i = 0; i < G_N_ELEMENTS(prgs); i++) { + for (i = 0; i < VIR_TPM_BINARY_LAST; i++) { g_autofree char *path = NULL; - bool findit = *prgs[i].path == NULL; + bool findit = swtpmBinaries[i].path == NULL; struct stat statbuf; if (!findit) { /* has executables changed? */ - if (stat(*prgs[i].path, &statbuf) < 0) + if (stat(swtpmBinaries[i].path, &statbuf) < 0) findit = true; if (!findit && - statbuf.st_mtime != prgs[i].stat->st_mtime) + statbuf.st_mtime != swtpmBinaries[i].stat.st_mtime) findit = true; } if (findit) { - VIR_FREE(*prgs[i].path); + VIR_FREE(swtpmBinaries[i].path); - path = virFindFileInPath(prgs[i].name); + path = virFindFileInPath(virTPMBinaryTypeToString(i)); if (!path) { virReportSystemError(ENOENT, - _("Unable to find '%s' binary in $PATH"), - prgs[i].name); + _("Unable to find '%s' binary in $PATH"), + virTPMBinaryTypeToString(i)); goto cleanup; } if (!virFileIsExecutable(path)) { @@ -309,17 +303,18 @@ virTPMEmulatorInit(void) path); goto cleanup; } - if (stat(path, prgs[i].stat) < 0) { + if (stat(path, &swtpmBinaries[i].stat) < 0) { virReportSystemError(errno, _("Could not stat %s"), path); goto cleanup; } - *prgs[i].path = g_steal_pointer(&path); + swtpmBinaries[i].path = g_steal_pointer(&path); - if (prgs[i].caps) { - *prgs[i].caps = virTPMGetCaps(prgs[i].capsParse, - *prgs[i].path, prgs[i].parm); - if (!*prgs[i].caps) + if (swtpmBinaries[i].capsParse) { + swtpmBinaries[i].caps = virTPMGetCaps(swtpmBinaries[i].capsParse, + swtpmBinaries[i].path, + swtpmBinaries[i].parm); + if (!swtpmBinaries[i].caps) goto cleanup; } } @@ -334,22 +329,22 @@ virTPMEmulatorInit(void) } static bool -virTPMBinaryGetCaps(virBitmap **caps_var, +virTPMBinaryGetCaps(virTPMBinary binary, unsigned int cap) { if (virTPMEmulatorInit() < 0) return false; - return virBitmapIsBitSet(*caps_var, cap); + return virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); } bool virTPMSwtpmCapsGet(unsigned int cap) { - return virTPMBinaryGetCaps(&swtpm_caps, cap); + return virTPMBinaryGetCaps(VIR_TPM_BINARY_SWTPM, cap); } bool virTPMSwtpmSetupCapsGet(unsigned int cap) { - return virTPMBinaryGetCaps(&swtpm_setup_caps, cap); + return virTPMBinaryGetCaps(VIR_TPM_BINARY_SWTPM_SETUP, cap); } -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The virTPMEmulatorInit function defines a struct that gets filled with pointers to global variables. It will be simpler to just use the struct for the global variables directly.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 121 ++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 63 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Every other exportd API from virtpm.h will internally call virTPMEmulatorInit, so there is no reason for this initializer to be exported on its own. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/libvirt_private.syms | 1 - src/qemu/qemu_tpm.c | 6 ------ src/util/virtpm.c | 4 +++- src/util/virtpm.h | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b98cb0f66d..6b179a61b9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3447,7 +3447,6 @@ virTimeStringThenRaw; # util/virtpm.h virTPMCreateCancelPath; -virTPMEmulatorInit; virTPMGetSwtpm; virTPMGetSwtpmIoctl; virTPMGetSwtpmSetup; diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 62f54f56ab..1b923fd68e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -295,9 +295,6 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDef *tpm, uid_t qemu_user, const char *shortName) { - if (virTPMEmulatorInit() < 0) - return -1; - /* create log dir ... allow 'tss' user to cd into it */ if (g_mkdir_with_parents(logDir, 0711) < 0) return -1; @@ -804,9 +801,6 @@ qemuTPMEmulatorStop(const char *swtpmStateDir, if (!swtpm_ioctl) return; - if (virTPMEmulatorInit() < 0) - return; - if (!(pathname = qemuTPMCreateEmulatorSocket(swtpmStateDir, shortName))) return; diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 2539ea9275..3ea3b668e2 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -132,6 +132,8 @@ static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LAST] = { }, }; +static int virTPMEmulatorInit(void); + static char * virTPMBinaryGetPath(virTPMBinary binary) { @@ -264,7 +266,7 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, * Initialize the Emulator functions by searching for necessary * executables that we will use to start and setup the swtpm */ -int +static int virTPMEmulatorInit(void) { int ret = -1; diff --git a/src/util/virtpm.h b/src/util/virtpm.h index defea6c106..4c16332f9b 100644 --- a/src/util/virtpm.h +++ b/src/util/virtpm.h @@ -25,7 +25,6 @@ char *virTPMCreateCancelPath(const char *devpath) G_GNUC_NO_INLINE; char *virTPMGetSwtpm(void); char *virTPMGetSwtpmSetup(void); char *virTPMGetSwtpmIoctl(void); -int virTPMEmulatorInit(void); bool virTPMSwtpmCapsGet(unsigned int cap); bool virTPMSwtpmSetupCapsGet(unsigned int cap); -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
Every other exportd API from virtpm.h will internally call
*exported
virTPMEmulatorInit, so there is no reason for this initializer to be exported on its own.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/libvirt_private.syms | 1 - src/qemu/qemu_tpm.c | 6 ------ src/util/virtpm.c | 4 +++- src/util/virtpm.h | 1 - 4 files changed, 3 insertions(+), 9 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The virTPMEmulatorInit method updates various global variables and holds a lock while doing so. Other methods which access these variables, however, don't reliably hold locks over all of their accesses. Since virTPMEmulatorInit is no longer exported, we can push the locking up into all the callers and achieve proper safety for concurrent usage. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 3ea3b668e2..7e75c74d67 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -137,15 +137,17 @@ static int virTPMEmulatorInit(void); static char * virTPMBinaryGetPath(virTPMBinary binary) { - char *s; - - if (!swtpmBinaries[binary].path && virTPMEmulatorInit() < 0) - return NULL; + char *s = NULL; virMutexLock(&swtpm_tools_lock); + + if (virTPMEmulatorInit() < 0) + goto cleanup; + s = g_strdup(swtpmBinaries[binary].path); - virMutexUnlock(&swtpm_tools_lock); + cleanup: + virMutexUnlock(&swtpm_tools_lock); return s; } @@ -269,11 +271,8 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, static int virTPMEmulatorInit(void) { - int ret = -1; size_t i; - virMutexLock(&swtpm_tools_lock); - for (i = 0; i < VIR_TPM_BINARY_LAST; i++) { g_autofree char *path = NULL; bool findit = swtpmBinaries[i].path == NULL; @@ -297,18 +296,18 @@ virTPMEmulatorInit(void) virReportSystemError(ENOENT, _("Unable to find '%s' binary in $PATH"), virTPMBinaryTypeToString(i)); - goto cleanup; + return -1; } if (!virFileIsExecutable(path)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s is not an executable"), path); - goto cleanup; + return -1; } if (stat(path, &swtpmBinaries[i].stat) < 0) { virReportSystemError(errno, _("Could not stat %s"), path); - goto cleanup; + return -1; } swtpmBinaries[i].path = g_steal_pointer(&path); @@ -317,26 +316,29 @@ virTPMEmulatorInit(void) swtpmBinaries[i].path, swtpmBinaries[i].parm); if (!swtpmBinaries[i].caps) - goto cleanup; + return -1; } } } - ret = 0; - - cleanup: - virMutexUnlock(&swtpm_tools_lock); - - return ret; + return 0; } static bool virTPMBinaryGetCaps(virTPMBinary binary, unsigned int cap) { + bool ret = false; + + virMutexLock(&swtpm_tools_lock); + if (virTPMEmulatorInit() < 0) - return false; - return virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + goto cleanup; + ret = virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + + cleanup: + virMutexUnlock(&swtpm_tools_lock); + return ret; } bool -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The virTPMEmulatorInit method updates various global variables and holds a lock while doing so. Other methods which access these variables, however, don't reliably hold locks over all of their accesses.
Since virTPMEmulatorInit is no longer exported, we can push the locking up into all the callers and achieve proper safety for concurrent usage.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Many methods merely want to know that the swtpm binaries have been found, and don't care about probing for capabilities. Even when starting a guest, the QEMU driver may not need the capabilities. Skipping probing ensures the VM startup path is as fast as possible when capabilities are not required. It also removes various error scenarios from the main init method. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 7e75c74d67..ec51c0efb3 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -310,14 +310,8 @@ virTPMEmulatorInit(void) return -1; } swtpmBinaries[i].path = g_steal_pointer(&path); - - if (swtpmBinaries[i].capsParse) { - swtpmBinaries[i].caps = virTPMGetCaps(swtpmBinaries[i].capsParse, - swtpmBinaries[i].path, - swtpmBinaries[i].parm); - if (!swtpmBinaries[i].caps) - return -1; - } + virBitmapFree(swtpmBinaries[i].caps); + swtpmBinaries[i].caps = NULL; } } @@ -334,7 +328,16 @@ virTPMBinaryGetCaps(virTPMBinary binary, if (virTPMEmulatorInit() < 0) goto cleanup; - ret = virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); + + if (!swtpmBinaries[binary].caps && + swtpmBinaries[binary].capsParse) { + swtpmBinaries[binary].caps = virTPMGetCaps( + swtpmBinaries[binary].capsParse, + swtpmBinaries[binary].path, + swtpmBinaries[binary].parm); + } + if (swtpmBinaries[binary].caps) + ret = virBitmapIsBitSet(swtpmBinaries[binary].caps, cap); cleanup: virMutexUnlock(&swtpm_tools_lock); -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
Many methods merely want to know that the swtpm binaries have been found, and don't care about probing for capabilities. Even when starting a guest, the QEMU driver may not need the capabilities.
Skipping probing ensures the VM startup path is as fast as possible when capabilities are not required. It also removes various error scenarios from the main init method.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virtpm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The QEMU domain capabilities code wants to quietly know whether swtpm is available on the host. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/libvirt_private.syms | 1 + src/util/virtpm.c | 45 +++++++++++++++++++++++++++++----------- src/util/virtpm.h | 2 ++ 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6b179a61b9..6aa57abad4 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3450,6 +3450,7 @@ virTPMCreateCancelPath; virTPMGetSwtpm; virTPMGetSwtpmIoctl; virTPMGetSwtpmSetup; +virTPMHasSwtpm; virTPMSwtpmCapsGet; virTPMSwtpmFeatureTypeFromString; virTPMSwtpmSetupCapsGet; diff --git a/src/util/virtpm.c b/src/util/virtpm.c index ec51c0efb3..63579b8e69 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -132,7 +132,7 @@ static virTPMBinaryInfo swtpmBinaries[VIR_TPM_BINARY_LAST] = { }, }; -static int virTPMEmulatorInit(void); +static int virTPMEmulatorInit(bool quiet); static char * virTPMBinaryGetPath(virTPMBinary binary) @@ -141,7 +141,7 @@ virTPMBinaryGetPath(virTPMBinary binary) virMutexLock(&swtpm_tools_lock); - if (virTPMEmulatorInit() < 0) + if (virTPMEmulatorInit(false) < 0) goto cleanup; s = g_strdup(swtpmBinaries[binary].path); @@ -169,6 +169,24 @@ virTPMGetSwtpmIoctl(void) return virTPMBinaryGetPath(VIR_TPM_BINARY_SWTPM_IOCTL); } +bool virTPMHasSwtpm(void) +{ + bool ret = false; + + virMutexLock(&swtpm_tools_lock); + + if (virTPMEmulatorInit(true) < 0) + goto cleanup; + + ret = swtpmBinaries[VIR_TPM_BINARY_SWTPM].path != NULL && + swtpmBinaries[VIR_TPM_BINARY_SWTPM_SETUP].path != NULL && + swtpmBinaries[VIR_TPM_BINARY_SWTPM_IOCTL].path != NULL; + + cleanup: + virMutexUnlock(&swtpm_tools_lock); + return ret; +} + /* virTPMExecGetCaps * * Execute the prepared command and parse the returned JSON object @@ -269,7 +287,7 @@ virTPMGetCaps(virTPMBinaryCapsParse capsParse, * executables that we will use to start and setup the swtpm */ static int -virTPMEmulatorInit(void) +virTPMEmulatorInit(bool quiet) { size_t i; @@ -293,20 +311,23 @@ virTPMEmulatorInit(void) path = virFindFileInPath(virTPMBinaryTypeToString(i)); if (!path) { - virReportSystemError(ENOENT, - _("Unable to find '%s' binary in $PATH"), - virTPMBinaryTypeToString(i)); + if (!quiet) + virReportSystemError(ENOENT, + _("Unable to find '%s' binary in $PATH"), + virTPMBinaryTypeToString(i)); return -1; } if (!virFileIsExecutable(path)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s is not an executable"), - path); + if (!quiet) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is not an executable"), + path); return -1; } if (stat(path, &swtpmBinaries[i].stat) < 0) { - virReportSystemError(errno, - _("Could not stat %s"), path); + if (!quiet) + virReportSystemError(errno, + _("Could not stat %s"), path); return -1; } swtpmBinaries[i].path = g_steal_pointer(&path); @@ -326,7 +347,7 @@ virTPMBinaryGetCaps(virTPMBinary binary, virMutexLock(&swtpm_tools_lock); - if (virTPMEmulatorInit() < 0) + if (virTPMEmulatorInit(false) < 0) goto cleanup; if (!swtpmBinaries[binary].caps && diff --git a/src/util/virtpm.h b/src/util/virtpm.h index 4c16332f9b..0a82a03b69 100644 --- a/src/util/virtpm.h +++ b/src/util/virtpm.h @@ -26,6 +26,8 @@ char *virTPMGetSwtpm(void); char *virTPMGetSwtpmSetup(void); char *virTPMGetSwtpmIoctl(void); +bool virTPMHasSwtpm(void); + bool virTPMSwtpmCapsGet(unsigned int cap); bool virTPMSwtpmSetupCapsGet(unsigned int cap); -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The QEMU domain capabilities code wants to quietly know whether swtpm is available on the host.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/libvirt_private.syms | 1 + src/util/virtpm.c | 45 +++++++++++++++++++++++++++++----------- src/util/virtpm.h | 2 ++ 3 files changed, 36 insertions(+), 12 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

This adds reporting of available TPM models and backends to the domain capabilities schema Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/schemas/domaincaps.rng | 10 ++++++++++ src/conf/domain_capabilities.c | 14 ++++++++++++++ src/conf/domain_capabilities.h | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 8b5267f741..1b6122507f 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -195,6 +195,9 @@ <optional> <ref name="filesystem"/> </optional> + <optional> + <ref name="tpm"/> + </optional> </element> </define> @@ -240,6 +243,13 @@ </element> </define> + <define name="tpm"> + <element name="tpm"> + <ref name="supported"/> + <ref name="enum"/> + </element> + </define> + <define name="features"> <element name="features"> <optional> diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 1766129092..fef1326190 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -533,6 +533,19 @@ virDomainCapsDeviceRNGFormat(virBuffer *buf, } +static void +virDomainCapsDeviceTPMFormat(virBuffer *buf, + const virDomainCapsDeviceTPM *tpm) +{ + FORMAT_PROLOGUE(tpm); + + ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString); + ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString); + + FORMAT_EPILOGUE(tpm); +} + + static void virDomainCapsDeviceFilesystemFormat(virBuffer *buf, const virDomainCapsDeviceFilesystem *filesystem) @@ -652,6 +665,7 @@ virDomainCapsFormat(const virDomainCaps *caps) virDomainCapsDeviceHostdevFormat(&buf, &caps->hostdev); virDomainCapsDeviceRNGFormat(&buf, &caps->rng); virDomainCapsDeviceFilesystemFormat(&buf, &caps->filesystem); + virDomainCapsDeviceTPMFormat(&buf, &caps->tpm); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "</devices>\n"); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index d44acdcd01..2fcad87fd8 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -120,6 +120,15 @@ struct _virDomainCapsDeviceRNG { virDomainCapsEnum backendModel; /* virDomainRNGBackend */ }; +STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_MODEL_LAST); +STATIC_ASSERT_ENUM(VIR_DOMAIN_TPM_TYPE_LAST); +typedef struct _virDomainCapsDeviceTPM virDomainCapsDeviceTPM; +struct _virDomainCapsDeviceTPM { + virTristateBool supported; + virDomainCapsEnum model; /* virDomainTPMModel */ + virDomainCapsEnum backendModel; /* virDomainTPMBackendType */ +}; + STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST); typedef struct _virDomainCapsDeviceFilesystem virDomainCapsDeviceFilesystem; struct _virDomainCapsDeviceFilesystem { @@ -211,6 +220,7 @@ struct _virDomainCaps { virDomainCapsDeviceHostdev hostdev; virDomainCapsDeviceRNG rng; virDomainCapsDeviceFilesystem filesystem; + virDomainCapsDeviceTPM tpm; /* add new domain devices here */ virDomainCapsFeatureGIC gic; -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
This adds reporting of available TPM models and backends to the domain capabilities schema
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/schemas/domaincaps.rng | 10 ++++++++++ src/conf/domain_capabilities.c | 14 ++++++++++++++ src/conf/domain_capabilities.h | 10 ++++++++++ 3 files changed, 34 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

This reports what TPM features QEMU supports, provided that swtpm is installed in the host. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 34 +++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 ++ .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 8 +++++ .../domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 8 +++++ tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 + tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 8 +++++ .../domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 9 +++++ .../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 | 9 +++++ .../domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 9 +++++ 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 | 9 +++++ .../domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_3.1.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_3.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 9 +++++ .../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 | 9 +++++ .../domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 9 +++++ .../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 | 9 +++++ .../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 9 +++++ .../qemu_5.0.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_5.1.0.sparc.xml | 1 + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 9 +++++ .../qemu_5.2.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 9 +++++ .../qemu_6.0.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 9 +++++ tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 9 +++++ .../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 9 +++++ .../qemu_6.2.0-virt.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 9 +++++ 71 files changed, 500 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 33797469a6..b2d320e67a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -49,6 +49,7 @@ #include "qemu_process.h" #include "qemu_firmware.h" #include "virutil.h" +#include "virtpm.h" #include <fcntl.h> #include <sys/stat.h> @@ -6201,6 +6202,37 @@ virQEMUCapsFillDomainDeviceFSCaps(virQEMUCaps *qemuCaps, } +void +virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceTPM *tpm) +{ + tpm->supported = VIR_TRISTATE_BOOL_YES; + tpm->model.report = true; + tpm->backendModel.report = true; + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_TIS); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_CRB)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_CRB); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_SPAPR)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_SPAPR); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->model, VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY); + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_PASSTHROUGH); + if (virTPMHasSwtpm() && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR)) + VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR); + + /* + * Need at least one frontend if it is to be usable by applications + */ + if (!tpm->model.values) + tpm->supported = VIR_TRISTATE_BOOL_NO; +} + + /** * virQEMUCapsSupportsGICVersion: * @qemuCaps: QEMU capabilities @@ -6345,6 +6377,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virDomainCapsDeviceVideo *video = &domCaps->video; virDomainCapsDeviceRNG *rng = &domCaps->rng; virDomainCapsDeviceFilesystem *filesystem = &domCaps->filesystem; + virDomainCapsDeviceTPM *tpm = &domCaps->tpm; virDomainCapsMemoryBacking *memoryBacking = &domCaps->memoryBacking; virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps); @@ -6376,6 +6409,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev); virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng); virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem); + virQEMUCapsFillDomainDeviceTPMCaps(qemuCaps, tpm); virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 61bdbdb2ac..716e09123c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -803,6 +803,9 @@ void virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCaps *qemuCaps, void virQEMUCapsFillDomainDeviceFSCaps(virQEMUCaps *qemuCaps, virDomainCapsDeviceFilesystem *filesystem); +void virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps, + virDomainCapsDeviceTPM *tpm); + bool virQEMUCapsGuestIsNative(virArch host, virArch guest); diff --git a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml index e18b33e044..79d14234fe 100644 --- a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml @@ -170,6 +170,14 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml index 97402b1d4c..fc71f9cc7c 100644 --- a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml @@ -183,6 +183,14 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.11.0.s390x.xml b/tests/domaincapsdata/qemu_2.11.0.s390x.xml index a52e436538..804bf8020e 100644 --- a/tests/domaincapsdata/qemu_2.11.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.11.0.s390x.xml @@ -205,6 +205,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml index 83ebb741cc..44d57900e2 100644 --- a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml @@ -170,6 +170,14 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml index eb876a3748..e9082540b7 100644 --- a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml @@ -185,6 +185,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml index 2c9a7a1c22..1c91661942 100644 --- a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml @@ -195,6 +195,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml index 6407b7ca36..2074c89875 100644 --- a/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-virt.aarch64.xml @@ -155,6 +155,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_2.12.0.aarch64.xml b/tests/domaincapsdata/qemu_2.12.0.aarch64.xml index 27b717318a..a93313f980 100644 --- a/tests/domaincapsdata/qemu_2.12.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.aarch64.xml @@ -153,6 +153,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0.ppc64.xml b/tests/domaincapsdata/qemu_2.12.0.ppc64.xml index 26006d2c08..cb3edcbd56 100644 --- a/tests/domaincapsdata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.ppc64.xml @@ -123,6 +123,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0.s390x.xml b/tests/domaincapsdata/qemu_2.12.0.s390x.xml index f289a4893c..5c3d9ce7db 100644 --- a/tests/domaincapsdata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.12.0.s390x.xml @@ -205,6 +205,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml index 8d9cebe20c..2e5e63308d 100644 --- a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml @@ -185,6 +185,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml index 20b30564f4..ab63745e97 100644 --- a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml @@ -186,6 +186,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml index 45f578183e..119b7020a7 100644 --- a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml @@ -198,6 +198,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.0.0.ppc64.xml b/tests/domaincapsdata/qemu_3.0.0.ppc64.xml index 36fc07f20c..8605db5cc8 100644 --- a/tests/domaincapsdata/qemu_3.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.ppc64.xml @@ -125,6 +125,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.0.0.s390x.xml b/tests/domaincapsdata/qemu_3.0.0.s390x.xml index 2aa34677c0..f49b6907ff 100644 --- a/tests/domaincapsdata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_3.0.0.s390x.xml @@ -212,6 +212,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml index 19595be2b4..087f3608b2 100644 --- a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml @@ -186,6 +186,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml index 62fbd05ccc..5c0cf79efd 100644 --- a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml @@ -189,6 +189,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml index 092a8db6b3..e51dc28f79 100644 --- a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml @@ -201,6 +201,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.1.0.ppc64.xml b/tests/domaincapsdata/qemu_3.1.0.ppc64.xml index a45bbc7fe5..8035f7230a 100644 --- a/tests/domaincapsdata/qemu_3.1.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.ppc64.xml @@ -125,6 +125,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml index 3c4b6d9e00..5b42add078 100644 --- a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml @@ -189,6 +189,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml index ba406ef7fd..5e20814beb 100644 --- a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml @@ -189,6 +189,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml index 72b5c236d2..fa41ed288b 100644 --- a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml @@ -202,6 +202,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml index 5dd21b50dc..7108efe3b4 100644 --- a/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-virt.aarch64.xml @@ -162,6 +162,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_4.0.0.aarch64.xml b/tests/domaincapsdata/qemu_4.0.0.aarch64.xml index fd0543974d..1e7db635d0 100644 --- a/tests/domaincapsdata/qemu_4.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.aarch64.xml @@ -160,6 +160,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0.ppc64.xml b/tests/domaincapsdata/qemu_4.0.0.ppc64.xml index ad1a1a399a..f109d36266 100644 --- a/tests/domaincapsdata/qemu_4.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.ppc64.xml @@ -126,6 +126,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0.s390x.xml b/tests/domaincapsdata/qemu_4.0.0.s390x.xml index ede04824e9..b810ad737a 100644 --- a/tests/domaincapsdata/qemu_4.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.0.0.s390x.xml @@ -222,6 +222,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml index cd086b7e3a..14f0062817 100644 --- a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml @@ -189,6 +189,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml index 233f49a21b..f1446f8655 100644 --- a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml @@ -195,6 +195,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml index 03ebf381d0..77aca157b1 100644 --- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml @@ -204,6 +204,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml index 8806f2d8d6..854d62b89e 100644 --- a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml @@ -195,6 +195,15 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml index 5df0f5f488..739e0c6a13 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -203,6 +203,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml index 2b306b27f3..30de3cede7 100644 --- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml @@ -211,6 +211,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml index 792bac1298..05d606967b 100644 --- a/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-virt.aarch64.xml @@ -164,6 +164,7 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml index 7b6f3a851a..f19ad5e6db 100644 --- a/tests/domaincapsdata/qemu_4.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.aarch64.xml @@ -162,6 +162,7 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml index 728f4e87fc..4c3a2c6d98 100644 --- a/tests/domaincapsdata/qemu_4.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.ppc64.xml @@ -127,6 +127,12 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>spapr-tpm-proxy</value> + </enum> + <enum name='backendModel'/> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsdata/qemu_4.2.0.s390x.xml index f344b289b2..fb162ea578 100644 --- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml @@ -237,6 +237,7 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml index fd8d3a8656..6b8e895ff6 100644 --- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml @@ -203,6 +203,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml index 941d65431e..b0eba3550a 100644 --- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml @@ -205,6 +205,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml index 98511dffd7..fdce0eaaad 100644 --- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml index d673ddfaad..f926e025aa 100644 --- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml @@ -165,6 +165,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml index b879287180..3c842d3642 100644 --- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml @@ -163,6 +163,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml index 14d0bc3eaf..f85f4e6268 100644 --- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml @@ -128,6 +128,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-spapr</value> + <value>spapr-tpm-proxy</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml index 6bab719f7e..4a4893c030 100644 --- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml @@ -205,6 +205,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml index addffcd080..5b4bb4246e 100644 --- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml @@ -206,6 +206,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml index 5a094acbdb..b28f7dd549 100644 --- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.1.0.sparc.xml b/tests/domaincapsdata/qemu_5.1.0.sparc.xml index ddcffd9d44..5c1c0c4680 100644 --- a/tests/domaincapsdata/qemu_5.1.0.sparc.xml +++ b/tests/domaincapsdata/qemu_5.1.0.sparc.xml @@ -104,6 +104,7 @@ <value>handle</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml index 428c6e30e8..1eabdf1a6d 100644 --- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml @@ -206,6 +206,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml index db262241c7..794e1d7b22 100644 --- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml @@ -206,6 +206,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml index 4538cf0dc8..e8ec912cee 100644 --- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml @@ -212,6 +212,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml index fb1118e33e..14d93448e9 100644 --- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml @@ -165,6 +165,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml index b879287180..3c842d3642 100644 --- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml @@ -163,6 +163,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml index 094295ff29..7691d1d762 100644 --- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml @@ -128,6 +128,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-spapr</value> + <value>spapr-tpm-proxy</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsdata/qemu_5.2.0.s390x.xml index c30de65f88..2a2ca8abcf 100644 --- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml @@ -239,6 +239,7 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml index a6a8f0ab43..f6911b06b3 100644 --- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml @@ -206,6 +206,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml index b7ac45c731..d59772cbf6 100644 --- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml @@ -207,6 +207,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml index 6f53b3ea0f..7a0ee26854 100644 --- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml @@ -213,6 +213,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml index 7a52cce114..ca66634456 100644 --- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml @@ -166,6 +166,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml index c51e361c7f..7c2d0c6120 100644 --- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml @@ -164,6 +164,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsdata/qemu_6.0.0.s390x.xml index d6d8262a34..13fa3a637e 100644 --- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml @@ -240,6 +240,7 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='no'/> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml index 71aefb5bff..3255765c75 100644 --- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml @@ -207,6 +207,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml index bae2187aa2..86fdf9b884 100644 --- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml @@ -208,6 +208,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml index a9b4011557..034273c847 100644 --- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml @@ -213,6 +213,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml index 5a261f2d0e..4a943c4f36 100644 --- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml @@ -208,6 +208,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml index df8bdae102..52819a9532 100644 --- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml @@ -208,6 +208,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml index 4d12105659..7d14e53255 100644 --- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml @@ -214,6 +214,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml index 8b590fd40d..665f7e568f 100644 --- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml @@ -168,6 +168,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml index 496b910336..e1005392e1 100644 --- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml @@ -166,6 +166,14 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml index 93c901816e..720d6ad885 100644 --- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml @@ -126,6 +126,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-spapr</value> + <value>spapr-tpm-proxy</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml index c382ec462c..beb473cd73 100644 --- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml @@ -208,6 +208,15 @@ <value>virtiofs</value> </enum> </filesystem> + <tpm supported='yes'> + <enum name='model'> + <value>tpm-tis</value> + <value>tpm-crb</value> + </enum> + <enum name='backendModel'> + <value>passthrough</value> + </enum> + </tpm> </devices> <features> <gic supported='no'/> -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
This reports what TPM features QEMU supports, provided that swtpm is installed in the host.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu_capabilities.c | 34 +++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 ++ .../domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 8 +++++ .../qemu_6.2.0-virt.aarch64.xml | 8 +++++
[..]
tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 8 +++++ tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 9 +++++ tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 9 +++++ 71 files changed, 500 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The domain capabilities won't report TPM support unless SWTPM can be initialized. To avoid relying on the swtpm install in the host, mock the entire initialization method, since all it needs todo is return a non-error value. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.12.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_3.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + tests/domaincapstest.c | 9 +++++++++ 51 files changed, 59 insertions(+) diff --git a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml index 79d14234fe..ea9737d9ce 100644 --- a/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml @@ -176,6 +176,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml index fc71f9cc7c..cccc6830f9 100644 --- a/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml @@ -189,6 +189,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml index 44d57900e2..3a8aa2ab71 100644 --- a/tests/domaincapsdata/qemu_2.11.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.11.0.x86_64.xml @@ -176,6 +176,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml index e9082540b7..9f41dfaf2b 100644 --- a/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-q35.x86_64.xml @@ -192,6 +192,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml index 1c91661942..d5f9d8ebe3 100644 --- a/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0-tcg.x86_64.xml @@ -202,6 +202,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml index 2e5e63308d..dc2c3ec4dd 100644 --- a/tests/domaincapsdata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_2.12.0.x86_64.xml @@ -192,6 +192,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml index ab63745e97..4f80439eb4 100644 --- a/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-q35.x86_64.xml @@ -193,6 +193,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml index 119b7020a7..301101095c 100644 --- a/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0-tcg.x86_64.xml @@ -205,6 +205,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml index 087f3608b2..650728566e 100644 --- a/tests/domaincapsdata/qemu_3.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.0.0.x86_64.xml @@ -193,6 +193,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml index 5c0cf79efd..c4277c53a1 100644 --- a/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-q35.x86_64.xml @@ -196,6 +196,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml index e51dc28f79..1a5bc25b99 100644 --- a/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0-tcg.x86_64.xml @@ -208,6 +208,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml index 5b42add078..6e3ddda356 100644 --- a/tests/domaincapsdata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_3.1.0.x86_64.xml @@ -196,6 +196,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml index 5e20814beb..8f3911b4b3 100644 --- a/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-q35.x86_64.xml @@ -196,6 +196,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml index fa41ed288b..e744ac27ac 100644 --- a/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0-tcg.x86_64.xml @@ -209,6 +209,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml index 14f0062817..24e732d9c3 100644 --- a/tests/domaincapsdata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.0.0.x86_64.xml @@ -196,6 +196,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml index f1446f8655..3ee7feea48 100644 --- a/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-q35.x86_64.xml @@ -202,6 +202,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml index 77aca157b1..80b1ce8ef9 100644 --- a/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0-tcg.x86_64.xml @@ -211,6 +211,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml index 854d62b89e..0f1d398e2c 100644 --- a/tests/domaincapsdata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.1.0.x86_64.xml @@ -202,6 +202,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml index 739e0c6a13..c8a77cdd41 100644 --- a/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-q35.x86_64.xml @@ -210,6 +210,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml index 30de3cede7..91b3ed6f80 100644 --- a/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0-tcg.x86_64.xml @@ -218,6 +218,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml index 6b8e895ff6..6578fd04b6 100644 --- a/tests/domaincapsdata/qemu_4.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_4.2.0.x86_64.xml @@ -210,6 +210,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml index b0eba3550a..8a6797c2f1 100644 --- a/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-q35.x86_64.xml @@ -212,6 +212,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml index fdce0eaaad..b8737613e9 100644 --- a/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml index f926e025aa..f8cea230d9 100644 --- a/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0-virt.aarch64.xml @@ -171,6 +171,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml index 3c842d3642..ab72b7ffeb 100644 --- a/tests/domaincapsdata/qemu_5.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.aarch64.xml @@ -169,6 +169,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml index f85f4e6268..5772045e35 100644 --- a/tests/domaincapsdata/qemu_5.0.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.ppc64.xml @@ -135,6 +135,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml index 4a4893c030..51ca1d98e0 100644 --- a/tests/domaincapsdata/qemu_5.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.0.0.x86_64.xml @@ -212,6 +212,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml index 5b4bb4246e..3468fb2e72 100644 --- a/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-q35.x86_64.xml @@ -213,6 +213,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml index b28f7dd549..034036ca96 100644 --- a/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml index 1eabdf1a6d..8ff49c7899 100644 --- a/tests/domaincapsdata/qemu_5.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.1.0.x86_64.xml @@ -213,6 +213,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml index 794e1d7b22..2301a475eb 100644 --- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml @@ -213,6 +213,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml index e8ec912cee..d3a4b01234 100644 --- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml @@ -219,6 +219,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml index 14d93448e9..a863a6052d 100644 --- a/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-virt.aarch64.xml @@ -171,6 +171,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml index 3c842d3642..ab72b7ffeb 100644 --- a/tests/domaincapsdata/qemu_5.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.aarch64.xml @@ -169,6 +169,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml index 7691d1d762..051b7d43a8 100644 --- a/tests/domaincapsdata/qemu_5.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.ppc64.xml @@ -135,6 +135,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml index f6911b06b3..41a54985d7 100644 --- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml @@ -213,6 +213,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml index d59772cbf6..90acb29775 100644 --- a/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-q35.x86_64.xml @@ -214,6 +214,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml index 7a0ee26854..768cba5a41 100644 --- a/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-tcg.x86_64.xml @@ -220,6 +220,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml index ca66634456..61eab9de0e 100644 --- a/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0-virt.aarch64.xml @@ -172,6 +172,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml index 7c2d0c6120..fa722b5fd3 100644 --- a/tests/domaincapsdata/qemu_6.0.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.aarch64.xml @@ -170,6 +170,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml index 3255765c75..7a95c530f9 100644 --- a/tests/domaincapsdata/qemu_6.0.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.0.0.x86_64.xml @@ -214,6 +214,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml index 86fdf9b884..f4d0fcf673 100644 --- a/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-q35.x86_64.xml @@ -215,6 +215,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml index 034273c847..2c761fc1af 100644 --- a/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0-tcg.x86_64.xml @@ -220,6 +220,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml index 4a943c4f36..67fc449f5d 100644 --- a/tests/domaincapsdata/qemu_6.1.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.1.0.x86_64.xml @@ -215,6 +215,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml index 52819a9532..9d68c0a404 100644 --- a/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-q35.x86_64.xml @@ -215,6 +215,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml index 7d14e53255..8db840faac 100644 --- a/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-tcg.x86_64.xml @@ -221,6 +221,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml index 665f7e568f..f6045623f5 100644 --- a/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml @@ -174,6 +174,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml index e1005392e1..35e18adcd5 100644 --- a/tests/domaincapsdata/qemu_6.2.0.aarch64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.aarch64.xml @@ -172,6 +172,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml index 720d6ad885..8fed9d30b7 100644 --- a/tests/domaincapsdata/qemu_6.2.0.ppc64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.ppc64.xml @@ -133,6 +133,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml index beb473cd73..0f89790b60 100644 --- a/tests/domaincapsdata/qemu_6.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_6.2.0.x86_64.xml @@ -215,6 +215,7 @@ </enum> <enum name='backendModel'> <value>passthrough</value> + <value>emulator</value> </enum> </tpm> </devices> diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 4a46acb9ad..479bcb1c35 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -22,6 +22,7 @@ #include "domain_capabilities.h" #include "virfilewrapper.h" #include "configmake.h" +#include "virtpm.h" #define VIR_FROM_THIS VIR_FROM_NONE @@ -126,6 +127,14 @@ fillQemuCaps(virDomainCaps *domCaps, return 0; } + + +/* Enough to tell capabilities code that swtpm is usable */ +bool virTPMHasSwtpm(void) +{ + return true; +} + #endif /* WITH_QEMU */ -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The domain capabilities won't report TPM support unless SWTPM can be initialized. To avoid relying on the swtpm install in the host, mock the entire initialization method, since all it needs todo is return a non-error value.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- tests/domaincapsdata/qemu_2.11.0-q35.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0-tcg.x86_64.xml | 1 + tests/domaincapsdata/qemu_2.11.0.x86_64.xml | 1 +
[..]
tests/domaincapsdata/qemu_6.2.0-virt.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 1 + tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 1 + tests/domaincapstest.c | 9 +++++++++ 51 files changed, 59 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

The run script tries to detect when a daemon is being run in order to shutdown other systemd unit files that clash. As implemented this only works if the daemon name is the first argument. This won't be the case if running via GDB or strace eg ./run strace -e trace=openat ./build/src/virtqemud We need to check all argv to find which might be a daemon path/name. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- run.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/run.in b/run.in index 64f99751fe..174b191675 100644 --- a/run.in +++ b/run.in @@ -130,18 +130,18 @@ def change_unit(name, action): try_stop_units = [] if is_systemd_host(): - name = os.path.basename(prog) - maybe_stopped_units = [] - if is_modular_daemon(name): - # Only need to stop libvirtd or this specific modular unit - maybe_stopped_units += daemon_units("libvirtd") - maybe_stopped_units += daemon_units(name) - elif is_monolithic_daemon(name): - # Need to stop libvirtd and/or all modular units - maybe_stopped_units += daemon_units("libvirtd") - for entry in modular_daemons: - maybe_stopped_units += daemon_units(entry) + for arg in sys.argv: + name = os.path.basename(arg) + if is_modular_daemon(name): + # Only need to stop libvirtd or this specific modular unit + maybe_stopped_units += daemon_units("libvirtd") + maybe_stopped_units += daemon_units(name) + elif is_monolithic_daemon(name): + # Need to stop libvirtd and/or all modular units + maybe_stopped_units += daemon_units("libvirtd") + for entry in modular_daemons: + maybe_stopped_units += daemon_units(entry) for unit in maybe_stopped_units: if is_unit_active(unit): -- 2.33.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The run script tries to detect when a daemon is being run in order to shutdown other systemd unit files that clash. As implemented this only works if the daemon name is the first argument. This won't be the case if running via GDB or strace eg
./run strace -e trace=openat ./build/src/virtqemud
We need to check all argv to find which might be a daemon path/name.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- run.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Daniel P. Berrangé
-
Ján Tomko