diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 72b6d15852c2de2d1f204a2134d79079c3524e8f..1bffa97cc5030ac47574f0c928bd25fd7ee859db 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6833,36 +6833,6 @@ qemuBuildRNGDevStr(virDomainDefPtr def, } -static char *qemuBuildTPMDevStr(const virDomainDef *def, - virQEMUCapsPtr qemuCaps, - const char *emulator) -{ - virBuffer buf = VIR_BUFFER_INITIALIZER; - const virDomainTPMDef *tpm = def->tpm; - const char *model = virDomainTPMModelTypeToString(tpm->model); - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The QEMU executable %s does not support TPM " - "model %s"), - emulator, model); - goto error; - } - - virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s", - model, tpm->info.alias, tpm->info.alias); - - if (virBufferCheckError(&buf) < 0) - goto error; - - return virBufferContentAndReset(&buf); - - error: - virBufferFreeAndReset(&buf); - return NULL; -} - - static char *qemuBuildSmbiosBiosStr(virSysinfoBIOSDefPtr def) { virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -8909,6 +8879,37 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, } +static char * +qemuBuildTPMDevStr(const virDomainDef *def, + virQEMUCapsPtr qemuCaps, + const char *emulator) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + const virDomainTPMDef *tpm = def->tpm; + const char *model = virDomainTPMModelTypeToString(tpm->model); + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The QEMU executable %s does not support TPM " + "model %s"), + emulator, model); + goto error; + } + + virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s", + model, tpm->info.alias, tpm->info.alias); + + if (virBufferCheckError(&buf) < 0) + goto error; + + return virBufferContentAndReset(&buf); + + error: + virBufferFreeAndReset(&buf); + return NULL; +} + + /** * qemuVirCommandGetFDSet: * @cmd: the command to modify