From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Brijesh Singh" <brijesh.singh@amd.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: [Qemu-devel] [PULL 20/22] sev/i386: qmp: add query-sev-launch-measure command
Date: Tue, 13 Mar 2018 13:56:36 +0100 [thread overview]
Message-ID: <1520945798-50640-21-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1520945798-50640-1-git-send-email-pbonzini@redhat.com>
From: Brijesh Singh <brijesh.singh@amd.com>
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>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
monitor.c | 7 +++++++
qapi/misc.json | 29 +++++++++++++++++++++++++++++
target/i386/monitor.c | 17 +++++++++++++++++
tests/qmp-test.c | 2 ++
4 files changed, 55 insertions(+)
diff --git a/monitor.c b/monitor.c
index af11654..36ed087 100644
--- a/monitor.c
+++ b/monitor.c
@@ -984,6 +984,7 @@ static void qmp_unregister_commands_hack(void)
#ifndef TARGET_I386
qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
qmp_unregister_command(&qmp_commands, "query-sev");
+ qmp_unregister_command(&qmp_commands, "query-sev-launch-measure");
#endif
#ifndef TARGET_S390X
qmp_unregister_command(&qmp_commands, "dump-skeys");
@@ -4110,6 +4111,12 @@ SevInfo *qmp_query_sev(Error **errp)
error_setg(errp, QERR_FEATURE_DISABLED, "query-sev");
return NULL;
}
+
+SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
+{
+ error_setg(errp, QERR_FEATURE_DISABLED, "query-sev-launch-measure");
+ return NULL;
+}
#endif
#ifndef TARGET_S390X
diff --git a/qapi/misc.json b/qapi/misc.json
index 7b628c2..b8318f5 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -3293,3 +3293,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/target/i386/monitor.c b/target/i386/monitor.c
index 64b5e6e..f8a0e4b 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -697,3 +697,20 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "SEV is not enabled\n");
}
}
+
+SevLaunchMeasureInfo *qmp_query_sev_launch_measure(Error **errp)
+{
+ char *data;
+ SevLaunchMeasureInfo *info;
+
+ data = sev_get_launch_measurement();
+ if (!data) {
+ error_setg(errp, "Measurement is not available");
+ return NULL;
+ }
+
+ info = g_malloc0(sizeof(*info));
+ info->data = data;
+
+ return info;
+}
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index a77ff92..ec8c7c7 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -204,6 +204,8 @@ static bool query_is_blacklisted(const char *cmd)
"query-gic-capabilities", /* arm */
/* Success depends on target-specific build configuration: */
"query-pci", /* CONFIG_PCI */
+ /* Success depends on launching SEV guest */
+ "query-sev-launch-measure",
/* Success depends on Host or Hypervisor SEV support */
"query-sev",
NULL
--
1.8.3.1
next prev parent reply other threads:[~2018-03-13 12:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 12:56 [Qemu-devel] [PULL 00/22] KVM patches for QEMU 2.12 soft freeze Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 01/22] update Linux headers to 4.16-rc5 Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 02/22] KVM: x86: Add support for save/load MSR_SMI_COUNT Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 03/22] machine: add memory-encryption option Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 04/22] docs: add AMD Secure Encrypted Virtualization (SEV) Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 05/22] kvm: add memory encryption context Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 06/22] kvm: introduce memory encryption APIs Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 07/22] target/i386: add Secure Encrypted Virtualization (SEV) object Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 08/22] sev/i386: qmp: add query-sev command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 09/22] include: add psp-sev.h header file Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 10/22] sev/i386: add command to initialize the memory encryption context Paolo Bonzini
2018-04-27 13:01 ` Peter Maydell
2018-03-13 12:56 ` [Qemu-devel] [PULL 11/22] sev/i386: register the guest memory range which may contain encrypted data Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 12/22] sev/i386: add command to create launch memory encryption context Paolo Bonzini
2018-04-27 13:04 ` Peter Maydell
2018-03-13 12:56 ` [Qemu-devel] [PULL 13/22] sev/i386: add command to encrypt guest memory region Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 14/22] target/i386: encrypt bios rom Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 15/22] sev/i386: add support to LAUNCH_MEASURE command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 16/22] sev/i386: finalize the SEV guest launch flow Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 17/22] sev/i386: add migration blocker Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 18/22] cpu/i386: populate CPUID 0x8000_001F when SEV is active Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 19/22] sev/i386: hmp: add 'info sev' command Paolo Bonzini
2018-03-13 12:56 ` Paolo Bonzini [this message]
2018-03-13 12:56 ` [Qemu-devel] [PULL 21/22] sev/i386: qmp: add query-sev-capabilities command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 22/22] sev/i386: add sev_get_capabilities() Paolo Bonzini
2018-04-27 12:53 ` Peter Maydell
2018-03-13 16:29 ` [Qemu-devel] [PULL 00/22] KVM patches for QEMU 2.12 soft freeze Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520945798-50640-21-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).