From 0b770bea4deaa363b1eff696402057d55d9721b6 Mon Sep 17 00:00:00 2001 From: Brijesh Singh Date: Thu, 15 Feb 2018 09:03:21 -0600 Subject: [PATCH] qmp: populate SevInfo fields with SEV guest information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit query-sev command is used to get the SEV guest information, fill the SevInfo fields with SEV guest information. Cc: Eric Blake Cc: "Daniel P. Berrangé" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Signed-off-by: Brijesh Singh [BR: FATE#322124] Signed-off-by: Bruce Rogers --- qmp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qmp.c b/qmp.c index 75b5a349b0..3c2d573384 100644 --- a/qmp.c +++ b/qmp.c @@ -726,5 +726,15 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp) SevInfo *qmp_query_sev(Error **errp) { - return NULL; + SevInfo *info = g_malloc0(sizeof(*info)); + + info->enabled = sev_enabled(); + if (info->enabled) { + sev_get_fw_version(&info->api_major, + &info->api_minor, &info->build_id); + sev_get_policy(&info->policy); + info->state = sev_get_current_state(); + } + + return info; }