diff mbox

[RFC,v2,07/16] hmp: display memory encryption support in 'info kvm'

Message ID 147455597948.8519.11161523289950636174.stgit@brijesh-build-machine
State New
Headers show

Commit Message

Brijesh Singh Sept. 22, 2016, 2:52 p.m. UTC
update 'info kvm' to display the memory encryption support.

(qemu) info kvm
kvm support: enabled
memory encryption: disabled

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 hmp.c            |    2 ++
 qapi-schema.json |    7 +++++--
 qmp.c            |    1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

Comments

Eric Blake Sept. 22, 2016, 3:32 p.m. UTC | #1
On 09/22/2016 09:52 AM, Brijesh Singh wrote:
> update 'info kvm' to display the memory encryption support.
> 
> (qemu) info kvm
> kvm support: enabled
> memory encryption: disabled
> 
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---

> +++ b/qapi-schema.json
> @@ -99,9 +99,12 @@
>  #
>  # @present: true if KVM acceleration is built into this executable
>  #
> -# Since: 0.14.0
> +# @mem_encryption: true if Memory Encryption is active
> +#
> +# Since: 2.8.0

Not quite right.  The KvmInfo struct is still since 0.14.0, only the
mem_encryption member is new.  And new members should be spelled with
'-' rather than '_', if there is no other '_' in the struct.

So you want:

# @present: true if KVM acceleration is built into this executable
#
# @mem-encryption: true if Memory Encryption is active (since 2.8)
#
# Since: 0.14.0

>  ##
> -{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
> +{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool',
> +            'mem_encryption' : 'bool'} }

and with the corresponding spelling fix here.
diff mbox

Patch

diff --git a/hmp.c b/hmp.c
index cc2056e..11e4005 100644
--- a/hmp.c
+++ b/hmp.c
@@ -81,6 +81,8 @@  void hmp_info_kvm(Monitor *mon, const QDict *qdict)
     monitor_printf(mon, "kvm support: ");
     if (info->present) {
         monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
+        monitor_printf(mon, "memory encryption: %s\n",
+                       info->mem_encryption ? "enabled" : "disabled");
     } else {
         monitor_printf(mon, "not compiled\n");
     }
diff --git a/qapi-schema.json b/qapi-schema.json
index 5658723..ce7b7e9 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -99,9 +99,12 @@ 
 #
 # @present: true if KVM acceleration is built into this executable
 #
-# Since: 0.14.0
+# @mem_encryption: true if Memory Encryption is active
+#
+# Since: 2.8.0
 ##
-{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
+{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool',
+            'mem_encryption' : 'bool'} }
 
 ##
 # @query-kvm:
diff --git a/qmp.c b/qmp.c
index b6d531e..62f3e60 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->mem_encryption = kvm_memory_encryption_enabled();
 
     return info;
 }