[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 09/16] sev: add LAUNCH_START command
From: |
Brijesh Singh |
Subject: |
[Qemu-devel] [RFC PATCH v2 09/16] sev: add LAUNCH_START command |
Date: |
Thu, 22 Sep 2016 10:53:19 -0400 |
User-agent: |
StGit/0.17.1-dirty |
The command is used to prepare a guest for the transition into
SEV-enabled mode.
Command uses the parameters specified in 'sev-launch-info' object, see
doc/amd-memory-encryption.txt for parameter details. The command creates
a new VM Encryption Key (VEK) and cryptographic context. The key created
during launch start process will be used to encrypt the guest memory.
Signed-off-by: Brijesh Singh <address@hidden>
---
sev.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/sev.c b/sev.c
index 226ad76..ead7c5a 100644
--- a/sev.c
+++ b/sev.c
@@ -910,17 +910,45 @@ static const TypeInfo qsev_receive_info = {
};
static int
+sev_ioctl(int cmd, void *data)
+{
+ int ret;
+ struct kvm_sev_issue_cmd input;
+
+ input.cmd = cmd;
+ input.opaque = (__u64)data;
+ ret = kvm_vm_ioctl(kvm_state, KVM_SEV_ISSUE_CMD, &input);
+ if (ret) {
+ fprintf(stderr, "sev_ioctl failed cmd=%#x, ret=%d(%#010x)\n",
+ cmd, ret, input.ret_code);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int
sev_launch_start(SEVState *s)
{
int ret;
+ if (s->state == SEV_STATE_LAUNCHING) {
+ return 0;
+ }
+
ret = sev_launch_info_get_params(s->launch_id, &s->launch_start,
&s->launch_update, &s->launch_finish);
if (ret < 0) {
return -1;
}
- // add the command to launch guest in next patches
+ ret = sev_ioctl(KVM_SEV_LAUNCH_START, s->launch_start);
+ if (ret < 0) {
+ return -1;
+ }
+
+ s->state = SEV_STATE_LAUNCHING;
+ DPRINTF("SEV: LAUNCH_START\n");
return 0;
}
- [Qemu-devel] [RFC PATCH v2 03/16] exec: add debug version of physical memory read and write apis, (continued)
- [Qemu-devel] [RFC PATCH v2 03/16] exec: add debug version of physical memory read and write apis, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 04/16] monitor: use debug version of memory access apis, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 05/16] core: add new security-policy object, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 06/16] sev: add Secure Encrypted Virtulization (SEV) support, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 07/16] hmp: display memory encryption support in 'info kvm', Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 08/16] core: loader: create memory encryption context before copying data, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 09/16] sev: add LAUNCH_START command,
Brijesh Singh <=
- [Qemu-devel] [RFC PATCH v2 10/16] sev: add LAUNCH_UPDATE command, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 11/16] sev: add LAUNCH_FINISH command, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 12/16] sev: add DEBUG_DECRYPT command, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 13/16] sev: add DEBUG_ENCRYPT command, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 14/16] i386: set memory encryption ops for PC.BIOS and PC.RAM regions, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 15/16] target-i386: add cpuid Fn8000_001f, Brijesh Singh, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 16/16] i386: clear C-bit in SEV guest page table walk, Brijesh Singh, 2016/09/22
- Re: [Qemu-devel] [RFC PATCH v2 00/16] x86: Secure Encrypted Virtualization (AMD), no-reply, 2016/09/22
- Re: [Qemu-devel] [RFC PATCH v2 00/16] x86: Secure Encrypted Virtualization (AMD), no-reply, 2016/09/22