2018-02-22 23:01:24 +01:00
|
|
|
From 53ad8885ec786df6820288255a312e802839ecc4 Mon Sep 17 00:00:00 2001
|
2018-02-08 20:55:31 +01:00
|
|
|
From: Brijesh Singh <brijesh.singh@amd.com>
|
2018-02-22 23:01:24 +01:00
|
|
|
Date: Thu, 15 Feb 2018 09:03:24 -0600
|
2018-02-08 20:55:31 +01:00
|
|
|
Subject: [PATCH] qmp: add query-sev-launch-measure command
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
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é" <berrange@redhat.com>
|
|
|
|
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
|
Cc: Markus Armbruster <armbru@redhat.com>
|
|
|
|
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
|
|
|
|
[BR: FATE#322124]
|
|
|
|
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
|
|
---
|
2018-02-22 23:01:24 +01:00
|
|
|
qapi-schema.json | 29 +++++++++++++++++++++++++++++
|
|
|
|
qmp.c | 17 +++++++++++++++++
|
|
|
|
2 files changed, 46 insertions(+)
|
2018-02-08 20:55:31 +01:00
|
|
|
|
|
|
|
diff --git a/qapi-schema.json b/qapi-schema.json
|
2018-02-22 23:01:24 +01:00
|
|
|
index 91a8a74f81..215681fbd7 100644
|
2018-02-08 20:55:31 +01:00
|
|
|
--- a/qapi-schema.json
|
|
|
|
+++ b/qapi-schema.json
|
2018-02-22 23:01:24 +01:00
|
|
|
@@ -3257,3 +3257,32 @@
|
2018-02-08 20:55:31 +01:00
|
|
|
#
|
|
|
|
##
|
|
|
|
{ '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
|
2018-02-22 23:01:24 +01:00
|
|
|
index 3c2d573384..445c668428 100644
|
2018-02-08 20:55:31 +01:00
|
|
|
--- a/qmp.c
|
|
|
|
+++ b/qmp.c
|
2018-02-22 23:01:24 +01:00
|
|
|
@@ -738,3 +738,20 @@ SevInfo *qmp_query_sev(Error **errp)
|
2018-02-08 20:55:31 +01:00
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
|
|
|
|
+{
|
2018-02-22 23:01:24 +01:00
|
|
|
+ char *data;
|
|
|
|
+ SevLaunchMeasureInfo *info;
|
2018-02-08 20:55:31 +01:00
|
|
|
+
|
2018-02-22 23:01:24 +01:00
|
|
|
+ data = sev_get_launch_measurement();
|
|
|
|
+ if (!data) {
|
|
|
|
+ error_setg(errp, "Measurement is not available");
|
|
|
|
+ return NULL;
|
2018-02-08 20:55:31 +01:00
|
|
|
+ }
|
|
|
|
+
|
2018-02-22 23:01:24 +01:00
|
|
|
+ info = g_malloc0(sizeof(*info));
|
|
|
|
+ info->data = data;
|
|
|
|
+
|
2018-02-08 20:55:31 +01:00
|
|
|
+ return info;
|
|
|
|
+}
|