qemu: Implement chardev source setup for tpm

Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for TPM devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-08 10:07:44 +01:00
parent 9a89ec8997
commit 5c62df7e78
3 changed files with 21 additions and 1 deletions

View File

@ -11530,6 +11530,19 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainDeviceDef *dev,
return cb(dev, dev->data.rng->source.chardev, opaque);
case VIR_DOMAIN_DEVICE_TPM:
switch ((virDomainTPMBackendType) dev->data.tpm->type) {
case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
return cb(dev, dev->data.tpm->data.passthrough.source, opaque);
case VIR_DOMAIN_TPM_TYPE_EMULATOR:
return cb(dev, dev->data.tpm->data.emulator.source, opaque);
case VIR_DOMAIN_TPM_TYPE_LAST:
return 0;
}
return 0;
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
@ -11543,7 +11556,6 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_NONE:
case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
case VIR_DOMAIN_DEVICE_LAST:
case VIR_DOMAIN_DEVICE_MEMORY:

View File

@ -6891,6 +6891,10 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
* vhost-sockets for network devices */
return 0;
}
/* TPMs FD passing setup is special and handled separately */
if (dev->type == VIR_DOMAIN_DEVICE_TPM)
return 0;
}
switch ((virDomainChrType) chardev->type) {

View File

@ -394,6 +394,10 @@ testPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
* vhost-sockets for network devices */
return 0;
}
/* TPMs FD passing setup is special and handled separately */
if (dev->type == VIR_DOMAIN_DEVICE_TPM)
return 0;
}
switch ((virDomainChrType) chardev->type) {