From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brijesh Singh Subject: [PATCH v10 14/28] hmp: add 'info sev' command Date: Wed, 28 Feb 2018 15:10:14 -0600 Message-ID: <20180228211028.83970-15-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Peter Crosthwaite , Paolo Bonzini To: qemu-devel@nongnu.org Return-path: In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org The command can be used to show the SEV information when memory encryption is enabled on AMD platform. Cc: Eric Blake Cc: "Daniel P. Berrang=C3=A9" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Reviewed-by: "Dr. David Alan Gilbert" Signed-off-by: Brijesh Singh --- Hi Dave, I updated the patch to address your comment on making this x86 specific, bu= t still kept your R-b, if you don't agree with changes then let me know. thanks hmp-commands-info.hx | 16 ++++++++++++++++ hmp.h | 1 + target/i386/monitor.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index ad590a4ffb2b..ddfcd5adcca6 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -867,6 +867,22 @@ Display the amount of initially allocated and present = hotpluggable (if enabled) memory in bytes. ETEXI =20 +#if defined(TARGET_I386) + { + .name =3D "sev", + .args_type =3D "", + .params =3D "", + .help =3D "show SEV information", + .cmd =3D hmp_info_sev, + }, +#endif + +STEXI +@item info sev +@findex info sev +Show SEV information. +ETEXI + STEXI @end table ETEXI diff --git a/hmp.h b/hmp.h index 1143db44a760..4ca1a77b2c1f 100644 --- a/hmp.h +++ b/hmp.h @@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict= ); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/target/i386/monitor.c b/target/i386/monitor.c index e2f02c4be95c..e664030dbd72 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -29,6 +29,7 @@ #include "qapi/qmp/qdict.h" #include "hw/i386/pc.h" #include "sysemu/kvm.h" +#include "sysemu/sev.h" #include "hmp.h" #include "sev_i386.h" #include "qmp-commands.h" @@ -680,3 +681,22 @@ SevInfo *qmp_query_sev(Error **errp) =20 return info; } + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + SevInfo *info =3D sev_get_info(); + + if (info && info->enabled) { + monitor_printf(mon, "handle: %d\n", info->handle); + monitor_printf(mon, "state: %s\n", SevState_str(info->state)); + monitor_printf(mon, "build: %d\n", info->build_id); + monitor_printf(mon, "api version: %d.%d\n", + info->api_major, info->api_minor); + monitor_printf(mon, "debug: %s\n", + info->policy & SEV_POLICY_NODBG ? "off" : "on"); + monitor_printf(mon, "key-sharing: %s\n", + info->policy & SEV_POLICY_NOKS ? "off" : "on"); + } else { + monitor_printf(mon, "SEV is not enabled\n"); + } +} --=20 2.14.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90J-0001Kh-ID for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er90G-0005nd-J2 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:11 -0500 Received: from mail-dm3nam03on0070.outbound.protection.outlook.com ([104.47.41.70]:21753 helo=NAM03-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1er90G-0005mW-8b for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:08 -0500 From: Brijesh Singh Date: Wed, 28 Feb 2018 15:10:14 -0600 Message-ID: <20180228211028.83970-15-brijesh.singh@amd.com> In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v10 14/28] hmp: add 'info sev' command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alistair Francis , Christian Borntraeger , Cornelia Huck , "Daniel P . Berrange" , "Dr. David Alan Gilbert" , "Michael S. Tsirkin" , "Edgar E. Iglesias" , Eduardo Habkost , Eric Blake , kvm@vger.kernel.org, Marcel Apfelbaum , Markus Armbruster , Paolo Bonzini , Peter Crosthwaite , Peter Maydell , Richard Henderson , Stefan Hajnoczi , Thomas Lendacky , Borislav Petkov , Alexander Graf , Bruce Rogers , Brijesh Singh The command can be used to show the SEV information when memory encryption is enabled on AMD platform. Cc: Eric Blake Cc: "Daniel P. Berrang=C3=A9" Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Reviewed-by: "Dr. David Alan Gilbert" Signed-off-by: Brijesh Singh --- Hi Dave, I updated the patch to address your comment on making this x86 specific, bu= t still kept your R-b, if you don't agree with changes then let me know. thanks hmp-commands-info.hx | 16 ++++++++++++++++ hmp.h | 1 + target/i386/monitor.c | 20 ++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index ad590a4ffb2b..ddfcd5adcca6 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -867,6 +867,22 @@ Display the amount of initially allocated and present = hotpluggable (if enabled) memory in bytes. ETEXI =20 +#if defined(TARGET_I386) + { + .name =3D "sev", + .args_type =3D "", + .params =3D "", + .help =3D "show SEV information", + .cmd =3D hmp_info_sev, + }, +#endif + +STEXI +@item info sev +@findex info sev +Show SEV information. +ETEXI + STEXI @end table ETEXI diff --git a/hmp.h b/hmp.h index 1143db44a760..4ca1a77b2c1f 100644 --- a/hmp.h +++ b/hmp.h @@ -146,5 +146,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict= ); void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict); void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict); void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict); +void hmp_info_sev(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/target/i386/monitor.c b/target/i386/monitor.c index e2f02c4be95c..e664030dbd72 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -29,6 +29,7 @@ #include "qapi/qmp/qdict.h" #include "hw/i386/pc.h" #include "sysemu/kvm.h" +#include "sysemu/sev.h" #include "hmp.h" #include "sev_i386.h" #include "qmp-commands.h" @@ -680,3 +681,22 @@ SevInfo *qmp_query_sev(Error **errp) =20 return info; } + +void hmp_info_sev(Monitor *mon, const QDict *qdict) +{ + SevInfo *info =3D sev_get_info(); + + if (info && info->enabled) { + monitor_printf(mon, "handle: %d\n", info->handle); + monitor_printf(mon, "state: %s\n", SevState_str(info->state)); + monitor_printf(mon, "build: %d\n", info->build_id); + monitor_printf(mon, "api version: %d.%d\n", + info->api_major, info->api_minor); + monitor_printf(mon, "debug: %s\n", + info->policy & SEV_POLICY_NODBG ? "off" : "on"); + monitor_printf(mon, "key-sharing: %s\n", + info->policy & SEV_POLICY_NOKS ? "off" : "on"); + } else { + monitor_printf(mon, "SEV is not enabled\n"); + } +} --=20 2.14.3