提交 9577d86f 编写于 作者: D Daniel Henrique Barboza 提交者: Ján Tomko

qemu: build command line for the TPM Proxy device

This patch wraps it up all the wiring done in previous patches,
enabling a PPC64 guest to launch a guest using a TPM Proxy
device.

Note that device validation is already being done in qemu_validate.c,
qemuValidateDomainDeviceDefTPM(), on domain define time. We don't
need to verify QEMU capabilities for this device again inside
qemu_command.c.
Tested-by: NSatheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Reviewed-by: NStefan Berger <stefanb@linux.ibm.com>
Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 badbd55a
...@@ -9103,6 +9103,26 @@ qemuBuildTPMCommandLine(virCommandPtr cmd, ...@@ -9103,6 +9103,26 @@ qemuBuildTPMCommandLine(virCommandPtr cmd,
} }
static int
qemuBuildTPMProxyCommandLine(virCommandPtr cmd,
virDomainTPMDefPtr tpm)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
const char *filePath = NULL;
filePath = tpm->data.passthrough.source.data.file.path;
virCommandAddArg(cmd, "-device");
virBufferAsprintf(&buf, "%s,id=%s,host-path=",
virDomainTPMModelTypeToString(tpm->model),
tpm->info.alias);
virQEMUBuildBufferEscapeComma(&buf, filePath);
virCommandAddArgBuffer(cmd, &buf);
return 0;
}
static int static int
qemuBuildTPMsCommandLine(virCommandPtr cmd, qemuBuildTPMsCommandLine(virCommandPtr cmd,
const virDomainDef *def, const virDomainDef *def,
...@@ -9111,8 +9131,13 @@ qemuBuildTPMsCommandLine(virCommandPtr cmd, ...@@ -9111,8 +9131,13 @@ qemuBuildTPMsCommandLine(virCommandPtr cmd,
size_t i; size_t i;
for (i = 0; i < def->ntpms; i++) { for (i = 0; i < def->ntpms; i++) {
if (qemuBuildTPMCommandLine(cmd, def, def->tpms[i], qemuCaps) < 0) if (def->tpms[i]->model == VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) {
if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i]) < 0)
return -1;
} else if (qemuBuildTPMCommandLine(cmd, def,
def->tpms[i], qemuCaps) < 0) {
return -1; return -1;
}
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册