From nobody Sun Feb 8 14:53:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1580505521988156.2664279727818; Fri, 31 Jan 2020 13:18:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-kQ72NY04OnqkqfAsDmuaNg-1; Fri, 31 Jan 2020 16:18:37 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19F1D18C43DB; Fri, 31 Jan 2020 21:18:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AE9510840F5; Fri, 31 Jan 2020 21:18:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A7A4818089C8; Fri, 31 Jan 2020 21:18:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00VLHpWO031411 for ; Fri, 31 Jan 2020 16:17:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F5B81005E2E; Fri, 31 Jan 2020 21:17:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 984001005E3A for ; Fri, 31 Jan 2020 21:17:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A746D800180 for ; Fri, 31 Jan 2020 21:17:49 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403--RkLGSMzNP-5FA3FnUygwQ-1; Fri, 31 Jan 2020 16:17:46 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00VL74qP121700; Fri, 31 Jan 2020 16:17:46 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xvtxwsx5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jan 2020 16:17:46 -0500 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 00VL8CPk124434; Fri, 31 Jan 2020 16:17:45 -0500 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xvtxwsx5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jan 2020 16:17:45 -0500 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 00VL60rT013430; Fri, 31 Jan 2020 21:17:45 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma01wdc.us.ibm.com with ESMTP id 2xrda6yndd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jan 2020 21:17:45 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00VLHi3u53870898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 Jan 2020 21:17:44 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C34F2124052; Fri, 31 Jan 2020 21:17:44 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB975124054; Fri, 31 Jan 2020 21:17:44 +0000 (GMT) Received: from newfield.pok.ibm.com (unknown [9.47.158.66]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 31 Jan 2020 21:17:44 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580505520; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JJIveM0PhLPCKwCJCKgwjIGCtIoqiLoyerTeNkGvG7Q=; b=Mv9+E7soK36ENnk/GIv3zKh+9WO+FLJQ04LERXzlIhyFXmwKmg6VG1+QvTL5G/tzzMI67a pNQpGBZ/WfQMsqAGlZnA2Yljl922p7dZmO6kio22SSZt0M0+uX0MSWOCyUeybGRMBfBKIa yPcyzoihywoXogsJtJgQIf4w+OsE53E= From: Stefan Berger To: libvir-list@redhat.com Subject: [PATCH 1/5] conf: Add support for tpm-spapr to domain XML Date: Fri, 31 Jan 2020 16:17:39 -0500 Message-Id: <20200131211743.121606-2-stefanb@linux.ibm.com> In-Reply-To: <20200131211743.121606-1-stefanb@linux.ibm.com> References: <20200131211743.121606-1-stefanb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-01-31_06:2020-01-31, 2020-01-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=43 phishscore=0 impostorscore=0 mlxscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1911200001 definitions=main-2001310173 X-MC-Unique: -RkLGSMzNP-5FA3FnUygwQ-1 X-MC-Unique: kQ72NY04OnqkqfAsDmuaNg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 00VLHpWO031411 X-loop: libvir-list@redhat.com Cc: aik@ozlabs.ru, marcandre.lureau@redhat.com, david@gibson.dropbear.id.au X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Berger This patch adds support for the tpm-spapr device model for ppc64. The XML f= or this type of TPM looks as follows: Extend the documentation. Signed-off-by: Stefan Berger --- docs/formatdomain.html.in | 4 +++- docs/schemas/domaincommon.rng | 4 ++++ src/conf/domain_conf.c | 24 +++++++++++++++++------- src/conf/domain_conf.h | 1 + src/qemu/qemu_domain.c | 6 ++++-- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 60a103d7c6..5a9835fbfe 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8508,7 +8508,9 @@ qemu-kvm -net nic,model=3D? /dev/null

The model attribute specifies what device model QEMU provides to the guest. If no model name is provided, - tpm-tis will automatically be chosen. + tpm-tis will automatically be chosen for non-ppc64 + architectures. For ppc64/pseries guests, tpm-spapr + is the default. Since 4.4.0, another available choi= ce is the tpm-crb, which should only be used when the backend device is a TPM 2.0. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ea237a05e5..9577d26c2a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4383,6 +4383,7 @@ tpm-tis tpm-crb + tpm-spapr @@ -4390,6 +4391,9 @@ + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9b60db7ecd..a55be400fc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1127,6 +1127,7 @@ VIR_ENUM_IMPL(virDomainTPMModel, VIR_DOMAIN_TPM_MODEL_LAST, "tpm-tis", "tpm-crb", + "tpm-spapr", ); =20 VIR_ENUM_IMPL(virDomainTPMBackend, @@ -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 xml= opt, return NULL; =20 model =3D virXMLPropString(node, "model"); - if (model !=3D NULL && - (def->model =3D virDomainTPMModelTypeFromString(model)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + if (model !=3D NULL) { + if ((def->model =3D 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 =3D VIR_DOMAIN_TPM_MODEL_SPAPR; + else + def->model =3D VIR_DOMAIN_TPM_MODEL_TIS; } =20 ctxt->node =3D node; @@ -16639,7 +16647,8 @@ virDomainDeviceDefParse(const char *xmlStr, return NULL; break; case VIR_DOMAIN_DEVICE_TPM: - if (!(dev->data.tpm =3D virDomainTPMDefParseXML(xmlopt, node, ctxt= , flags))) + if (!(dev->data.tpm =3D virDomainTPMDefParseXML(xmlopt, node, ctxt= , flags, + def->os.arch))) return NULL; break; case VIR_DOMAIN_DEVICE_PANIC: @@ -21464,7 +21473,8 @@ virDomainDefParseXML(xmlDocPtr xml, } =20 if (n > 0) { - if (!(def->tpm =3D virDomainTPMDefParseXML(xmlopt, nodes[0], ctxt,= flags))) + if (!(def->tpm =3D virDomainTPMDefParseXML(xmlopt, nodes[0], ctxt,= flags, + def->os.arch))) goto error; } VIR_FREE(nodes); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e144f3aad3..19732fcfc9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1254,6 +1254,7 @@ struct _virDomainHubDef { typedef enum { VIR_DOMAIN_TPM_MODEL_TIS, VIR_DOMAIN_TPM_MODEL_CRB, + VIR_DOMAIN_TPM_MODEL_SPAPR, =20 VIR_DOMAIN_TPM_MODEL_LAST } virDomainTPMModel; 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, =20 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 =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR && - tpm->model !=3D VIR_DOMAIN_TPM_MODEL_TIS) { + tpm->model !=3D VIR_DOMAIN_TPM_MODEL_TIS && + !ARCH_IS_PPC64(def->os.arch)) { 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 =3D QEMU_CAPS_DEVICE_TPM_CRB; break; + case VIR_DOMAIN_TPM_MODEL_SPAPR: case VIR_DOMAIN_TPM_MODEL_LAST: default: virReportEnumRangeError(virDomainTPMModel, tpm->model); --=20 2.17.1