diff mbox

[v9,11/29] qmp: populate SevInfo fields with SEV guest information

Message ID 20180215153955.3253-12-brijesh.singh@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brijesh Singh Feb. 15, 2018, 3:39 p.m. UTC
query-sev command is used to get the SEV guest information, fill the
SevInfo fields with SEV guest information.

Cc: Eric Blake <eblake@redhat.com>
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>
---
 qmp.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/qmp.c b/qmp.c
index baf0b96528ae..6860ae9ad6ea 100644
--- a/qmp.c
+++ b/qmp.c
@@ -723,5 +723,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;
 }