[PATCH v2 1/6] conf: Introduce VIR_DOMAIN_TPM_MODEL_DEFAULT as default model

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

 



Introduce VIR_DOMAIN_TPM_MODEL_DEFAULT as a default model which we use
in case the user does not provide a model in the device XML. It has
the TIS's previous value of '0'. In the post parsing function
we change this default value to 'TIS' to have the same model as before.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
---
 src/conf/domain_conf.c |  1 +
 src/conf/domain_conf.h |  1 +
 src/qemu/qemu_domain.c | 14 +++++++++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9b60db7ecd..79aa3e3699 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1125,6 +1125,7 @@ VIR_ENUM_IMPL(virDomainRNGBackend,
 
 VIR_ENUM_IMPL(virDomainTPMModel,
               VIR_DOMAIN_TPM_MODEL_LAST,
+              "default",
               "tpm-tis",
               "tpm-crb",
 );
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e144f3aad3..8b4b0b467a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1252,6 +1252,7 @@ struct _virDomainHubDef {
 };
 
 typedef enum {
+    VIR_DOMAIN_TPM_MODEL_DEFAULT,
     VIR_DOMAIN_TPM_MODEL_TIS,
     VIR_DOMAIN_TPM_MODEL_CRB,
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d3045b4bcd..46fd44bbec 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9031,6 +9031,15 @@ qemuDomainHostdevDefPostParse(virDomainHostdevDefPtr hostdev,
 }
 
 
+static int
+qemuDomainTPMDefPostParse(virDomainTPMDefPtr tpm)
+{
+    if (tpm->model == VIR_DOMAIN_TPM_MODEL_DEFAULT)
+        tpm->model = VIR_DOMAIN_TPM_MODEL_TIS;
+    return 0;
+}
+
+
 static int
 qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
                              const virDomainDef *def,
@@ -9084,6 +9093,10 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         ret = qemuDomainHostdevDefPostParse(dev->data.hostdev, qemuCaps);
         break;
 
+    case VIR_DOMAIN_DEVICE_TPM:
+        ret = qemuDomainTPMDefPostParse(dev->data.tpm);
+        break;
+
     case VIR_DOMAIN_DEVICE_LEASE:
     case VIR_DOMAIN_DEVICE_FS:
     case VIR_DOMAIN_DEVICE_INPUT:
@@ -9096,7 +9109,6 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
     case VIR_DOMAIN_DEVICE_MEMBALLOON:
     case VIR_DOMAIN_DEVICE_NVRAM:
     case VIR_DOMAIN_DEVICE_RNG:
-    case VIR_DOMAIN_DEVICE_TPM:
     case VIR_DOMAIN_DEVICE_MEMORY:
     case VIR_DOMAIN_DEVICE_IOMMU:
         ret = 0;
-- 
2.17.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