Re: [PATCH 1/5] conf: Add support for tpm-spapr to domain XML

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

 



On 2/2/20 9:12 AM, Ján Tomko wrote:
On Fri, Jan 31, 2020 at 04:17:39PM -0500, Stefan Berger wrote:

@@ -13242,7 +13243,8 @@ static virDomainTPMDefPtr
virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
                        xmlNodePtr node,
                        xmlXPathContextPtr ctxt,
-                        unsigned int flags)
+                        unsigned int flags,
+                        virArch arch)
{
    virDomainTPMDefPtr def;
    VIR_XPATH_NODE_AUTORESTORE(ctxt);
@@ -13258,11 +13260,17 @@ virDomainTPMDefParseXML(virDomainXMLOptionPtr xmlopt,
        return NULL;

    model = virXMLPropString(node, "model");
-    if (model != NULL &&
-        (def->model = virDomainTPMModelTypeFromString(model)) < 0) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+    if (model != NULL) {
+        if ((def->model = virDomainTPMModelTypeFromString(model)) < 0) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                       _("Unknown TPM frontend model '%s'"), model);
-        goto error;
+            goto error;
+        }
+    } else {
+        if (ARCH_IS_PPC64(arch))
+            def->model = VIR_DOMAIN_TPM_MODEL_SPAPR;
+        else
+            def->model = VIR_DOMAIN_TPM_MODEL_TIS;
    }

Default models should be set in qemuDomainDeviceDefPostParse.
(that might require a new VIR_DOMAIN_TPM_MODEL_DEFAULT, since so far we
 relied on VIR_DOMAIN_TPM_MODEL_TIS having the value of 0)
The parser should just translate XML into libvirt structs.


Fixed in v2.



    ctxt->node = node;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d3045b4bcd..ace611909d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7756,9 +7756,10 @@ qemuDomainDeviceDefValidateTPM(virDomainTPMDef *tpm,

    switch (tpm->version) {
    case VIR_DOMAIN_TPM_VERSION_1_2:
-        /* only TIS available for emulator */
+        /* only TIS available for emulator (non-ppc64 case) */
        if (tpm->type == VIR_DOMAIN_TPM_TYPE_EMULATOR &&
-            tpm->model != VIR_DOMAIN_TPM_MODEL_TIS) {
+            tpm->model != VIR_DOMAIN_TPM_MODEL_TIS &&

+ !ARCH_IS_PPC64(def->os.arch)) {

  tpm->model != VIR_DOMAIN_TPM_MODEL_SPAPR

no need to mention the architecture here.

Alternatively, are the comment and the condition just trying to say
1.2 + tpm-crb + emulator do not mix?


Right, it's TPM 1.2 + tpm-crb that do not work. TPM 1.2 + tpm-tis or TPM 1.2 + tpm-spapr work fine. Will repost soon with one additional patch added to the front that introduces the default model that immediately gets adjusted to TIS (as previous) on non-ppc64 and tpm-spapr for ppc64 IF the user didn't provide a model.


   Stefam



That might be shorter to write.

Jano

virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                           _("Unsupported interface %s for TPM 1.2"),
virDomainTPMModelTypeToString(tpm->model));
@@ -7793,6 +7794,7 @@ qemuDomainDeviceDefValidateTPM(virDomainTPMDef *tpm,
    case VIR_DOMAIN_TPM_MODEL_CRB:
        flag = QEMU_CAPS_DEVICE_TPM_CRB;
        break;
+    case VIR_DOMAIN_TPM_MODEL_SPAPR:
    case VIR_DOMAIN_TPM_MODEL_LAST:
    default:
        virReportEnumRangeError(virDomainTPMModel, tpm->model);
--
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