[PATCH 23/24] qemu: Implement chardev source setup for tpm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c   | 14 +++++++++++++-
 src/qemu/qemu_process.c  |  4 ++++
 tests/qemuxml2argvtest.c |  4 ++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 475f2f536e..5607d6f581 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ed0b80be0b..a8a8c4c54b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6895,6 +6895,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) {
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ac4b532ef1..615f45376c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -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) {
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux