src/conf/domain_conf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
From: Stefan Berger <stefanb@linux.ibm.com>
The firmware (SLOF) on QEMU for ppc64 does not support TPM 1.2, so
prevent the choice of TPM 1.2 when the SPAPR device model is chosen
and use a default of '2.0' (TPM 2) for the emulator.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
src/conf/domain_conf.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2f4528d336..749d135f96 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13633,7 +13633,10 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
version = virXMLPropString(backends[0], "version");
if (!version) {
- def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT;
+ if (def->model == VIR_DOMAIN_TPM_MODEL_SPAPR)
+ def->version = VIR_DOMAIN_TPM_VERSION_2_0;
+ else
+ def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT;
} else {
if ((def->version = virDomainTPMVersionTypeFromString(version)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -13641,6 +13644,12 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
version);
goto error;
}
+ if (def->version == VIR_DOMAIN_TPM_VERSION_1_2 &&
+ def->model == VIR_DOMAIN_TPM_MODEL_SPAPR) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("TPM 1.2 is not supported with the SPAPR device model"));
+ goto error;
+ }
}
switch (def->type) {
--
2.17.1
On Wed, Jul 08, 2020 at 09:30:50 -0400, Stefan Berger wrote: > From: Stefan Berger <stefanb@linux.ibm.com> > > The firmware (SLOF) on QEMU for ppc64 does not support TPM 1.2, so > prevent the choice of TPM 1.2 when the SPAPR device model is chosen > and use a default of '2.0' (TPM 2) for the emulator. > > Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> > --- > src/conf/domain_conf.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) This kind of logic doesn't belong into the XML parser but rather to the post parse callback/infrastructure where defaults should be filled in.
On 7/8/20 9:38 AM, Peter Krempa wrote: > On Wed, Jul 08, 2020 at 09:30:50 -0400, Stefan Berger wrote: >> From: Stefan Berger <stefanb@linux.ibm.com> >> >> The firmware (SLOF) on QEMU for ppc64 does not support TPM 1.2, so >> prevent the choice of TPM 1.2 when the SPAPR device model is chosen >> and use a default of '2.0' (TPM 2) for the emulator. >> >> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> >> --- >> src/conf/domain_conf.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) > This kind of logic doesn't belong into the XML parser but rather to the > post parse callback/infrastructure where defaults should be filled in. > > @ -13633,7 +13633,10 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt, > > version = virXMLPropString(backends[0], "version"); > if (!version) { > - def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT; > + if (def->model == VIR_DOMAIN_TPM_MODEL_SPAPR) > + def->version = VIR_DOMAIN_TPM_VERSION_2_0; > + else > + def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT; > } else { > if ((def->version = virDomainTPMVersionTypeFromString(version)) < 0) { > virReportError(VIR_ERR_CONFIG_UNSUPPORTED, In that case we wouldn't be able to choose a different default for SPAPR since it's already been filled in with the default for all the other platforms. We can do the check for the unsupported part there, though.
On 7/8/20 9:46 AM, Stefan Berger wrote: > On 7/8/20 9:38 AM, Peter Krempa wrote: >> On Wed, Jul 08, 2020 at 09:30:50 -0400, Stefan Berger wrote: >>> From: Stefan Berger <stefanb@linux.ibm.com> >>> >>> The firmware (SLOF) on QEMU for ppc64 does not support TPM 1.2, so >>> prevent the choice of TPM 1.2 when the SPAPR device model is chosen >>> and use a default of '2.0' (TPM 2) for the emulator. >>> >>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> >>> --- >>> src/conf/domain_conf.c | 11 ++++++++++- >>> 1 file changed, 10 insertions(+), 1 deletion(-) >> This kind of logic doesn't belong into the XML parser but rather to the >> post parse callback/infrastructure where defaults should be filled in. >> >> @ -13633,7 +13633,10 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr >> xmlopt, >> version = virXMLPropString(backends[0], "version"); >> if (!version) { >> - def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT; >> + if (def->model == VIR_DOMAIN_TPM_MODEL_SPAPR) >> + def->version = VIR_DOMAIN_TPM_VERSION_2_0; >> + else >> + def->version = VIR_DOMAIN_TPM_VERSION_DEFAULT; >> } else { >> if ((def->version = >> virDomainTPMVersionTypeFromString(version)) < 0) { >> virReportError(VIR_ERR_CONFIG_UNSUPPORTED, > In that case we wouldn't be able to choose a different default for > SPAPR since it's already been filled in with the default for all the > other platforms. We can do the check for the unsupported part there, > though. > > > Wrong, we can do this.
© 2016 - 2024 Red Hat, Inc.