conf: Introduce VIR_DOMAIN_TPM_MODEL_DEFAULT as default model

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@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Stefan Berger 2020-02-05 13:35:45 -05:00 committed by Ján Tomko
parent 945648d36a
commit 21b6f41d95
3 changed files with 15 additions and 1 deletions

View File

@ -1125,6 +1125,7 @@ VIR_ENUM_IMPL(virDomainRNGBackend,
VIR_ENUM_IMPL(virDomainTPMModel,
VIR_DOMAIN_TPM_MODEL_LAST,
"default",
"tpm-tis",
"tpm-crb",
);

View File

@ -1252,6 +1252,7 @@ struct _virDomainHubDef {
};
typedef enum {
VIR_DOMAIN_TPM_MODEL_DEFAULT,
VIR_DOMAIN_TPM_MODEL_TIS,
VIR_DOMAIN_TPM_MODEL_CRB,

View File

@ -9035,6 +9035,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,
@ -9088,6 +9097,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:
@ -9100,7 +9113,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;