[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 10/16] sev: add LAUNCH_UPDATE command
From: |
Brijesh Singh |
Subject: |
[Qemu-devel] [RFC PATCH v2 10/16] sev: add LAUNCH_UPDATE command |
Date: |
Thu, 22 Sep 2016 10:53:37 -0400 |
User-agent: |
StGit/0.17.1-dirty |
The command is used to encrypt a guest memory region using the VM Encryption
Key (VEK) created by LAUNCH_START command. The firmware will also update
the measurement with the contents of the memory region. This measurement
can be retrieved by calling LAUNCH_FINISH command.
Signed-off-by: Brijesh Singh <address@hidden>
---
sev.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/sev.c b/sev.c
index ead7c5a..dcd7c48 100644
--- a/sev.c
+++ b/sev.c
@@ -959,6 +959,25 @@ sev_launch_finish(SEVState *s)
return 0;
}
+static int
+sev_launch_update(SEVState *s, uint8_t *addr, uint32_t len)
+{
+ int ret;
+ struct kvm_sev_launch_update *data = s->launch_update;
+
+ assert(s->state == SEV_STATE_LAUNCHING);
+ data->address = (__u64)addr;
+ data->length = len;
+
+ ret = sev_ioctl(KVM_SEV_LAUNCH_UPDATE, data);
+ if (ret) {
+ return ret;
+ }
+
+ DPRINTF("SEV: LAUNCH_UPDATE %#lx+%#x\n", (unsigned long)addr, len);
+ return 0;
+}
+
/**
* Function returns 'true' if id is a valid QSevGuestInfo object.
*/
@@ -1056,7 +1075,11 @@ sev_mem_write(uint8_t *dst, const uint8_t *src, uint32_t
len, MemTxAttrs attrs)
assert(s != NULL);
- // fill in the code in next patches
+ if (s->state == SEV_STATE_LAUNCHING) {
+ memcpy(dst, src, len);
+ return sev_launch_update(s, dst, len);
+ }
+
return 0;
}
- Re: [Qemu-devel] [RFC PATCH v2 03/16] exec: add debug version of physical memory read and write apis, (continued)
- [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, 2016/09/22
- [Qemu-devel] [RFC PATCH v2 10/16] sev: add LAUNCH_UPDATE command,
Brijesh Singh <=
- [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