From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjpXF-0004GY-FC for qemu-devel@nongnu.org; Tue, 13 Sep 2016 11:22:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjpXA-0001Zp-Lr for qemu-devel@nongnu.org; Tue, 13 Sep 2016 11:22:09 -0400 Received: from mail-bn3nam01on0051.outbound.protection.outlook.com ([104.47.33.51]:58328 helo=NAM01-BN3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjpXA-0001YS-FZ for qemu-devel@nongnu.org; Tue, 13 Sep 2016 11:22:04 -0400 From: Brijesh Singh Date: Tue, 13 Sep 2016 10:48:59 -0400 Message-ID: <147377813927.11859.13242503366595564820.stgit@brijesh-build-machine> In-Reply-To: <147377800565.11859.4411044563640180545.stgit@brijesh-build-machine> References: <147377800565.11859.4411044563640180545.stgit@brijesh-build-machine> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC PATCH v1 13/22] hmp: update 'info kvm' to display SEV status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ehabkost@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mst@redhat.com, p.fedin@samsung.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com, rth@twiddle.net 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 --- 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; }