From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emLex-0004pg-SE for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:41:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emLet-0003fQ-VO for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:41:19 -0500 Received: from mail-bn3nam01on0047.outbound.protection.outlook.com ([104.47.33.47]:24802 helo=NAM01-BN3-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 1emLet-0003fI-OV for qemu-devel@nongnu.org; Thu, 15 Feb 2018 10:41:15 -0500 From: Brijesh Singh Date: Thu, 15 Feb 2018 09:39:52 -0600 Message-ID: <20180215153955.3253-27-brijesh.singh@amd.com> In-Reply-To: <20180215153955.3253-1-brijesh.singh@amd.com> References: <20180215153955.3253-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 v9 26/29] 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 , Alexander Graf , Bruce Rogers , 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 | 29 +++++++++++++++++++++++++++++ qmp.c | 17 +++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/qapi-schema.json b/qapi-schema.json index 46f7a3c9ea83..1ae45a908369 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3246,3 +3246,32 @@ # ## { 'command': 'query-sev', 'returns': 'SevInfo' } + +## +# @SevLaunchMeasureInfo: +# +# SEV Guest Launch measurement information +# +# @data: the measurement value encoded in base64 +# +# Since: 2.12 +# +## +{ '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 6860ae9ad6ea..7253720a2092 100644 --- a/qmp.c +++ b/qmp.c @@ -735,3 +735,20 @@ SevInfo *qmp_query_sev(Error **errp) =20 return info; } + +SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp) +{ + char *data; + SevLaunchMeasureInfo *info; + + data =3D sev_get_launch_measurement(); + if (!data) { + error_setg(errp, "Measurement is not available"); + return NULL; + } + + info =3D g_malloc0(sizeof(*info)); + info->data =3D data; + + return info; +} --=20 2.14.3