From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSG4-0006BY-Uf for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejSG0-00072n-WE for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:40 -0500 Received: from mail-bl2nam02on0049.outbound.protection.outlook.com ([104.47.38.49]:23040 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ejSG0-00072O-QR for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:36 -0500 From: Brijesh Singh Date: Wed, 7 Feb 2018 10:06:38 -0600 Message-ID: <20180207160638.98872-26-brijesh.singh@amd.com> In-Reply-To: <20180207160638.98872-1-brijesh.singh@amd.com> References: <20180207160638.98872-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v7 26/26] qmp: add query-sev-launch-measure command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alistair Francis , Christian Borntraeger , Cornelia Huck , "Daniel P . Berrange" , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" , "Edgar E. Iglesias" , Eduardo Habkost , Eric Blake , kvm@vger.kernel.org, Marcel Apfelbaum , Markus Armbruster , Paolo Bonzini , Peter Crosthwaite , Peter Maydell , Richard Henderson , Stefan Hajnoczi , Thomas Lendacky , Borislav Petkov , Brijesh Singh The command can be used by libvirt to retrieve the measurement of SEV guest= . This measurement is a signature of the memory contents that was encrypted through the LAUNCH_UPDATE_DATA. Cc: "Daniel P. Berrang=C3=A9" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Signed-off-by: Brijesh Singh --- qapi-schema.json | 30 ++++++++++++++++++++++++++++++ qmp.c | 14 ++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 447ebb15266e..19331bff8883 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3236,3 +3236,33 @@ # ## { 'command': 'query-sev', 'returns': 'SevInfo' } + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +# +# Notes: If measurement is not available then a null measurement is return= ed. +## +{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} } + +## +# @query-sev-launch-measure: +# +# Query the SEV guest launch information. +# +# Returns: The @SevLaunchMeasureInfo for the guest +# +# Since: 2.12 +# +# Example: +# +# -> { "execute": "query-sev-launch-measure" } +# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } } +# +## +{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo'= } diff --git a/qmp.c b/qmp.c index 1a5cfad09dd0..5fb19b9d0db3 100644 --- a/qmp.c +++ b/qmp.c @@ -733,3 +733,17 @@ SevInfo *qmp_query_sev(Error **errp) =20 return info; } + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + SevLaunchMeasureInfo *info =3D NULL; + + if (sev_enabled()) { + info =3D g_malloc0(sizeof(*info)); + info->data =3D sev_get_launch_measurement(); + } else { + error_setg(errp, "SEV is not enabled"); + } + + return info; +} --=20 2.14.3