[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 13/28] qmp: add query-sev command
From: |
Brijesh Singh |
Subject: |
[Qemu-devel] [PATCH v8 13/28] qmp: add query-sev command |
Date: |
Mon, 12 Feb 2018 09:37:00 -0600 |
The QMP query command can used to retrieve the SEV information when
memory encryption is enabled on AMD platform.
Cc: "Daniel P. Berrangé" <address@hidden>
Cc: "Dr. David Alan Gilbert" <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Brijesh Singh <address@hidden>
---
qapi-schema.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++
qmp.c | 16 ++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/qapi-schema.json b/qapi-schema.json
index 5c06745c7927..9203e28b8aee 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3189,3 +3189,50 @@
# Since: 2.11
##
{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+
+##
+# @SevInfo:
+#
+# Information about Secure Encrypted Virtualization (SEV) support
+#
+# @enabled: true if SEV is active
+#
+# @api-major: SEV API major version
+#
+# @api-minor: SEV API minor version
+#
+# @build-id: SEV FW build id
+#
+# @policy: SEV policy value
+#
+# @state: SEV guest state
+#
+# Since: 2.12
+##
+{ 'struct': 'SevInfo',
+ 'data': { 'enabled': 'bool',
+ 'api-major': 'uint8',
+ 'api-minor' : 'uint8',
+ 'build-id' : 'uint8',
+ 'policy' : 'uint32',
+ 'state' : 'str'
+ }
+}
+
+##
+# @query-sev:
+#
+# Returns information about SEV
+#
+# Returns: @SevInfo
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-sev" }
+# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
+# "build-id" : 0, "policy" : 0, "state" : "running" } }
+#
+##
+{ 'command': 'query-sev', 'returns': 'SevInfo' }
diff --git a/qmp.c b/qmp.c
index 793f6f332302..7907e539c8f2 100644
--- a/qmp.c
+++ b/qmp.c
@@ -39,6 +39,7 @@
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
#include "hw/acpi/acpi_dev_interface.h"
+#include "sysemu/sev.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -719,3 +720,18 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
return mem_info;
}
+
+SevInfo *qmp_query_sev(Error **errp)
+{
+ 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);
+ sev_get_current_state(&info->state);
+ }
+
+ return info;
+}
--
2.14.3
- [Qemu-devel] [PATCH v8 05/28] target/i386: add memory encryption feature cpuid support, (continued)
- [Qemu-devel] [PATCH v8 05/28] target/i386: add memory encryption feature cpuid support, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 07/28] kvm: update kvm.h to include memory encryption ioctls, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 06/28] machine: add -memory-encryption property, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 09/28] target/i386: add Secure Encrypted Virtulization (SEV) object, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 08/28] docs: add AMD Secure Encrypted Virtualization (SEV), Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 10/28] sev/i386: add command to initialize the memory encryption context, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 11/28] sev/i386: register the guest memory range which may contain encrypted data, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 12/28] kvm: introduce memory encryption APIs, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 13/28] qmp: add query-sev command,
Brijesh Singh <=
- [Qemu-devel] [PATCH v8 14/28] hmp: add 'info sev' command, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 15/28] sev/i386: add command to create launch memory encryption context, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 16/28] sev/i386: add command to encrypt guest memory region, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 17/28] target/i386: encrypt bios rom, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 19/28] sev/i386: finalize the SEV guest launch flow, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 18/28] sev/i386: add support to LAUNCH_MEASURE command, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 20/28] hw/i386: set ram_debug_ops when memory encryption is enabled, Brijesh Singh, 2018/02/12
- [Qemu-devel] [PATCH v8 21/28] sev/i386: add debug encrypt and decrypt commands, Brijesh Singh, 2018/02/12