[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v4 12/20] SEV: add GUEST_STATUS command
From: |
Brijesh Singh |
Subject: |
[Qemu-devel] [RFC PATCH v4 12/20] SEV: add GUEST_STATUS command |
Date: |
Wed, 8 Mar 2017 15:53:16 -0500 |
User-agent: |
StGit/0.17.1-dirty |
The command is used to retrieve status information about an SEV-enabled guest.
Signed-off-by: Brijesh Singh <address@hidden>
---
include/sysemu/sev.h | 9 +++++++++
sev.c | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/include/sysemu/sev.h b/include/sysemu/sev.h
index 747fe87..88cbea5 100644
--- a/include/sysemu/sev.h
+++ b/include/sysemu/sev.h
@@ -82,6 +82,15 @@ struct SEVState {
typedef struct SEVState SEVState;
+enum {
+ SEV_STATE_INVALID = 0,
+ SEV_STATE_LAUNCHING,
+ SEV_STATE_SECRET,
+ SEV_STATE_RUNNING,
+ SEV_STATE_RECEIVING,
+ SEV_STATE_SENDING,
+ SEV_STATE_MAX
+};
bool sev_enabled(void);
void *sev_guest_init(const char *keyid);
diff --git a/sev.c b/sev.c
index 4b3f39a..c13bbfd 100644
--- a/sev.c
+++ b/sev.c
@@ -197,6 +197,34 @@ err:
}
static int
+sev_get_current_state(SEVState *s)
+{
+ int error;
+ int ret = SEV_STATE_INVALID;
+ struct kvm_sev_guest_status *status;
+
+ if (!s) {
+ return ret;
+ }
+
+ status = g_malloc(sizeof(*status));
+ if (!status) {
+ return ret;
+ }
+
+ ret = sev_ioctl(KVM_SEV_GUEST_STATUS, status, &error);
+ if (ret) {
+ fprintf(stderr, "failed GUEST_STATUS %d (%#x)\n", ret, error);
+ goto err;
+ }
+
+ ret = status->state;
+err:
+ g_free(status);
+ return ret;
+}
+
+static int
sev_mem_write(uint8_t *dst, const uint8_t *src, uint32_t len, MemTxAttrs attrs)
{
return 0;
- [Qemu-devel] [RFC PATCH v4 08/20] sev: add Secure Encrypted Virtulization (SEV) support, (continued)
- [Qemu-devel] [RFC PATCH v4 08/20] sev: add Secure Encrypted Virtulization (SEV) support, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 13/20] sev: add LAUNCH_UPDATE_DATA command, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 06/20] core: add new security-policy object, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 11/20] sev: add LAUNCH_START command, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 03/20] exec: add guest RAM read and write ops, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 10/20] vl: add memory encryption support, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 09/20] hmp: display memory encryption support in 'info kvm', Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 12/20] SEV: add GUEST_STATUS command,
Brijesh Singh <=
- [Qemu-devel] [RFC PATCH v4 14/20] sev: add LAUNCH_FINISH command, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 18/20] target/i386: add cpuid Fn8000_001f, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 16/20] sev: add DEBUG_ENCRYPT command, Brijesh Singh, 2017/03/08
- Re: [Qemu-devel] [RFC PATCH v4 00/20] x86: Secure Encrypted Virtualization (AMD), Eduardo Habkost, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 07/20] kvm: add memory encryption api support, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 15/20] sev: add DEBUG_DECRYPT command, Brijesh Singh, 2017/03/08
- [Qemu-devel] [RFC PATCH v4 17/20] target/i386: encrypt bios rom when memory encryption is enabled, Brijesh Singh, 2017/03/08