From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1625777883136954.115106120264; Thu, 8 Jul 2021 13:58:03 -0700 (PDT) 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-120-8_bjzBVWOTKwU_p1hRdmug-1; Thu, 08 Jul 2021 16:58:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4DD7A824F8C; Thu, 8 Jul 2021 20:57:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C9C760CC9; Thu, 8 Jul 2021 20:57:55 +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 EE5E64EA3E; Thu, 8 Jul 2021 20:57:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168Kvfti014100 for ; Thu, 8 Jul 2021 16:57:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED9BF2084824; Thu, 8 Jul 2021 20:57:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7A69208D042 for ; Thu, 8 Jul 2021 20:57:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 878D58037A4 for ; Thu, 8 Jul 2021 20:57:37 +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-374-2WE6Q7EdMeipWids2UIbHw-1; Thu, 08 Jul 2021 16:57:33 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KXnoP192451; Thu, 8 Jul 2021 16:57:32 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nwn0pjvp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:32 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KZFF5002293; Thu, 8 Jul 2021 16:57:32 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nwn0pjv9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:32 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168Kn7Vu012485; Thu, 8 Jul 2021 20:57:30 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 39jfh8tcdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KvRoJ32113058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:57:27 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3776E4C04A; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2EF94C059; Thu, 8 Jul 2021 20:57:26 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:26 +0000 (GMT) X-MC-Unique: 8_bjzBVWOTKwU_p1hRdmug-1 X-MC-Unique: 2WE6Q7EdMeipWids2UIbHw-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 1/8] schemas: Make SEV policy on launch security optional Date: Thu, 8 Jul 2021 22:57:17 +0200 Message-Id: <20210708205724.14643-2-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: tBiB-GjAidfyc5UKDT1dl_431OfzrzU1 X-Proofpoint-ORIG-GUID: CrHV5fbzOTybs3hGAfNpd7HYk1VrOp5c X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_11:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777884140100001 Content-Type: text/plain; charset="utf-8" Change launch security policy of type SEV from required to optional and add a test to ensure the required launch security policy remains required when launch security type is SEV. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza Reviewed-by: Pavel Hrdina --- docs/schemas/domaincommon.rng | 12 ++++--- src/conf/domain_conf.c | 3 +- ...urity-sev-missing-policy.x86_64-2.12.0.err | 1 + .../launch-security-sev-missing-policy.xml | 34 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/launch-security-sev-missing-poli= cy.x86_64-2.12.0.err create mode 100644 tests/qemuxml2argvdata/launch-security-sev-missing-poli= cy.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5ea14b6dbf..8c1b6c3a09 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -483,7 +483,9 @@ - sev + + sev + @@ -496,9 +498,11 @@ - - - + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2d8ae7e860..103bb47566 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14734,7 +14734,8 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode, =20 if (virXPathULongHex("string(./policy)", ctxt, &policy) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("failed to get launch security policy")); + _("failed to get launch security policy for " + "launch security type SEV")); return NULL; } =20 diff --git a/tests/qemuxml2argvdata/launch-security-sev-missing-policy.x86_= 64-2.12.0.err b/tests/qemuxml2argvdata/launch-security-sev-missing-policy.x= 86_64-2.12.0.err new file mode 100644 index 0000000000..2019c8bb13 --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-sev-missing-policy.x86_64-2.12= .0.err @@ -0,0 +1 @@ +XML error: failed to get launch security policy for launch security type S= EV diff --git a/tests/qemuxml2argvdata/launch-security-sev-missing-policy.xml = b/tests/qemuxml2argvdata/launch-security-sev-missing-policy.xml new file mode 100644 index 0000000000..5461b06c9d --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-sev-missing-policy.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + + + + + + + AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA + IHAVENOIDEABUTJUSTPROVIDINGASTRING + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e315335e81..8d32aa7341 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3468,6 +3468,7 @@ mymain(void) DO_TEST_CAPS_VER("launch-security-sev", "2.12.0"); DO_TEST_CAPS_VER("launch-security-sev", "6.0.0"); DO_TEST_CAPS_VER("launch-security-sev-missing-platform-info", "2.12.0"= ); + DO_TEST_CAPS_VER_PARSE_ERROR("launch-security-sev-missing-policy", "2.= 12.0"); =20 DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16257778735306.749797582276756; Thu, 8 Jul 2021 13:57:53 -0700 (PDT) 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-32-8EWc_3w_NRy3V1K6pn3IsA-1; Thu, 08 Jul 2021 16:57:50 -0400 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 5B143192D786; Thu, 8 Jul 2021 20:57:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F2C010016FD; Thu, 8 Jul 2021 20:57:45 +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 B25844EA37; Thu, 8 Jul 2021 20:57:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168KvgBJ014117 for ; Thu, 8 Jul 2021 16:57:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id C641120B899F; Thu, 8 Jul 2021 20:57:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C101F20B8998 for ; Thu, 8 Jul 2021 20:57:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0909107846A for ; Thu, 8 Jul 2021 20:57:37 +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-545-bHPW72t7Mw6fBQz0cl_jQQ-1; Thu, 08 Jul 2021 16:57:33 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KoN8m115717; Thu, 8 Jul 2021 16:57:33 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nrfhjb07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:33 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KrA9M125107; Thu, 8 Jul 2021 16:57:32 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nrfhjayv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:32 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KoK24019581; Thu, 8 Jul 2021 20:57:30 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 39jf5hac7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:30 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KvRPR31719878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:57:27 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C6A54C04A; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 438EC4C04E; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) X-MC-Unique: 8EWc_3w_NRy3V1K6pn3IsA-1 X-MC-Unique: bHPW72t7Mw6fBQz0cl_jQQ-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 2/8] conf: rework SEV XML parse and format methods Date: Thu, 8 Jul 2021 22:57:18 +0200 Message-Id: <20210708205724.14643-3-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VqSiRb_DpWmajlJtXTevJUwwP8OO05LD X-Proofpoint-ORIG-GUID: FGQYFVH88zTqV4h9tZgzWfH1HB6hBhDB X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_11:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 adultscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777875244100001 Content-Type: text/plain; charset="utf-8" Make use of virDomainLaunchSecurity enum. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 110 ++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 103bb47566..99414cc4cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14732,41 +14732,51 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode, &def->sectype) < 0) return NULL; =20 - if (virXPathULongHex("string(./policy)", ctxt, &policy) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("failed to get launch security policy for " - "launch security type SEV")); - return NULL; - } + switch ((virDomainLaunchSecurity) def->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + if (virXPathULongHex("string(./policy)", ctxt, &policy) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("failed to get launch security policy for " + "launch security type SEV")); + return NULL; + } =20 - /* the following attributes are platform dependent and if missing, we = can - * autofill them from domain capabilities later - */ - rc =3D virXPathUInt("string(./cbitpos)", ctxt, &def->cbitpos); - if (rc =3D=3D 0) { - def->haveCbitpos =3D true; - } else if (rc =3D=3D -2) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid format for launch security cbitpos")); - return NULL; - } + /* the following attributes are platform dependent and if missing,= we can + * autofill them from domain capabilities later + */ + rc =3D virXPathUInt("string(./cbitpos)", ctxt, &def->cbitpos); + if (rc =3D=3D 0) { + def->haveCbitpos =3D true; + } else if (rc =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid format for launch security cbitpos")= ); + return NULL; + } =20 - rc =3D virXPathUInt("string(./reducedPhysBits)", ctxt, - &def->reduced_phys_bits); - if (rc =3D=3D 0) { - def->haveReducedPhysBits =3D true; - } else if (rc =3D=3D -2) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid format for launch security " - "reduced-phys-bits")); - return NULL; - } + rc =3D virXPathUInt("string(./reducedPhysBits)", ctxt, + &def->reduced_phys_bits); + if (rc =3D=3D 0) { + def->haveReducedPhysBits =3D true; + } else if (rc =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid format for launch security " + "reduced-phys-bits")); + return NULL; + } =20 - def->policy =3D policy; - def->dh_cert =3D virXPathString("string(./dhCert)", ctxt); - def->session =3D virXPathString("string(./session)", ctxt); + def->policy =3D policy; + def->dh_cert =3D virXPathString("string(./dhCert)", ctxt); + def->session =3D virXPathString("string(./session)", ctxt); =20 - return g_steal_pointer(&def); + return g_steal_pointer(&def); + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + default: + virReportError(VIR_ERR_XML_ERROR, + _("unsupported launch security type '%s'"), + virDomainLaunchSecurityTypeToString(def->sectype)); + return NULL; + } } =20 =20 @@ -26857,28 +26867,38 @@ virDomainKeyWrapDefFormat(virBuffer *buf, virDoma= inKeyWrapDef *keywrap) static void virDomainSEVDefFormat(virBuffer *buf, virDomainSEVDef *sev) { + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + if (!sev) return; =20 - virBufferAsprintf(buf, "\n", + virBufferAsprintf(&attrBuf, " type=3D'%s'", virDomainLaunchSecurityTypeToString(sev->sectype)); - virBufferAdjustIndent(buf, 2); =20 - if (sev->haveCbitpos) - virBufferAsprintf(buf, "%d\n", sev->cbitpos); + switch ((virDomainLaunchSecurity) sev->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: { + if (sev->haveCbitpos) + virBufferAsprintf(&childBuf, "%d\n", sev->c= bitpos); =20 - if (sev->haveReducedPhysBits) - virBufferAsprintf(buf, "%d\n", - sev->reduced_phys_bits); - virBufferAsprintf(buf, "0x%04x\n", sev->policy); - if (sev->dh_cert) - virBufferEscapeString(buf, "%s\n", sev->dh_cert); + if (sev->haveReducedPhysBits) + virBufferAsprintf(&childBuf, "%d\n", + sev->reduced_phys_bits); + virBufferAsprintf(&childBuf, "0x%04x\n", sev->pol= icy); + if (sev->dh_cert) + virBufferEscapeString(&childBuf, "%s\n", sev-= >dh_cert); =20 - if (sev->session) - virBufferEscapeString(buf, "%s\n", sev->session= ); + if (sev->session) + virBufferEscapeString(&childBuf, "%s\n", se= v->session); =20 - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + break; + } + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + return; + } + + virXMLFormatElement(buf, "launchSecurity", &attrBuf, &childBuf); } =20 =20 --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625777890425425.02358180248746; Thu, 8 Jul 2021 13:58:10 -0700 (PDT) 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-395-kB_M0dKrNy28Rhz0whr27Q-1; Thu, 08 Jul 2021 16:58:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9423636301; Thu, 8 Jul 2021 20:57:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7616D421F; Thu, 8 Jul 2021 20:57:58 +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 44BC04EA40; Thu, 8 Jul 2021 20:57:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168KvfC9014105 for ; Thu, 8 Jul 2021 16:57:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87DDF107695; Thu, 8 Jul 2021 20:57:41 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 815AF10769A for ; Thu, 8 Jul 2021 20:57:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 336A7866DF5 for ; Thu, 8 Jul 2021 20:57:38 +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-348-Cz-CLCtvOjSfv8AYhC0xxw-1; Thu, 08 Jul 2021 16:57:34 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KYUdg191702; Thu, 8 Jul 2021 16:57:33 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nwfcf1ny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:33 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KYbiL192172; Thu, 8 Jul 2021 16:57:32 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 39nwfcf1n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:32 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KnnnI010389; Thu, 8 Jul 2021 20:57:31 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 39jfh8tcc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:31 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KvRnF30998974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:57:28 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4E8D4C04E; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92E904C044; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) X-MC-Unique: kB_M0dKrNy28Rhz0whr27Q-1 X-MC-Unique: Cz-CLCtvOjSfv8AYhC0xxw-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 3/8] qemu: make KVMSupportsSecureGuest capability available Date: Thu, 8 Jul 2021 22:57:19 +0200 Message-Id: <20210708205724.14643-4-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: edQYYUef7q-jRIREE6mtOgTOZfIW1khZ X-Proofpoint-ORIG-GUID: sEoxLMzqoCinS96LRa69HMMg8gOzAhTp X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_12:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=979 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777891008100001 Content-Type: text/plain; charset="utf-8" Expose existing KVMSupportsSecureGuest capability. Signed-off-by: Boris Fiuczynski --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d1cd8f11ac..328bcc51c9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2136,6 +2136,12 @@ const char *virQEMUCapsGetPackage(virQEMUCaps *qemuC= aps) } =20 =20 +bool virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps) +{ + return qemuCaps->kvmSupportsSecureGuest; +} + + int virQEMUCapsAddCPUDefinitions(virQEMUCaps *qemuCaps, virDomainVirtType type, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 7944b9170a..fd754b9ec4 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -805,5 +805,8 @@ virQEMUCapsCPUFeatureFromQEMU(virQEMUCaps *qemuCaps, virSEVCapability * virQEMUCapsGetSEVCapabilities(virQEMUCaps *qemuCaps); =20 +bool +virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps) G_GNUC_NO_INLI= NE; + virArch virQEMUCapsArchFromString(const char *arch); const char *virQEMUCapsArchToString(virArch arch); --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625777880539121.00442358419218; Thu, 8 Jul 2021 13:58:00 -0700 (PDT) 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-291-AgOIfHhVMMqLQ-wXM6Or0A-1; Thu, 08 Jul 2021 16:57:57 -0400 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 3C96D362F9; Thu, 8 Jul 2021 20:57:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1801E100EBAF; Thu, 8 Jul 2021 20:57:52 +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 DBBCB4EA3A; Thu, 8 Jul 2021 20:57:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168KvjGV014149 for ; Thu, 8 Jul 2021 16:57:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id E7FCE107284; Thu, 8 Jul 2021 20:57:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E1B0C107695 for ; Thu, 8 Jul 2021 20:57:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D66F80D090 for ; Thu, 8 Jul 2021 20:57:38 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-400-d8Sgu88gMAukZTSPXygWhQ-1; Thu, 08 Jul 2021 16:57:35 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KXhve005221; Thu, 8 Jul 2021 16:57:34 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39nvwm7whc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:34 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KXgXU005112; Thu, 8 Jul 2021 16:57:33 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 39nvwm7wgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:33 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KnI2j013138; Thu, 8 Jul 2021 20:57:31 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 39jfh8tcdc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:31 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KtUGI36962598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:55:30 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 43EF54C044; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E13494C04A; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:27 +0000 (GMT) X-MC-Unique: AgOIfHhVMMqLQ-wXM6Or0A-1 X-MC-Unique: d8Sgu88gMAukZTSPXygWhQ-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 4/8] conf: refactor launch security to allow more types Date: Thu, 8 Jul 2021 22:57:20 +0200 Message-Id: <20210708205724.14643-5-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 9za8ENiXgOP8GqNis06ehWu_JtA-nEYq X-Proofpoint-ORIG-GUID: -R85Y3X5MNMY6SOM58MpyNVX-DNRdNM_ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_12:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777881920100001 Content-Type: text/plain; charset="utf-8" Adding virDomainSecDef for general launch security data and moving virDomainSEVDef as an element for SEV data. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 135 +++++++++++++++++++++--------------- src/conf/domain_conf.h | 16 +++-- src/conf/virconftypes.h | 2 + src/qemu/qemu_cgroup.c | 4 +- src/qemu/qemu_command.c | 47 ++++++++++--- src/qemu/qemu_driver.c | 3 +- src/qemu/qemu_firmware.c | 32 +++++---- src/qemu/qemu_namespace.c | 20 ++++-- src/qemu/qemu_process.c | 34 +++++++-- src/qemu/qemu_validate.c | 22 ++++-- src/security/security_dac.c | 6 +- 11 files changed, 218 insertions(+), 103 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 99414cc4cd..5c43bb1ba1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3491,17 +3491,25 @@ virDomainResctrlDefFree(virDomainResctrlDef *resctr= l) =20 =20 void -virDomainSEVDefFree(virDomainSEVDef *def) +virDomainSecDefFree(virDomainSecDef *def) { if (!def) return; =20 - g_free(def->dh_cert); - g_free(def->session); + switch ((virDomainLaunchSecurity) def->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + g_free(def->data.sev.dh_cert); + g_free(def->data.sev.session); + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + break; + } =20 g_free(def); } =20 + static void virDomainOSDefClear(virDomainOSDef *os) { @@ -3703,7 +3711,7 @@ void virDomainDefFree(virDomainDef *def) if (def->namespaceData && def->ns.free) (def->ns.free)(def->namespaceData); =20 - virDomainSEVDefFree(def->sev); + virDomainSecDefFree(def->sec); =20 xmlFreeNode(def->metadata); =20 @@ -14714,69 +14722,83 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node, } =20 =20 -static virDomainSEVDef * -virDomainSEVDefParseXML(xmlNodePtr sevNode, +static int +virDomainSEVDefParseXML(virDomainSEVDef *def, + xmlNodePtr sevNode, xmlXPathContextPtr ctxt) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - g_autoptr(virDomainSEVDef) def =3D NULL; unsigned long policy; int rc; =20 - def =3D g_new0(virDomainSEVDef, 1); - ctxt->node =3D sevNode; =20 - if (virXMLPropEnum(sevNode, "type", virDomainLaunchSecurityTypeFromStr= ing, - VIR_XML_PROP_NONZERO | VIR_XML_PROP_REQUIRED, - &def->sectype) < 0) - return NULL; + if (virXPathULongHex("string(./policy)", ctxt, &policy) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("failed to get launch security policy for " + "launch security type SEV")); + return -1; + } =20 - switch ((virDomainLaunchSecurity) def->sectype) { - case VIR_DOMAIN_LAUNCH_SECURITY_SEV: - if (virXPathULongHex("string(./policy)", ctxt, &policy) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("failed to get launch security policy for " - "launch security type SEV")); - return NULL; - } + /* the following attributes are platform dependent and if missing, we = can + * autofill them from domain capabilities later + */ + rc =3D virXPathUInt("string(./cbitpos)", ctxt, &def->cbitpos); + if (rc =3D=3D 0) { + def->haveCbitpos =3D true; + } else if (rc =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid format for launch security cbitpos")); + return -1; + } =20 - /* the following attributes are platform dependent and if missing,= we can - * autofill them from domain capabilities later - */ - rc =3D virXPathUInt("string(./cbitpos)", ctxt, &def->cbitpos); - if (rc =3D=3D 0) { - def->haveCbitpos =3D true; - } else if (rc =3D=3D -2) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid format for launch security cbitpos")= ); - return NULL; - } + rc =3D virXPathUInt("string(./reducedPhysBits)", ctxt, + &def->reduced_phys_bits); + if (rc =3D=3D 0) { + def->haveReducedPhysBits =3D true; + } else if (rc =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Invalid format for launch security " + "reduced-phys-bits")); + return -1; + } + + def->policy =3D policy; + def->dh_cert =3D virXPathString("string(./dhCert)", ctxt); + def->session =3D virXPathString("string(./session)", ctxt); + + return 0; +} =20 - rc =3D virXPathUInt("string(./reducedPhysBits)", ctxt, - &def->reduced_phys_bits); - if (rc =3D=3D 0) { - def->haveReducedPhysBits =3D true; - } else if (rc =3D=3D -2) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid format for launch security " - "reduced-phys-bits")); - return NULL; - } =20 - def->policy =3D policy; - def->dh_cert =3D virXPathString("string(./dhCert)", ctxt); - def->session =3D virXPathString("string(./session)", ctxt); +static virDomainSecDef * +virDomainSecDefParseXML(xmlNodePtr lsecNode, + xmlXPathContextPtr ctxt) +{ + g_autoptr(virDomainSecDef) sec =3D g_new0(virDomainSecDef, 1); + + ctxt->node =3D lsecNode; + + if (virXMLPropEnum(lsecNode, "type", virDomainLaunchSecurityTypeFromSt= ring, + VIR_XML_PROP_NONZERO | VIR_XML_PROP_REQUIRED, + &sec->sectype) < 0) + return NULL; =20 - return g_steal_pointer(&def); + switch ((virDomainLaunchSecurity) sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + if (virDomainSEVDefParseXML(&sec->data.sev, lsecNode, ctxt) < 0) + return NULL; + break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: default: virReportError(VIR_ERR_XML_ERROR, _("unsupported launch security type '%s'"), - virDomainLaunchSecurityTypeToString(def->sectype)); + virDomainLaunchSecurityTypeToString(sec->sectype)); return NULL; } + + return g_steal_pointer(&sec); } =20 =20 @@ -20131,10 +20153,10 @@ virDomainDefParseXML(xmlDocPtr xml, ctxt->node =3D node; VIR_FREE(nodes); =20 - /* Check for SEV feature */ + /* Check for launch security e.g. SEV feature */ if ((node =3D virXPathNode("./launchSecurity", ctxt)) !=3D NULL) { - def->sev =3D virDomainSEVDefParseXML(node, ctxt); - if (!def->sev) + def->sec =3D virDomainSecDefParseXML(node, ctxt); + if (!def->sec) goto error; } =20 @@ -26865,19 +26887,21 @@ virDomainKeyWrapDefFormat(virBuffer *buf, virDoma= inKeyWrapDef *keywrap) =20 =20 static void -virDomainSEVDefFormat(virBuffer *buf, virDomainSEVDef *sev) +virDomainSecDefFormat(virBuffer *buf, virDomainSecDef *sec) { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 - if (!sev) + if (!sec) return; =20 virBufferAsprintf(&attrBuf, " type=3D'%s'", - virDomainLaunchSecurityTypeToString(sev->sectype)); + virDomainLaunchSecurityTypeToString(sec->sectype)); =20 - switch ((virDomainLaunchSecurity) sev->sectype) { + switch ((virDomainLaunchSecurity) sec->sectype) { case VIR_DOMAIN_LAUNCH_SECURITY_SEV: { + virDomainSEVDef *sev =3D &sec->data.sev; + if (sev->haveCbitpos) virBufferAsprintf(&childBuf, "%d\n", sev->c= bitpos); =20 @@ -26893,6 +26917,7 @@ virDomainSEVDefFormat(virBuffer *buf, virDomainSEVD= ef *sev) =20 break; } + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: return; @@ -28307,7 +28332,7 @@ virDomainDefFormatInternalSetRootName(virDomainDef = *def, if (def->keywrap) virDomainKeyWrapDefFormat(buf, def->keywrap); =20 - virDomainSEVDefFormat(buf, def->sev); + virDomainSecDefFormat(buf, def->sec); =20 if (def->namespaceData && def->ns.format) { if ((def->ns.format)(buf, def->namespaceData) < 0) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c31531c93b..afda93b995 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2651,7 +2651,6 @@ typedef enum { =20 =20 struct _virDomainSEVDef { - virDomainLaunchSecurity sectype; char *dh_cert; char *session; unsigned int policy; @@ -2661,8 +2660,15 @@ struct _virDomainSEVDef { unsigned int reduced_phys_bits; }; =20 -void virDomainSEVDefFree(virDomainSEVDef *def); -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSEVDef, virDomainSEVDefFree); +struct _virDomainSecDef { + virDomainLaunchSecurity sectype; + union { + virDomainSEVDef sev; + } data; +}; + +void virDomainSecDefFree(virDomainSecDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSecDef, virDomainSecDefFree); =20 typedef enum { VIR_DOMAIN_IOMMU_MODEL_INTEL, @@ -2873,8 +2879,8 @@ struct _virDomainDef { =20 virDomainKeyWrapDef *keywrap; =20 - /* SEV-specific domain */ - virDomainSEVDef *sev; + /* launch security e.g. SEV */ + virDomainSecDef *sec; =20 /* Application-specific custom metadata */ xmlNodePtr metadata; diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index b21068486e..21420ba8ea 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -202,6 +202,8 @@ typedef struct _virDomainResourceDef virDomainResourceD= ef; =20 typedef struct _virDomainSEVDef virDomainSEVDef; =20 +typedef struct _virDomainSecDef virDomainSecDef; + typedef struct _virDomainShmemDef virDomainShmemDef; =20 typedef struct _virDomainSmartcardDef virDomainSmartcardDef; diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 038d6478b2..f2d99abcfa 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -856,7 +856,9 @@ qemuSetupDevicesCgroup(virDomainObj *vm) return -1; } =20 - if (vm->def->sev && qemuSetupSEVCgroup(vm) < 0) + if (vm->def->sec && + vm->def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV && + qemuSetupSEVCgroup(vm) < 0) return -1; =20 return 0; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0473e7deaa..27b5145d83 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6967,11 +6967,20 @@ qemuBuildMachineCommandLine(virCommand *cmd, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_LOADPARM)) qemuAppendLoadparmMachineParm(&buf, def); =20 - if (def->sev) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_S= UPPORT)) { - virBufferAddLit(&buf, ",confidential-guest-support=3Dsev0"); - } else { - virBufferAddLit(&buf, ",memory-encryption=3Dsev0"); + if (def->sec) { + switch ((virDomainLaunchSecurity) def->sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUE= ST_SUPPORT)) { + virBufferAddLit(&buf, ",confidential-guest-support=3Dsev0"= ); + } else { + virBufferAddLit(&buf, ",memory-encryption=3Dsev0"); + } + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sec= type); + return -1; } } =20 @@ -9832,9 +9841,6 @@ qemuBuildSEVCommandLine(virDomainObj *vm, virCommand = *cmd, g_autofree char *dhpath =3D NULL; g_autofree char *sessionpath =3D NULL; =20 - if (!sev) - return 0; - VIR_DEBUG("policy=3D0x%x cbitpos=3D%d reduced_phys_bits=3D%d", sev->policy, sev->cbitpos, sev->reduced_phys_bits); =20 @@ -9861,6 +9867,29 @@ qemuBuildSEVCommandLine(virDomainObj *vm, virCommand= *cmd, return 0; } =20 + +static int +qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd, + virDomainSecDef *sec) +{ + if (!sec) + return 0; + + switch ((virDomainLaunchSecurity) sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + return qemuBuildSEVCommandLine(vm, cmd, &sec->data.sev); + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, sec->sectype); + return -1; + } + + return 0; +} + + static int qemuBuildVMCoreInfoCommandLine(virCommand *cmd, const virDomainDef *def) @@ -10560,7 +10589,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildVMCoreInfoCommandLine(cmd, def) < 0) return NULL; =20 - if (qemuBuildSEVCommandLine(vm, cmd, def->sev) < 0) + if (qemuBuildSecCommandLine(vm, cmd, def->sec) < 0) return NULL; =20 if (snapshot) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 235f575901..9973875092 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19830,7 +19830,8 @@ qemuDomainGetLaunchSecurityInfo(virDomainPtr domain, if (virDomainGetLaunchSecurityInfoEnsureACL(domain->conn, vm->def) < 0) goto cleanup; =20 - if (vm->def->sev) { + if (vm->def->sec && + vm->def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) { if (qemuDomainGetSEVMeasurement(driver, vm, params, nparams, flags= ) < 0) goto cleanup; } diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index e17b024b06..6f83ebafe9 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1053,19 +1053,27 @@ qemuFirmwareMatchDomain(const virDomainDef *def, return false; } =20 - if (def->sev && - def->sev->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) { - if (!supportsSEV) { - VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't support = it", - path); - return false; - } + if (def->sec) { + switch ((virDomainLaunchSecurity) def->sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + if (!supportsSEV) { + VIR_DEBUG("Domain requires SEV, firmware '%s' doesn't supp= ort it", + path); + return false; + } =20 - if (def->sev->policy & VIR_QEMU_FIRMWARE_AMD_SEV_ES_POLICY && - !supportsSEVES) { - VIR_DEBUG("Domain requires SEV-ES, firmware '%s' doesn't suppo= rt it", - path); - return false; + if (def->sec->data.sev.policy & VIR_QEMU_FIRMWARE_AMD_SEV_ES_P= OLICY && + !supportsSEVES) { + VIR_DEBUG("Domain requires SEV-ES, firmware '%s' doesn't s= upport it", + path); + return false; + } + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sec= type); + return -1; } } =20 diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 98495e8ef8..35c8eb83fd 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -594,16 +594,26 @@ static int qemuDomainSetupLaunchSecurity(virDomainObj *vm, GSList **paths) { - virDomainSEVDef *sev =3D vm->def->sev; + virDomainSecDef *sec =3D vm->def->sec; =20 - if (!sev || sev->sectype !=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) + if (!sec) return 0; =20 - VIR_DEBUG("Setting up launch security"); + switch ((virDomainLaunchSecurity) sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + VIR_DEBUG("Setting up launch security for SEV"); =20 - *paths =3D g_slist_prepend(*paths, g_strdup(QEMU_DEV_SEV)); + *paths =3D g_slist_prepend(*paths, g_strdup(QEMU_DEV_SEV)); + + VIR_DEBUG("Set up launch security for SEV"); + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, sec->sectype); + return -1; + } =20 - VIR_DEBUG("Set up launch security"); return 0; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2b03b0ab98..6960249bb4 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6480,7 +6480,7 @@ qemuProcessUpdateSEVInfo(virDomainObj *vm) { qemuDomainObjPrivate *priv =3D vm->privateData; virQEMUCaps *qemuCaps =3D priv->qemuCaps; - virDomainSEVDef *sev =3D vm->def->sev; + virDomainSEVDef *sev =3D &vm->def->sec->data.sev; virSEVCapability *sevCaps =3D NULL; =20 /* if platform specific info like 'cbitpos' and 'reducedPhysBits' have @@ -6636,7 +6636,8 @@ qemuProcessPrepareDomain(virQEMUDriver *driver, for (i =3D 0; i < vm->def->nshmems; i++) qemuDomainPrepareShmemChardev(vm->def->shmems[i]); =20 - if (vm->def->sev) { + if (vm->def->sec && + vm->def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) { VIR_DEBUG("Updating SEV platform info"); if (qemuProcessUpdateSEVInfo(vm) < 0) return -1; @@ -6674,10 +6675,7 @@ qemuProcessSEVCreateFile(virDomainObj *vm, static int qemuProcessPrepareSEVGuestInput(virDomainObj *vm) { - virDomainSEVDef *sev =3D vm->def->sev; - - if (!sev) - return 0; + virDomainSEVDef *sev =3D &vm->def->sec->data.sev; =20 VIR_DEBUG("Preparing SEV guest"); =20 @@ -6695,6 +6693,28 @@ qemuProcessPrepareSEVGuestInput(virDomainObj *vm) } =20 =20 +static int +qemuProcessPrepareLaunchSecurityGuestInput(virDomainObj *vm) +{ + virDomainSecDef *sec =3D vm->def->sec; + + if (!sec) + return 0; + + switch ((virDomainLaunchSecurity) sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + return qemuProcessPrepareSEVGuestInput(vm); + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, sec->sectype); + return -1; + } + + return 0; +} + + static int qemuProcessPrepareHostStorage(virQEMUDriver *driver, virDomainObj *vm, @@ -6874,7 +6894,7 @@ qemuProcessPrepareHost(virQEMUDriver *driver, if (qemuExtDevicesPrepareHost(driver, vm) < 0) return -1; =20 - if (qemuProcessPrepareSEVGuestInput(vm) < 0) + if (qemuProcessPrepareLaunchSecurityGuestInput(vm) < 0) return -1; =20 return 0; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b133ce3cd6..c54c18160e 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1214,12 +1214,22 @@ qemuValidateDomainDef(const virDomainDef *def, if (qemuValidateDomainDefPanic(def, qemuCaps) < 0) return -1; =20 - if (def->sev && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("SEV launch security is not supported with " - "this QEMU binary")); - return -1; + if (def->sec) { + switch ((virDomainLaunchSecurity) def->sec->sectype) { + case VIR_DOMAIN_LAUNCH_SECURITY_SEV: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("SEV launch security is not supported wit= h " + "this QEMU binary")); + return -1; + } + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_LAST: + virReportEnumRangeError(virDomainLaunchSecurity, def->sec->sec= type); + return -1; + } } =20 if (def->naudios > 1 && diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 4909107fcc..b874dd4ab6 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1958,7 +1958,8 @@ virSecurityDACRestoreAllLabel(virSecurityManager *mgr, rc =3D -1; } =20 - if (def->sev) { + if (def->sec && + def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) { if (virSecurityDACRestoreSEVLabel(mgr, def) < 0) rc =3D -1; } @@ -2165,7 +2166,8 @@ virSecurityDACSetAllLabel(virSecurityManager *mgr, return -1; } =20 - if (def->sev) { + if (def->sec && + def->sec->sectype =3D=3D VIR_DOMAIN_LAUNCH_SECURITY_SEV) { if (virSecurityDACSetSEVLabel(mgr, def) < 0) return -1; } --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625777873640725.1607008528174; Thu, 8 Jul 2021 13:57:53 -0700 (PDT) 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-567-hCHCMpwKOoieCR09pQwUzA-1; Thu, 08 Jul 2021 16:57:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F3A0100CCC3; Thu, 8 Jul 2021 20:57:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50A4C5C1C2; Thu, 8 Jul 2021 20:57:43 +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 3507A4EA2A; Thu, 8 Jul 2021 20:57:42 +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 168KvePb014090 for ; Thu, 8 Jul 2021 16:57:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79D2D102F141; Thu, 8 Jul 2021 20:57:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 748BE103F27E for ; Thu, 8 Jul 2021 20:57:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4ED51107846B for ; Thu, 8 Jul 2021 20:57:38 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-B4tOCRsZPBGRXxqXjVh5UA-1; Thu, 08 Jul 2021 16:57:36 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KXd7R064819; Thu, 8 Jul 2021 16:57:34 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n28m0s8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:34 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KXr9o065444; Thu, 8 Jul 2021 16:57:34 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n28m0s80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:33 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KpcX6020921; Thu, 8 Jul 2021 20:57:31 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 39jf5hac7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:31 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KtVY436962606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:55:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A83764C052; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 503214C046; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) X-MC-Unique: hCHCMpwKOoieCR09pQwUzA-1 X-MC-Unique: B4tOCRsZPBGRXxqXjVh5UA-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 5/8] qemu: add s390-pv-guest capability Date: Thu, 8 Jul 2021 22:57:21 +0200 Message-Id: <20210708205724.14643-6-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0pqkyXPCDuna_O6QFVTqbA3fcHLRWR9w X-Proofpoint-ORIG-GUID: vH5d9OArqv5q4M0a3oJjgHr-0vKKo7B1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_11:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777875309100002 Content-Type: text/plain; charset="utf-8" Add s390-pv-guest capability. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza Reviewed-by: Pavel Hrdina --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 17 +++++++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 26 ++++++++++++++ src/qemu/qemu_firmware.c | 1 + src/qemu/qemu_namespace.c | 1 + src/qemu/qemu_process.c | 1 + src/qemu/qemu_validate.c | 10 ++++++ .../launch-security-s390-pv.xml | 18 ++++++++++ tests/genericxml2xmltest.c | 1 + .../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + ...nch-security-s390-pv-fail.s390x-latest.err | 1 + .../launch-security-s390-pv-fail.xml | 33 +++++++++++++++++ .../launch-security-s390-pv.s390x-latest.args | 35 +++++++++++++++++++ .../launch-security-s390-pv.xml | 30 ++++++++++++++++ tests/qemuxml2argvmock.c | 16 +++++++++ tests/qemuxml2argvtest.c | 3 ++ 19 files changed, 199 insertions(+) create mode 100644 tests/genericxml2xmlindata/launch-security-s390-pv.xml create mode 100644 tests/qemuxml2argvdata/launch-security-s390-pv-fail.s39= 0x-latest.err create mode 100644 tests/qemuxml2argvdata/launch-security-s390-pv-fail.xml create mode 100644 tests/qemuxml2argvdata/launch-security-s390-pv.s390x-la= test.args create mode 100644 tests/qemuxml2argvdata/launch-security-s390-pv.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 8c1b6c3a09..b81c51728d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -485,6 +485,7 @@ sev + s390-pv diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5c43bb1ba1..f479037d08 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1401,6 +1401,7 @@ VIR_ENUM_IMPL(virDomainLaunchSecurity, VIR_DOMAIN_LAUNCH_SECURITY_LAST, "", "sev", + "s390-pv", ); =20 static virClass *virDomainObjClass; @@ -3501,6 +3502,7 @@ virDomainSecDefFree(virDomainSecDef *def) g_free(def->data.sev.dh_cert); g_free(def->data.sev.session); break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: break; @@ -14776,6 +14778,7 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode, xmlXPathContextPtr ctxt) { g_autoptr(virDomainSecDef) sec =3D g_new0(virDomainSecDef, 1); + int n; =20 ctxt->node =3D lsecNode; =20 @@ -14789,6 +14792,17 @@ virDomainSecDefParseXML(xmlNodePtr lsecNode, if (virDomainSEVDefParseXML(&sec->data.sev, lsecNode, ctxt) < 0) return NULL; break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + if ((n =3D virXPathNodeSet("./*", ctxt, NULL)) < 0) + return NULL; + if (n !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("launch security type '%s' must be defined " + "without any configuration data"), + virDomainLaunchSecurityTypeToString(sec->sectyp= e)); + return NULL; + } + break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: default: @@ -26918,6 +26932,9 @@ virDomainSecDefFormat(virBuffer *buf, virDomainSecD= ef *sec) break; } =20 + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + break; + case VIR_DOMAIN_LAUNCH_SECURITY_NONE: case VIR_DOMAIN_LAUNCH_SECURITY_LAST: return; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index afda93b995..6713dcbe12 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2645,6 +2645,7 @@ struct _virDomainKeyWrapDef { typedef enum { VIR_DOMAIN_LAUNCH_SECURITY_NONE, VIR_DOMAIN_LAUNCH_SECURITY_SEV, + VIR_DOMAIN_LAUNCH_SECURITY_PV, =20 VIR_DOMAIN_LAUNCH_SECURITY_LAST, } virDomainLaunchSecurity; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 328bcc51c9..69c4f1a592 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -636,6 +636,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 405 */ "confidential-guest-support", "query-display-options", + "s390-pv-guest", ); =20 =20 @@ -1354,6 +1355,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "input-linux", QEMU_CAPS_INPUT_LINUX }, { "virtio-gpu-gl-pci", QEMU_CAPS_VIRTIO_GPU_GL_PCI }, { "virtio-vga-gl", QEMU_CAPS_VIRTIO_VGA_GL }, + { "s390-pv-guest", QEMU_CAPS_S390_PV_GUEST }, }; =20 =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index fd754b9ec4..f99bb211e0 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -616,6 +616,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 405 */ QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-= guest-support */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp comman= d present */ + QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 27b5145d83..87621e8a2f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6976,6 +6976,9 @@ qemuBuildMachineCommandLine(virCommand *cmd, virBufferAddLit(&buf, ",memory-encryption=3Dsev0"); } break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + virBufferAddLit(&buf, ",confidential-guest-support=3Dpv0"); + break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: @@ -9868,6 +9871,26 @@ qemuBuildSEVCommandLine(virDomainObj *vm, virCommand= *cmd, } =20 =20 +static int +qemuBuildPVCommandLine(virDomainObj *vm, virCommand *cmd) +{ + g_autoptr(virJSONValue) props =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + qemuDomainObjPrivate *priv =3D vm->privateData; + + if (qemuMonitorCreateObjectProps(&props, "s390-pv-guest", "pv0", + NULL) < 0) + return -1; + + if (qemuBuildObjectCommandlineFromJSON(&buf, props, priv->qemuCaps) < = 0) + return -1; + + virCommandAddArg(cmd, "-object"); + virCommandAddArgBuffer(cmd, &buf); + return 0; +} + + static int qemuBuildSecCommandLine(virDomainObj *vm, virCommand *cmd, virDomainSecDef *sec) @@ -9879,6 +9902,9 @@ qemuBuildSecCommandLine(virDomainObj *vm, virCommand = *cmd, case VIR_DOMAIN_LAUNCH_SECURITY_SEV: return qemuBuildSEVCommandLine(vm, cmd, &sec->data.sev); break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + return qemuBuildPVCommandLine(vm, cmd); + break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 6f83ebafe9..77c452746f 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1069,6 +1069,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def, return false; } break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 35c8eb83fd..156ee84292 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -607,6 +607,7 @@ qemuDomainSetupLaunchSecurity(virDomainObj *vm, =20 VIR_DEBUG("Set up launch security for SEV"); break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6960249bb4..308b17cf26 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6704,6 +6704,7 @@ qemuProcessPrepareLaunchSecurityGuestInput(virDomainO= bj *vm) switch ((virDomainLaunchSecurity) sec->sectype) { case VIR_DOMAIN_LAUNCH_SECURITY_SEV: return qemuProcessPrepareSEVGuestInput(vm); + case VIR_DOMAIN_LAUNCH_SECURITY_PV: case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index c54c18160e..7482bedee6 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1224,6 +1224,16 @@ qemuValidateDomainDef(const virDomainDef *def, return -1; } break; + case VIR_DOMAIN_LAUNCH_SECURITY_PV: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GU= EST_SUPPORT) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) || + !virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("S390 PV launch security is not supported= with " + "this QEMU binary")); + return -1; + } + break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; case VIR_DOMAIN_LAUNCH_SECURITY_LAST: diff --git a/tests/genericxml2xmlindata/launch-security-s390-pv.xml b/tests= /genericxml2xmlindata/launch-security-s390-pv.xml new file mode 100644 index 0000000000..29c7fc152d --- /dev/null +++ b/tests/genericxml2xmlindata/launch-security-s390-pv.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + + + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index ac89422a32..8f817e2cb5 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -233,6 +233,7 @@ mymain(void) DO_TEST("tseg"); =20 DO_TEST("launch-security-sev"); + DO_TEST("launch-security-s390-pv"); =20 DO_TEST_DIFFERENT("cputune"); DO_TEST("device-backenddomain"); diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_6.0.0.s390x.xml index 1806c064c9..aae6364e37 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml @@ -169,6 +169,7 @@ + 6000000 0 39100242 diff --git a/tests/qemuxml2argvdata/launch-security-s390-pv-fail.s390x-late= st.err b/tests/qemuxml2argvdata/launch-security-s390-pv-fail.s390x-latest.e= rr new file mode 100644 index 0000000000..f363190917 --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-s390-pv-fail.s390x-latest.err @@ -0,0 +1 @@ +XML error: launch security type 's390-pv' must be defined without any conf= iguration data diff --git a/tests/qemuxml2argvdata/launch-security-s390-pv-fail.xml b/test= s/qemuxml2argvdata/launch-security-s390-pv-fail.xml new file mode 100644 index 0000000000..052d96dedb --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-s390-pv-fail.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ + + +
+ + + + + AQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAAAQAAAAAOAAA + IHAVENOIDEABUTJUSTPROVIDINGASTRING + + diff --git a/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.ar= gs b/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.args new file mode 100644 index 0000000000..c9d9b84dd3 --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine s390-ccw-virtio,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,confi= dential-guest-support=3Dpv0,memory-backend=3Ds390.ram \ +-cpu gen15a-base,aen=3Don,cmmnt=3Don,vxpdeh=3Don,aefsi=3Don,diag318=3Don,c= sske=3Don,mepoch=3Don,msa9=3Don,msa8=3Don,msa7=3Don,msa6=3Don,msa5=3Don,msa= 4=3Don,msa3=3Don,msa2=3Don,msa1=3Don,sthyi=3Don,edat=3Don,ri=3Don,deflate= =3Don,edat2=3Don,etoken=3Don,vx=3Don,ipter=3Don,mepochptff=3Don,ap=3Don,vxe= h=3Don,vxpd=3Don,esop=3Don,msa9_pckmo=3Don,vxeh2=3Don,esort=3Don,apqi=3Don,= apft=3Don,els=3Don,iep=3Don,apqci=3Don,cte=3Don,ais=3Don,bpb=3Don,gs=3Don,p= pa15=3Don,zpci=3Don,sea_esop2=3Don,te=3Don,cmm=3Don \ +-m 214 \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":224395264= }' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device virtio-blk-ccw,devno=3Dfe.0.0000,drive=3Dlibvirt-1-format,id=3Dvir= tio-disk0,bootindex=3D1 \ +-audiodev id=3Daudio1,driver=3Dnone \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0001 \ +-object '{"qom-type":"s390-pv-guest","id":"pv0"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/launch-security-s390-pv.xml b/tests/qem= uxml2argvdata/launch-security-s390-pv.xml new file mode 100644 index 0000000000..c40c2b4bf2 --- /dev/null +++ b/tests/qemuxml2argvdata/launch-security-s390-pv.xml @@ -0,0 +1,30 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ + + +
+ + + + + diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index 2265492f1e..d7f77eabf7 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -41,6 +41,7 @@ #include "virutil.h" #include "qemu/qemu_interface.h" #include "qemu/qemu_command.h" +#include "qemu/qemu_capabilities.h" #include #include #include @@ -301,3 +302,18 @@ virIdentityEnsureSystemToken(void) { return g_strdup("3de80bcbf22d4833897f1638e01be9b2"); } + +static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemu= Caps); + +bool +virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps) +{ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPO= RT) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST)) + return true; + + if (!real_virQEMUCapsGetKVMSupportsSecureGuest) + VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest); + + return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps); +} diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8d32aa7341..47182e0110 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3470,6 +3470,9 @@ mymain(void) DO_TEST_CAPS_VER("launch-security-sev-missing-platform-info", "2.12.0"= ); DO_TEST_CAPS_VER_PARSE_ERROR("launch-security-sev-missing-policy", "2.= 12.0"); =20 + DO_TEST_CAPS_ARCH_LATEST("launch-security-s390-pv", "s390x"); + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("launch-security-s390-pv-fail", "= s390x"); + DO_TEST_CAPS_LATEST("vhost-user-fs-fd-memory"); DO_TEST_CAPS_LATEST("vhost-user-fs-hugepages"); DO_TEST_CAPS_LATEST_PARSE_ERROR("vhost-user-fs-readonly"); --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1625777881391850.9525064357849; Thu, 8 Jul 2021 13:58:01 -0700 (PDT) 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-435-rjPEWjSSOYW3SUNJjFYhsg-1; Thu, 08 Jul 2021 16:57:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90D77100CCC3; Thu, 8 Jul 2021 20:57:52 +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 751F160843; Thu, 8 Jul 2021 20:57:52 +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 4357C1809CB2; Thu, 8 Jul 2021 20:57:52 +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 168KveTV014091 for ; Thu, 8 Jul 2021 16:57:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79C3C10166E3; Thu, 8 Jul 2021 20:57:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 720BA103F276 for ; Thu, 8 Jul 2021 20:57:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F39D866DF8 for ; Thu, 8 Jul 2021 20:57:37 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-357-90lmpmcpMqqnhrHSLtgxYA-1; Thu, 08 Jul 2021 16:57:35 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KYUeY059984; Thu, 8 Jul 2021 16:57:34 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39p0hqsf1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:34 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KYsj1064637; Thu, 8 Jul 2021 16:57:33 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39p0hqsf1a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:33 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KoY93011604; Thu, 8 Jul 2021 20:57:32 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 39jfh8tcc6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:32 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KtYDK37355792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:55:34 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04FA54C040; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5FCF4C04A; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:28 +0000 (GMT) X-MC-Unique: rjPEWjSSOYW3SUNJjFYhsg-1 X-MC-Unique: 90lmpmcpMqqnhrHSLtgxYA-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 6/8] conf: add availability of s390-pv in domain capabilities Date: Thu, 8 Jul 2021 22:57:22 +0200 Message-Id: <20210708205724.14643-7-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Sr_SDsDkbdJMinyu_TLGUxACs7gxYuSt X-Proofpoint-ORIG-GUID: WQaqpTHfgqPhES_nJ2eGUL-PNwhhwR51 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_11:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777882005100003 Content-Type: text/plain; charset="utf-8" Adding availability of s390-pv in domain capabilities and adjust tests. Signed-off-by: Boris Fiuczynski --- docs/schemas/domaincaps.rng | 9 +++++++++ src/conf/domain_capabilities.c | 1 + src/conf/domain_capabilities.h | 1 + src/qemu/qemu_capabilities.c | 16 ++++++++++++++++ tests/domaincapsdata/qemu_2.11.0.s390x.xml | 1 + tests/domaincapsdata/qemu_2.12.0.s390x.xml | 1 + tests/domaincapsdata/qemu_3.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_4.0.0.s390x.xml | 1 + tests/domaincapsdata/qemu_4.2.0.s390x.xml | 1 + tests/domaincapsdata/qemu_5.2.0.s390x.xml | 1 + tests/domaincapsdata/qemu_6.0.0.s390x.xml | 1 + tests/domaincapsmock.c | 17 +++++++++++++++++ 12 files changed, 51 insertions(+) diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index fc668e0c78..d7ee60dd16 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -247,6 +247,9 @@ + + + @@ -284,6 +287,12 @@ =20 + + + + + + diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index cb90ae0176..83d3320980 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -42,6 +42,7 @@ VIR_ENUM_IMPL(virDomainCapsFeature, "genid", "backingStoreInput", "backup", + "s390-pv", ); =20 static virClass *virDomainCapsClass; diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index b6433b20c9..34b9b8a693 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -179,6 +179,7 @@ typedef enum { VIR_DOMAIN_CAPS_FEATURE_GENID, VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT, VIR_DOMAIN_CAPS_FEATURE_BACKUP, + VIR_DOMAIN_CAPS_FEATURE_S390_PV, =20 VIR_DOMAIN_CAPS_FEATURE_LAST } virDomainCapsFeature; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 69c4f1a592..0d93cc2052 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6315,6 +6315,21 @@ virQEMUCapsFillDomainFeatureSEVCaps(virQEMUCaps *qem= uCaps, } =20 =20 +static void +virQEMUCapsFillDomainFeatureS390PVCaps(virQEMUCaps *qemuCaps, + virDomainCaps *domCaps) +{ + if (ARCH_IS_S390(qemuCaps->arch)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_S= UPPORT) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) && + virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps)) + domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] =3D VIR_TRI= STATE_BOOL_YES; + else + domCaps->features[VIR_DOMAIN_CAPS_FEATURE_S390_PV] =3D VIR_TRI= STATE_BOOL_NO; + } +} + + int virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virArch hostarch, @@ -6361,6 +6376,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps, virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem); virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps); virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps); + virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps); =20 return 0; } diff --git a/tests/domaincapsdata/qemu_2.11.0.s390x.xml b/tests/domaincapsd= ata/qemu_2.11.0.s390x.xml index cd3ab38bc4..be2f0c6c66 100644 --- a/tests/domaincapsdata/qemu_2.11.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.11.0.s390x.xml @@ -206,6 +206,7 @@ + diff --git a/tests/domaincapsdata/qemu_2.12.0.s390x.xml b/tests/domaincapsd= ata/qemu_2.12.0.s390x.xml index 418db98294..55da03d928 100644 --- a/tests/domaincapsdata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsdata/qemu_2.12.0.s390x.xml @@ -205,6 +205,7 @@ + diff --git a/tests/domaincapsdata/qemu_3.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_3.0.0.s390x.xml index d4443bde20..3440c4d936 100644 --- a/tests/domaincapsdata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_3.0.0.s390x.xml @@ -212,6 +212,7 @@ + diff --git a/tests/domaincapsdata/qemu_4.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_4.0.0.s390x.xml index e0ff109ead..1d3b5465d1 100644 --- a/tests/domaincapsdata/qemu_4.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.0.0.s390x.xml @@ -222,6 +222,7 @@ + diff --git a/tests/domaincapsdata/qemu_4.2.0.s390x.xml b/tests/domaincapsda= ta/qemu_4.2.0.s390x.xml index a610c417f7..1719cc49a8 100644 --- a/tests/domaincapsdata/qemu_4.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_4.2.0.s390x.xml @@ -237,6 +237,7 @@ + diff --git a/tests/domaincapsdata/qemu_5.2.0.s390x.xml b/tests/domaincapsda= ta/qemu_5.2.0.s390x.xml index 43905a6a85..876cb8b2f8 100644 --- a/tests/domaincapsdata/qemu_5.2.0.s390x.xml +++ b/tests/domaincapsdata/qemu_5.2.0.s390x.xml @@ -239,6 +239,7 @@ + diff --git a/tests/domaincapsdata/qemu_6.0.0.s390x.xml b/tests/domaincapsda= ta/qemu_6.0.0.s390x.xml index d384f0859b..5f2278b57e 100644 --- a/tests/domaincapsdata/qemu_6.0.0.s390x.xml +++ b/tests/domaincapsdata/qemu_6.0.0.s390x.xml @@ -240,6 +240,7 @@ + diff --git a/tests/domaincapsmock.c b/tests/domaincapsmock.c index b03f75199b..7b02c0e890 100644 --- a/tests/domaincapsmock.c +++ b/tests/domaincapsmock.c @@ -17,6 +17,8 @@ #include =20 #include "virhostcpu.h" +#include "virmock.h" +#include "qemu/qemu_capabilities.h" =20 int virHostCPUGetKVMMaxVCPUs(void) @@ -29,3 +31,18 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UN= USED) { return 0; } + +static bool (*real_virQEMUCapsGetKVMSupportsSecureGuest)(virQEMUCaps *qemu= Caps); + +bool +virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuCaps) +{ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPO= RT) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST)) + return true; + + if (!real_virQEMUCapsGetKVMSupportsSecureGuest) + VIR_MOCK_REAL_INIT(virQEMUCapsGetKVMSupportsSecureGuest); + + return real_virQEMUCapsGetKVMSupportsSecureGuest(qemuCaps); +} --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1625777873840721.4762771961433; Thu, 8 Jul 2021 13:57:53 -0700 (PDT) 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-460-_nCg831mNRKkzK-_8vsYow-1; Thu, 08 Jul 2021 16:57:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01229192D787; Thu, 8 Jul 2021 20:57:46 +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 D606F60861; Thu, 8 Jul 2021 20:57:45 +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 538991809C99; Thu, 8 Jul 2021 20:57:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168Kvg1W014118 for ; Thu, 8 Jul 2021 16:57:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id C613C20B899D; Thu, 8 Jul 2021 20:57:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C10AE20B899C for ; Thu, 8 Jul 2021 20:57:39 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0294A866DFC for ; Thu, 8 Jul 2021 20:57:39 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-RiKTJyadMYOnzWbhkmx5rQ-1; Thu, 08 Jul 2021 16:57:36 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168KXfBg064929; Thu, 8 Jul 2021 16:57:35 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n28m0s92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:35 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168Kg7eA098468; Thu, 8 Jul 2021 16:57:34 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n28m0s87-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:34 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168KnI2k013138; Thu, 8 Jul 2021 20:57:32 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 39jfh8tcdd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:32 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KtYFj35717558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:55:34 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6787E4C052; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AF574C04E; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) X-MC-Unique: _nCg831mNRKkzK-_8vsYow-1 X-MC-Unique: RiKTJyadMYOnzWbhkmx5rQ-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 7/8] qemu: use common id lsec0 for launchSecurity Date: Thu, 8 Jul 2021 22:57:23 +0200 Message-Id: <20210708205724.14643-8-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Xch3fipEZ3ud9PaGVhppkI-mtqTTVzcO X-Proofpoint-ORIG-GUID: 2f-54Ww0KArWSPSqT6Wm3sATWK1rLENp X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_11:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777875319100003 Content-Type: text/plain; charset="utf-8" Use the common id 'lsec0' for all launchSecurity types in the QEMU command line construction. Signed-off-by: Boris Fiuczynski --- src/qemu/qemu_command.c | 10 +++++----- .../launch-security-s390-pv.s390x-latest.args | 4 ++-- ...curity-sev-missing-platform-info.x86_64-2.12.0.args | 4 ++-- .../launch-security-sev.x86_64-2.12.0.args | 4 ++-- .../launch-security-sev.x86_64-6.0.0.args | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 87621e8a2f..3c03ca8cdb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6971,13 +6971,13 @@ qemuBuildMachineCommandLine(virCommand *cmd, switch ((virDomainLaunchSecurity) def->sec->sectype) { case VIR_DOMAIN_LAUNCH_SECURITY_SEV: if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUE= ST_SUPPORT)) { - virBufferAddLit(&buf, ",confidential-guest-support=3Dsev0"= ); + virBufferAddLit(&buf, ",confidential-guest-support=3Dlsec0= "); } else { - virBufferAddLit(&buf, ",memory-encryption=3Dsev0"); + virBufferAddLit(&buf, ",memory-encryption=3Dlsec0"); } break; case VIR_DOMAIN_LAUNCH_SECURITY_PV: - virBufferAddLit(&buf, ",confidential-guest-support=3Dpv0"); + virBufferAddLit(&buf, ",confidential-guest-support=3Dlsec0"); break; case VIR_DOMAIN_LAUNCH_SECURITY_NONE: break; @@ -9853,7 +9853,7 @@ qemuBuildSEVCommandLine(virDomainObj *vm, virCommand = *cmd, if (sev->session) sessionpath =3D g_strdup_printf("%s/session.base64", priv->libDir); =20 - if (qemuMonitorCreateObjectProps(&props, "sev-guest", "sev0", + if (qemuMonitorCreateObjectProps(&props, "sev-guest", "lsec0", "u:cbitpos", sev->cbitpos, "u:reduced-phys-bits", sev->reduced_p= hys_bits, "u:policy", sev->policy, @@ -9878,7 +9878,7 @@ qemuBuildPVCommandLine(virDomainObj *vm, virCommand *= cmd) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; qemuDomainObjPrivate *priv =3D vm->privateData; =20 - if (qemuMonitorCreateObjectProps(&props, "s390-pv-guest", "pv0", + if (qemuMonitorCreateObjectProps(&props, "s390-pv-guest", "lsec0", NULL) < 0) return -1; =20 diff --git a/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.ar= gs b/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.args index c9d9b84dd3..cb0dac0149 100644 --- a/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.args +++ b/tests/qemuxml2argvdata/launch-security-s390-pv.s390x-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ --machine s390-ccw-virtio,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,confi= dential-guest-support=3Dpv0,memory-backend=3Ds390.ram \ +-machine s390-ccw-virtio,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,confi= dential-guest-support=3Dlsec0,memory-backend=3Ds390.ram \ -cpu gen15a-base,aen=3Don,cmmnt=3Don,vxpdeh=3Don,aefsi=3Don,diag318=3Don,c= sske=3Don,mepoch=3Don,msa9=3Don,msa8=3Don,msa7=3Don,msa6=3Don,msa5=3Don,msa= 4=3Don,msa3=3Don,msa2=3Don,msa1=3Don,sthyi=3Don,edat=3Don,ri=3Don,deflate= =3Don,edat2=3Don,etoken=3Don,vx=3Don,ipter=3Don,mepochptff=3Don,ap=3Don,vxe= h=3Don,vxpd=3Don,esop=3Don,msa9_pckmo=3Don,vxeh2=3Don,esort=3Don,apqi=3Don,= apft=3Don,els=3Don,iep=3Don,apqci=3Don,cte=3Don,ais=3Don,bpb=3Don,gs=3Don,p= pa15=3Don,zpci=3Don,sea_esop2=3Don,te=3Don,cmm=3Don \ -m 214 \ -object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":224395264= }' \ @@ -30,6 +30,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -device virtio-blk-ccw,devno=3Dfe.0.0000,drive=3Dlibvirt-1-format,id=3Dvir= tio-disk0,bootindex=3D1 \ -audiodev id=3Daudio1,driver=3Dnone \ -device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0001 \ --object '{"qom-type":"s390-pv-guest","id":"pv0"}' \ +-object '{"qom-type":"s390-pv-guest","id":"lsec0"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/launch-security-sev-missing-platform-in= fo.x86_64-2.12.0.args b/tests/qemuxml2argvdata/launch-security-sev-missing-= platform-info.x86_64-2.12.0.args index 4e281e2e59..daa271c35c 100644 --- a/tests/qemuxml2argvdata/launch-security-sev-missing-platform-info.x86_= 64-2.12.0.args +++ b/tests/qemuxml2argvdata/launch-security-sev-missing-platform-info.x86_= 64-2.12.0.args @@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=3Dnone \ -name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ -object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ --machine pc-1.0,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,memory-encrypt= ion=3Dsev0 \ +-machine pc-1.0,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,memory-encrypt= ion=3Dlsec0 \ -m 214 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ @@ -28,6 +28,6 @@ QEMU_AUDIO_DRV=3Dnone \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --object sev-guest,id=3Dsev0,cbitpos=3D47,reduced-phys-bits=3D1,policy=3D1,= dh-cert-file=3D/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,session-file=3D= /tmp/lib/domain--1-QEMUGuest1/session.base64 \ +-object sev-guest,id=3Dlsec0,cbitpos=3D47,reduced-phys-bits=3D1,policy=3D1= ,dh-cert-file=3D/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,session-file= =3D/tmp/lib/domain--1-QEMUGuest1/session.base64 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args = b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args index 40f79d377b..818d29be9f 100644 --- a/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args +++ b/tests/qemuxml2argvdata/launch-security-sev.x86_64-2.12.0.args @@ -11,7 +11,7 @@ QEMU_AUDIO_DRV=3Dnone \ -name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ -object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ --machine pc-i440fx-2.12,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,memory= -encryption=3Dsev0 \ +-machine pc-i440fx-2.12,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,memory= -encryption=3Dlsec0 \ -m 214 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ @@ -28,6 +28,6 @@ QEMU_AUDIO_DRV=3Dnone \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --object sev-guest,id=3Dsev0,cbitpos=3D47,reduced-phys-bits=3D1,policy=3D1,= dh-cert-file=3D/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,session-file=3D= /tmp/lib/domain--1-QEMUGuest1/session.base64 \ +-object sev-guest,id=3Dlsec0,cbitpos=3D47,reduced-phys-bits=3D1,policy=3D1= ,dh-cert-file=3D/tmp/lib/domain--1-QEMUGuest1/dh_cert.base64,session-file= =3D/tmp/lib/domain--1-QEMUGuest1/session.base64 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/launch-security-sev.x86_64-6.0.0.args b= /tests/qemuxml2argvdata/launch-security-sev.x86_64-6.0.0.args index f3330719dd..f2bb147a14 100644 --- a/tests/qemuxml2argvdata/launch-security-sev.x86_64-6.0.0.args +++ b/tests/qemuxml2argvdata/launch-security-sev.x86_64-6.0.0.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ --machine pc-i440fx-6.0,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,confide= ntial-guest-support=3Dsev0,memory-backend=3Dpc.ram \ +-machine pc-i440fx-6.0,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,confide= ntial-guest-support=3Dlsec0,memory-backend=3Dpc.ram \ -cpu qemu64 \ -m 214 \ -object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'= \ @@ -31,6 +31,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ -audiodev id=3Daudio1,driver=3Dnone \ --object '{"qom-type":"sev-guest","id":"sev0","cbitpos":47,"reduced-phys-bi= ts":1,"policy":1,"dh-cert-file":"/tmp/lib/domain--1-QEMUGuest1/dh_cert.base= 64","session-file":"/tmp/lib/domain--1-QEMUGuest1/session.base64"}' \ +-object '{"qom-type":"sev-guest","id":"lsec0","cbitpos":47,"reduced-phys-b= its":1,"policy":1,"dh-cert-file":"/tmp/lib/domain--1-QEMUGuest1/dh_cert.bas= e64","session-file":"/tmp/lib/domain--1-QEMUGuest1/session.base64"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don --=20 2.31.1 From nobody Tue Apr 30 00:18:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 162577789100158.0327768526854; Thu, 8 Jul 2021 13:58:11 -0700 (PDT) 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-551-RQ_Iaf-uOm2sdybSb2tXcw-1; Thu, 08 Jul 2021 16:58:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E6A41023F42; Thu, 8 Jul 2021 20:58:01 +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 455F719D9F; Thu, 8 Jul 2021 20:58:01 +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 0D8671801257; Thu, 8 Jul 2021 20:58:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 168KvguJ014111 for ; Thu, 8 Jul 2021 16:57:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F319208DD82; Thu, 8 Jul 2021 20:57:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19D1C208DD87 for ; Thu, 8 Jul 2021 20:57:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03402866DF4 for ; Thu, 8 Jul 2021 20:57:42 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-590-lWX0QHHzPT-rmtSZDbPuzA-1; Thu, 08 Jul 2021 16:57:37 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168Khtwi095492; Thu, 8 Jul 2021 16:57:36 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n287rytq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:35 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168KhsZZ095369; Thu, 8 Jul 2021 16:57:35 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 39n287rysw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 16:57:35 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168Kp6Za030567; Thu, 8 Jul 2021 20:57:33 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04fra.de.ibm.com with ESMTP id 39jfh8h92q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 20:57:32 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168KtZ7b35127632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 20:55:35 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6EA74C04E; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 743784C058; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.9.182]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 20:57:29 +0000 (GMT) X-MC-Unique: RQ_Iaf-uOm2sdybSb2tXcw-1 X-MC-Unique: lWX0QHHzPT-rmtSZDbPuzA-1 From: Boris Fiuczynski To: libvir-list@redhat.com, danielhb413@gmail.com Subject: [PATCH v4 8/8] docs: add s390-pv documentation Date: Thu, 8 Jul 2021 22:57:24 +0200 Message-Id: <20210708205724.14643-9-fiuczy@linux.ibm.com> In-Reply-To: <20210708205724.14643-1-fiuczy@linux.ibm.com> References: <20210708205724.14643-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 580VSpLfG2hUkY3f1rq9WatlJNFM7xzp X-Proofpoint-ORIG-GUID: ncgywJEdSXnh4qOISSH60-g--6-XXQL0 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_12:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080104 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: phrdina@redhat.com, pasic@linux.ibm.com, pkrempa@redhat.com, mhartmay@linux.ibm.com, shalini@linux.ibm.com, bwalk@linux.ibm.com 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1625777892902100003 Content-Type: text/plain; charset="utf-8" Add documentation for launch security type s390-pv. Signed-off-by: Boris Fiuczynski Reviewed-by: Daniel Henrique Barboza --- docs/formatdomain.rst | 7 ++++ docs/kbase/s390_protected_virt.rst | 55 +++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 25e6bf73ba..4c3c24d9df 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8081,6 +8081,13 @@ Note: DEA/TDEA is synonymous with DES/TDES. Launch Security --------------- =20 +Specifying ```` in a s390 domain prepares +the guest to run in protected virtualization secure mode, also known as +IBM Secure Execution. For more required host and guest preparation steps, = see +`Protected Virtualization on s390 `__ +:since:`Since 7.6.0` + + The contents of the ```` element is used to p= rovide the guest owners input used for creating an encrypted VM using the AMD SEV feature (Secure Encrypted Virtualization). SEV is an extension to the AMD-V diff --git a/docs/kbase/s390_protected_virt.rst b/docs/kbase/s390_protected= _virt.rst index 1718a556d4..4cbdeea7ed 100644 --- a/docs/kbase/s390_protected_virt.rst +++ b/docs/kbase/s390_protected_virt.rst @@ -127,10 +127,13 @@ Protected virtualization guests support I/O using vir= tio devices. As the virtio data structures of secure guests are not accessible by the host, it is necessary to use shared memory ('bounce buffers'). =20 -To enable virtio devices to use shared buffers, it is necessary -to configure them with platform_iommu enabled. This can done by adding -``iommu=3D'on'`` to the driver element of a virtio device definition in the -guest's XML, e.g. +Since libvirt 7.6.0 the +` `__ +element with type ``s390-pv`` should be used on protected virtualization g= uests. +Without ``launchSecurity`` you must enable all virtio devices to use shared +buffers by configuring them with platform_iommu enabled. +This can done by adding ``iommu=3D'on'`` to the driver element of a virtio +device definition in the guest's XML, e.g. =20 :: =20 @@ -140,8 +143,10 @@ guest's XML, e.g. =20 -It is mandatory to define all virtio bus devices in this way to -prevent the host from attempting to access protected memory. +Unless you are using ``launchSecurity`` you must define all virtio bus +devices in this way to prevent the host from attempting to access +protected memory. + Ballooning will not work and is fenced by QEMU. It should be disabled by specifying =20 @@ -158,8 +163,42 @@ allocated 2K entries. A commonly used value for swiotl= b is 262144. Example guest definition =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -Minimal domain XML for a protected virtualization guest, essentially -it's mostly about the ``iommu`` property +Minimal domain XML for a protected virtualization guest with +the ``launchSecurity`` element of type ``s390-pv`` + +:: + + + protected + 2048000 + 2048000 + 1 + + hvm + + + + + + + + + + + + + + + + + + + +Example guest definition without launchSecurity +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Minimal domain XML for a protected virtualization guest using the +``iommu=3D'on'`` setting for each virtio device. =20 :: =20 --=20 2.31.1