qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 13/22] hmp: update 'info kvm' to display SEV


From: Brijesh Singh
Subject: [Qemu-devel] [RFC PATCH v1 13/22] hmp: update 'info kvm' to display SEV status
Date: Tue, 13 Sep 2016 10:48:59 -0400
User-agent: StGit/0.17.1-dirty

Update the 'info kvm' monitor command to display the SEV status.

(qemu) info kvm
kvm support: enabled
sev support: enabled (running)

Signed-off-by: Brijesh Singh <address@hidden>
---
 hmp.c            |   14 ++++++++++++++
 qapi-schema.json |    4 +++-
 qmp.c            |    1 +
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index cc2056e..068b77d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -18,6 +18,7 @@
 #include "net/net.h"
 #include "net/eth.h"
 #include "sysemu/char.h"
+#include "sysemu/sev.h"
 #include "sysemu/block-backend.h"
 #include "qemu/option.h"
 #include "qemu/timer.h"
@@ -76,11 +77,24 @@ void hmp_info_version(Monitor *mon, const QDict *qdict)
 void hmp_info_kvm(Monitor *mon, const QDict *qdict)
 {
     KvmInfo *info;
+    SevState state;
+    char msg[80] = {0};
 
     info = qmp_query_kvm(NULL);
     monitor_printf(mon, "kvm support: ");
     if (info->present) {
         monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
+        monitor_printf(mon, "sev support: %s",
+                        info->sev ? "enabled" : "disabled");
+        if (info->sev) {
+            if (kvm_sev_get_status(&state, msg)) {
+                monitor_printf(mon, " (error)\n");
+            } else {
+                monitor_printf(mon, " (%s)\n", msg);
+            }
+        } else {
+            monitor_printf(mon, "\n");
+        }
     } else {
         monitor_printf(mon, "not compiled\n");
     }
diff --git a/qapi-schema.json b/qapi-schema.json
index 5658723..86b5dc9 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -99,9 +99,11 @@
 #
 # @present: true if KVM acceleration is built into this executable
 #
+# @sev: true if SEV is active
+#
 # Since: 0.14.0
 ##
-{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
+{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool', 'sev' : 
'bool'} }
 
 ##
 # @query-kvm:
diff --git a/qmp.c b/qmp.c
index b6d531e..834edb8 100644
--- a/qmp.c
+++ b/qmp.c
@@ -77,6 +77,7 @@ KvmInfo *qmp_query_kvm(Error **errp)
 
     info->enabled = kvm_enabled();
     info->present = kvm_available();
+    info->sev = kvm_sev_enabled();
 
     return info;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]