qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Brijesh Singh <brijesh.singh@amd.com>
Subject: [Qemu-devel] [PULL 04/22] docs: add AMD Secure Encrypted Virtualization (SEV)
Date: Tue, 13 Mar 2018 13:56:20 +0100	[thread overview]
Message-ID: <1520945798-50640-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1520945798-50640-1-git-send-email-pbonzini@redhat.com>

From: Brijesh Singh <brijesh.singh@amd.com>

Create a documentation entry to describe the AMD Secure Encrypted
Virtualization (SEV) feature.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/amd-memory-encryption.txt | 92 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 docs/amd-memory-encryption.txt

diff --git a/docs/amd-memory-encryption.txt b/docs/amd-memory-encryption.txt
new file mode 100644
index 0000000..9486a22
--- /dev/null
+++ b/docs/amd-memory-encryption.txt
@@ -0,0 +1,92 @@
+Secure Encrypted Virtualization (SEV) is a feature found on AMD processors.
+
+SEV is an extension to the AMD-V architecture which supports running encrypted
+virtual machine (VMs) under the control of KVM. Encrypted VMs have their pages
+(code and data) secured such that only the guest itself has access to the
+unencrypted version. Each encrypted VM is associated with a unique encryption
+key; if its data is accessed to a different entity using a different key the
+encrypted guests data will be incorrectly decrypted, leading to unintelligible
+data.
+
+The key management of this feature is handled by separate processor known as
+AMD secure processor (AMD-SP) which is present in AMD SOCs. Firmware running
+inside the AMD-SP provide commands to support common VM lifecycle. This
+includes commands for launching, snapshotting, migrating and debugging the
+encrypted guest. Those SEV command can be issued via KVM_MEMORY_ENCRYPT_OP
+ioctls.
+
+Launching
+---------
+Boot images (such as bios) must be encrypted before guest can be booted.
+MEMORY_ENCRYPT_OP ioctl provides commands to encrypt the images :LAUNCH_START,
+LAUNCH_UPDATE_DATA, LAUNCH_MEASURE and LAUNCH_FINISH. These four commands
+together generate a fresh memory encryption key for the VM, encrypt the boot
+images and provide a measurement than can be used as an attestation of the
+successful launch.
+
+LAUNCH_START is called first to create a cryptographic launch context within
+the firmware. To create this context, guest owner must provides guest policy,
+its public Diffie-Hellman key (PDH) and session parameters. These inputs
+should be treated as binary blob and must be passed as-is to the SEV firmware.
+
+The guest policy is passed as plaintext and hypervisor may able to read it
+but should not modify it (any modification of the policy bits will result
+in bad measurement). The guest policy is a 4-byte data structure containing
+several flags that restricts what can be done on running SEV guest.
+See KM Spec section 3 and 6.2 for more details.
+
+Guest owners provided DH certificate and session parameters will be used to
+establish a cryptographic session with the guest owner to negotiate keys used
+for the attestation.
+
+LAUNCH_UPDATE_DATA encrypts the memory region using the cryptographic context
+created via LAUNCH_START command. If required, this command can be called
+multiple times to encrypt different memory regions. The command also calculates
+the measurement of the memory contents as it encrypts.
+
+LAUNCH_MEASURE command can be used to retrieve the measurement of encrypted
+memory. This measurement is a signature of the memory contents that can be
+sent to the guest owner as an attestation that the memory was encrypted
+correctly by the firmware. The guest owner may wait to provide the guest
+confidential information until it can verify the attestation measurement.
+Since the guest owner knows the initial contents of the guest at boot, the
+attestation measurement can be verified by comparing it to what the guest owner
+expects.
+
+LAUNCH_FINISH command finalizes the guest launch and destroy's the cryptographic
+context.
+
+See SEV KM API Spec [1] 'Launching a guest' usage flow (Appendix A) for the
+complete flow chart.
+
+Debugging
+-----------
+Since memory contents of SEV guest is encrypted hence hypervisor access to the
+guest memory will get a cipher text. If guest policy allows debugging, then
+hypervisor can use DEBUG_DECRYPT and DEBUG_ENCRYPT commands access the guest
+memory region for debug purposes.  This is not supported in QEMU yet.
+
+Snapshot/Restore
+-----------------
+TODO
+
+Live Migration
+----------------
+TODO
+
+References
+-----------------
+
+AMD Memory Encryption whitepaper:
+http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf
+
+Secure Encrypted Virutualization Key Management:
+[1] http://support.amd.com/TechDocs/55766_SEV-KM API_Specification.pdf
+
+KVM Forum slides:
+http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf
+
+AMD64 Architecture Programmer's Manual:
+   http://support.amd.com/TechDocs/24593.pdf
+   SME is section 7.10
+   SEV is section 15.34
-- 
1.8.3.1

  parent reply	other threads:[~2018-03-13 12:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 12:56 [Qemu-devel] [PULL 00/22] KVM patches for QEMU 2.12 soft freeze Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 01/22] update Linux headers to 4.16-rc5 Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 02/22] KVM: x86: Add support for save/load MSR_SMI_COUNT Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 03/22] machine: add memory-encryption option Paolo Bonzini
2018-03-13 12:56 ` Paolo Bonzini [this message]
2018-03-13 12:56 ` [Qemu-devel] [PULL 05/22] kvm: add memory encryption context Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 06/22] kvm: introduce memory encryption APIs Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 07/22] target/i386: add Secure Encrypted Virtualization (SEV) object Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 08/22] sev/i386: qmp: add query-sev command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 09/22] include: add psp-sev.h header file Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 10/22] sev/i386: add command to initialize the memory encryption context Paolo Bonzini
2018-04-27 13:01   ` Peter Maydell
2018-03-13 12:56 ` [Qemu-devel] [PULL 11/22] sev/i386: register the guest memory range which may contain encrypted data Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 12/22] sev/i386: add command to create launch memory encryption context Paolo Bonzini
2018-04-27 13:04   ` Peter Maydell
2018-03-13 12:56 ` [Qemu-devel] [PULL 13/22] sev/i386: add command to encrypt guest memory region Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 14/22] target/i386: encrypt bios rom Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 15/22] sev/i386: add support to LAUNCH_MEASURE command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 16/22] sev/i386: finalize the SEV guest launch flow Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 17/22] sev/i386: add migration blocker Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 18/22] cpu/i386: populate CPUID 0x8000_001F when SEV is active Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 19/22] sev/i386: hmp: add 'info sev' command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 20/22] sev/i386: qmp: add query-sev-launch-measure command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 21/22] sev/i386: qmp: add query-sev-capabilities command Paolo Bonzini
2018-03-13 12:56 ` [Qemu-devel] [PULL 22/22] sev/i386: add sev_get_capabilities() Paolo Bonzini
2018-04-27 12:53   ` Peter Maydell
2018-03-13 16:29 ` [Qemu-devel] [PULL 00/22] KVM patches for QEMU 2.12 soft freeze Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520945798-50640-5-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=brijesh.singh@amd.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).